]> Gentwo Git Trees - linux/.git/commitdiff
fuse: optmize missing FUSE_LINK support
authorMiklos Szeredi <mszeredi@redhat.com>
Fri, 14 Feb 2025 10:00:53 +0000 (11:00 +0100)
committerMiklos Szeredi <mszeredi@redhat.com>
Fri, 14 Feb 2025 10:00:53 +0000 (11:00 +0100)
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>
fs/fuse/dir.c
fs/fuse/fuse_i.h

index f07ccaefd1ecfe02b806c30fa9edc6f481260ee8..589e888223686b8c8465baa546dfcc7c7fa007ea 100644 (file)
@@ -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;
 }
 
index fee96fe7887b30cd57b8a6bbda11447a228cf446..3ad5d4b8f7c5da24798dbb873826742117a195cd 100644 (file)
@@ -867,6 +867,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;