diff options
author | 2025-02-14 11:00:53 +0100 | |
---|---|---|
committer | 2025-03-31 14:55:36 +0200 | |
commit | eef36cf6a7016cb5353d4b0a9dbdfbd52c4bd973 (patch) | |
tree | 754ca2303a400fee1ba602d3d91f1bdf82a1f150 | |
parent | fuse: Return EPERM rather than ENOSYS from link() (diff) | |
download | linux-rng-eef36cf6a7016cb5353d4b0a9dbdfbd52c4bd973.tar.xz linux-rng-eef36cf6a7016cb5353d4b0a9dbdfbd52c4bd973.zip |
fuse: optmize missing FUSE_LINK support
If filesystem doesn't support FUSE_LINK (i.e. returns -ENOSYS), then
remember this and next time return immediately, without incurring the
overhead of a round trip to the server.
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
-rw-r--r-- | fs/fuse/dir.c | 9 | ||||
-rw-r--r-- | fs/fuse/fuse_i.h | 3 |
2 files changed, 11 insertions, 1 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 1717ae0d0864..83c56ce6ad20 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -1123,6 +1123,9 @@ static int fuse_link(struct dentry *entry, struct inode *newdir, struct fuse_mount *fm = get_fuse_mount(inode); FUSE_ARGS(args); + if (fm->fc->no_link) + goto out; + memset(&inarg, 0, sizeof(inarg)); inarg.oldnodeid = get_node_id(inode); args.opcode = FUSE_LINK; @@ -1138,7 +1141,11 @@ static int fuse_link(struct dentry *entry, struct inode *newdir, fuse_invalidate_attr(inode); if (err == -ENOSYS) - err = -EPERM; + fm->fc->no_link = 1; +out: + if (fm->fc->no_link) + return -EPERM; + return err; } diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 2086dac7243b..6f00b177a434 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h @@ -870,6 +870,9 @@ struct fuse_conn { /* Use pages instead of pointer for kernel I/O */ unsigned int use_pages_for_kvec_io:1; + /* Is link not implemented by fs? */ + unsigned int no_link:1; + /* Use io_uring for communication */ unsigned int io_uring; |