]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
afs: Fix off-by-one in afs_rename() expected data version calculation
authorDavid Howells <dhowells@redhat.com>
Tue, 30 Jul 2019 13:38:51 +0000 (14:38 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Sep 2019 08:23:14 +0000 (10:23 +0200)
[ Upstream commit 37c0bbb3326674940e657118306ac52364314523 ]

When afs_rename() calculates the expected data version of the target
directory in a cross-directory rename, it doesn't increment it as it
should, so it always thinks that the target inode is unexpectedly modified
on the server.

Fixes: a58823ac4589 ("afs: Fix application of status and callback to be under same lock")
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/afs/dir.c

index da9563d62b32717a5b03e6cd1d7506b356410974..9750ac70f8ffba2811c80b642e7f57d846d529ed 100644 (file)
@@ -1807,7 +1807,7 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry,
                                afs_end_vnode_operation(&fc);
                                goto error_rehash;
                        }
-                       new_data_version = new_dvnode->status.data_version;
+                       new_data_version = new_dvnode->status.data_version + 1;
                } else {
                        new_data_version = orig_data_version;
                        new_scb = &scb[0];