Skip to content

Commit ee8a8dd

Browse files
dhowellsgregkh
authored andcommitted
afs: Fix the nlink handling of dir-over-dir rename
commit f610a5a upstream. Fix rename of one directory over another such that the nlink on the deleted directory is cleared to 0 rather than being decremented to 1. This was causing the generic/035 xfstest to fail. Fixes: e49c7b2 ("afs: Build an abstraction around an "operation" concept") Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Marc Dionne <marc.dionne@auristor.com> cc: linux-afs@lists.infradead.org Link: https://lore.kernel.org/r/162194384460.3999479.7605572278074191079.stgit@warthog.procyon.org.uk/ # v1 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ce23a0a commit ee8a8dd

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎fs/afs/dir.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1837,7 +1837,9 @@ static void afs_rename_edit_dir(struct afs_operation *op)
18371837
new_inode = d_inode(new_dentry);
18381838
if (new_inode) {
18391839
spin_lock(&new_inode->i_lock);
1840-
if (new_inode->i_nlink > 0)
1840+
if (S_ISDIR(new_inode->i_mode))
1841+
clear_nlink(new_inode);
1842+
else if (new_inode->i_nlink > 0)
18411843
drop_nlink(new_inode);
18421844
spin_unlock(&new_inode->i_lock);
18431845
}

0 commit comments

Comments
 (0)