diff options
author | Amir Goldstein <amir73il@gmail.com> | 2024-02-02 13:30:30 +0200 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2024-02-23 17:36:32 +0100 |
commit | 7de64d521bf92396b7da8ae0600188ea5d75a4c9 (patch) | |
tree | f25623e90fac50d741de1d5076e2345aa7dad2b9 /fs/fuse/dir.c | |
parent | e26ee4efbc79610b20e7abe9d96c87f33dacc1ff (diff) | |
download | linux-7de64d521bf92396b7da8ae0600188ea5d75a4c9.tar.gz linux-7de64d521bf92396b7da8ae0600188ea5d75a4c9.tar.bz2 linux-7de64d521bf92396b7da8ae0600188ea5d75a4c9.zip |
fuse: break up fuse_open_common()
fuse_open_common() has a lot of code relevant only for regular files and
O_TRUNC in particular.
Copy the little bit of remaining code into fuse_dir_open() and stop using
this common helper for directory open.
Also split out fuse_dir_finish_open() from fuse_finish_open() before we add
inode io modes to fuse_finish_open().
Suggested-by: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/fuse/dir.c')
-rw-r--r-- | fs/fuse/dir.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index b8fc3a6b87fe..66873be14670 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -1630,7 +1630,30 @@ out_err: static int fuse_dir_open(struct inode *inode, struct file *file) { - return fuse_open_common(inode, file, true); + struct fuse_mount *fm = get_fuse_mount(inode); + int err; + + if (fuse_is_bad(inode)) + return -EIO; + + err = generic_file_open(inode, file); + if (err) + return err; + + err = fuse_do_open(fm, get_node_id(inode), file, true); + if (!err) { + struct fuse_file *ff = file->private_data; + + /* + * Keep handling FOPEN_STREAM and FOPEN_NONSEEKABLE for + * directories for backward compatibility, though it's unlikely + * to be useful. + */ + if (ff->open_flags & (FOPEN_STREAM | FOPEN_NONSEEKABLE)) + nonseekable_open(inode, file); + } + + return err; } static int fuse_dir_release(struct inode *inode, struct file *file) |