simplify fuse_atomic_open()

Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2025-09-12 12:01:31 -04:00
parent aae9db5739
commit 1d7b343785

View 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);
}
/*