]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
coda: use iterate_dir() in coda_readdir()
authorNeilBrown <neil@brown.name>
Sun, 8 Jun 2025 23:09:35 +0000 (09:09 +1000)
committerChristian Brauner <brauner@kernel.org>
Wed, 11 Jun 2025 11:44:15 +0000 (13:44 +0200)
The code in coda_readdir() is nearly identical to iterate_dir().
Differences are:
 - iterate_dir() is killable
 - iterate_dir() adds permission checking and accessing notifications

I believe these are not harmful for coda so it is best to use
iterate_dir() directly.  This will allow locking changes without
touching the code in coda.

Signed-off-by: NeilBrown <neil@brown.name>
Link: https://lore.kernel.org/20250608230952.20539-4-neil@brown.name
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/coda/dir.c

index ab69d8f0cec2219f260fc71108c0c5d63b568d6a..ca99900172657d80a479b2eb27f50effdf834995 100644 (file)
@@ -429,17 +429,9 @@ static int coda_readdir(struct file *coda_file, struct dir_context *ctx)
        cfi = coda_ftoc(coda_file);
        host_file = cfi->cfi_container;
 
-       if (host_file->f_op->iterate_shared) {
-               struct inode *host_inode = file_inode(host_file);
-               ret = -ENOENT;
-               if (!IS_DEADDIR(host_inode)) {
-                       inode_lock_shared(host_inode);
-                       ret = host_file->f_op->iterate_shared(host_file, ctx);
-                       file_accessed(host_file);
-                       inode_unlock_shared(host_inode);
-               }
+       ret = iterate_dir(host_file, ctx);
+       if (ret != -ENOTDIR)
                return ret;
-       }
        /* Venus: we must read Venus dirents from a file */
        return coda_venus_readdir(coda_file, ctx);
 }