]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
simplify fuse_atomic_open()
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 12 Sep 2025 16:01:31 +0000 (12:01 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Wed, 17 Sep 2025 03:59:38 +0000 (23:59 -0400)
Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/fuse/dir.c

index 2d817d7cab2649c5384affd5a9e99462e6af320e..d3076bfddb8943703fdfa7dc2fcedacde4be9993 100644 (file)
@@ -739,22 +739,18 @@ static int fuse_atomic_open(struct inode *dir, struct dentry *entry,
        int err;
        struct mnt_idmap *idmap = file_mnt_idmap(file);
        struct fuse_conn *fc = get_fuse_conn(dir);
-       struct dentry *res = NULL;
 
        if (fuse_is_bad(dir))
                return -EIO;
 
        if (d_in_lookup(entry)) {
-               res = fuse_lookup(dir, entry, 0);
-               if (IS_ERR(res))
-                       return PTR_ERR(res);
-
-               if (res)
-                       entry = res;
+               struct dentry *res = fuse_lookup(dir, entry, 0);
+               if (res || d_really_is_positive(entry))
+                       return finish_no_open(file, res);
        }
 
-       if (!(flags & O_CREAT) || d_really_is_positive(entry))
-               goto no_open;
+       if (!(flags & O_CREAT))
+               return finish_no_open(file, NULL);
 
        /* Only creates */
        file->f_mode |= FMODE_CREATED;
@@ -768,16 +764,13 @@ static int fuse_atomic_open(struct inode *dir, struct dentry *entry,
                goto mknod;
        } else if (err == -EEXIST)
                fuse_invalidate_entry(entry);
-out_dput:
-       dput(res);
        return err;
 
 mknod:
        err = fuse_mknod(idmap, dir, entry, mode, 0);
        if (err)
-               goto out_dput;
-no_open:
-       return finish_no_open(file, res);
+               return err;
+       return finish_no_open(file, NULL);
 }
 
 /*