Skip to content

Commit eef36cf

Browse files
author
Miklos Szeredi
committed
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>
1 parent 8344213 commit eef36cf

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

fs/fuse/dir.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1123,6 +1123,9 @@ static int fuse_link(struct dentry *entry, struct inode *newdir,
11231123
struct fuse_mount *fm = get_fuse_mount(inode);
11241124
FUSE_ARGS(args);
11251125

1126+
if (fm->fc->no_link)
1127+
goto out;
1128+
11261129
memset(&inarg, 0, sizeof(inarg));
11271130
inarg.oldnodeid = get_node_id(inode);
11281131
args.opcode = FUSE_LINK;
@@ -1138,7 +1141,11 @@ static int fuse_link(struct dentry *entry, struct inode *newdir,
11381141
fuse_invalidate_attr(inode);
11391142

11401143
if (err == -ENOSYS)
1141-
err = -EPERM;
1144+
fm->fc->no_link = 1;
1145+
out:
1146+
if (fm->fc->no_link)
1147+
return -EPERM;
1148+
11421149
return err;
11431150
}
11441151

fs/fuse/fuse_i.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,9 @@ struct fuse_conn {
870870
/* Use pages instead of pointer for kernel I/O */
871871
unsigned int use_pages_for_kvec_io:1;
872872

873+
/* Is link not implemented by fs? */
874+
unsigned int no_link:1;
875+
873876
/* Use io_uring for communication */
874877
unsigned int io_uring;
875878

0 commit comments

Comments
 (0)