]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
afs: Fix EEXIST error returned from afs_rmdir() to be ENOTEMPTY
authorDavid Howells <dhowells@redhat.com>
Mon, 16 Dec 2024 20:41:02 +0000 (20:41 +0000)
committerChristian Brauner <brauner@kernel.org>
Fri, 20 Dec 2024 21:34:04 +0000 (22:34 +0100)
AFS servers pass back a code indicating EEXIST when they're asked to remove
a directory that is not empty rather than ENOTEMPTY because not all the
systems that an AFS server can run on have the latter error available and
AFS preexisted the addition of that error in general.

Fix afs_rmdir() to translate EEXIST to ENOTEMPTY.

Fixes: 260a980317da ("[AFS]: Add "directory write" support.")
Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://lore.kernel.org/r/20241216204124.3752367-13-dhowells@redhat.com
cc: Marc Dionne <marc.dionne@auristor.com>
cc: linux-afs@lists.infradead.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/afs/dir.c

index ada363af5aab8e8e1fc806327dfecae1d4ca14cb..50edd1cae28aced7f4a56f8bd6fb1ab2a0690b8b 100644 (file)
@@ -1472,7 +1472,12 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry)
                op->file[1].vnode = vnode;
        }
 
-       return afs_do_sync_operation(op);
+       ret = afs_do_sync_operation(op);
+
+       /* Not all systems that can host afs servers have ENOTEMPTY. */
+       if (ret == -EEXIST)
+               ret = -ENOTEMPTY;
+       return ret;
 
 error:
        return afs_put_operation(op);