Skip to content

Commit bfa3037

Browse files
committed
Merge tag 'fuse-update-6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse
Pull fuse fixes from Miklos Szeredi: "Small but important fixes and a trivial cleanup" * tag 'fuse-update-6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse: fuse: ioctl: translate ENOSYS in outarg fuse: revalidate: don't invalidate if interrupted fuse: Apply flags2 only when userspace set the FUSE_INIT_EXT fuse: remove duplicate check for nodeid fuse: add feature flag for expire-only
2 parents ccff6d1 + 6a567e9 commit bfa3037

File tree

4 files changed

+23
-13
lines changed

4 files changed

+23
-13
lines changed

fs/fuse/dir.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, unsigned int flags)
258258
spin_unlock(&fi->lock);
259259
}
260260
kfree(forget);
261-
if (ret == -ENOMEM)
261+
if (ret == -ENOMEM || ret == -EINTR)
262262
goto out;
263263
if (ret || fuse_invalid_attr(&outarg.attr) ||
264264
fuse_stale_inode(inode, outarg.generation, &outarg.attr))
@@ -395,8 +395,6 @@ int fuse_lookup_name(struct super_block *sb, u64 nodeid, const struct qstr *name
395395
goto out_put_forget;
396396

397397
err = -EIO;
398-
if (!outarg->nodeid)
399-
goto out_put_forget;
400398
if (fuse_invalid_attr(&outarg->attr))
401399
goto out_put_forget;
402400

fs/fuse/inode.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,10 @@ static void process_init_reply(struct fuse_mount *fm, struct fuse_args *args,
11341134
process_init_limits(fc, arg);
11351135

11361136
if (arg->minor >= 6) {
1137-
u64 flags = arg->flags | (u64) arg->flags2 << 32;
1137+
u64 flags = arg->flags;
1138+
1139+
if (flags & FUSE_INIT_EXT)
1140+
flags |= (u64) arg->flags2 << 32;
11381141

11391142
ra_pages = arg->max_readahead / PAGE_SIZE;
11401143
if (flags & FUSE_ASYNC_READ)
@@ -1254,7 +1257,8 @@ void fuse_send_init(struct fuse_mount *fm)
12541257
FUSE_ABORT_ERROR | FUSE_MAX_PAGES | FUSE_CACHE_SYMLINKS |
12551258
FUSE_NO_OPENDIR_SUPPORT | FUSE_EXPLICIT_INVAL_DATA |
12561259
FUSE_HANDLE_KILLPRIV_V2 | FUSE_SETXATTR_EXT | FUSE_INIT_EXT |
1257-
FUSE_SECURITY_CTX | FUSE_CREATE_SUPP_GROUP;
1260+
FUSE_SECURITY_CTX | FUSE_CREATE_SUPP_GROUP |
1261+
FUSE_HAS_EXPIRE_ONLY;
12581262
#ifdef CONFIG_FUSE_DAX
12591263
if (fm->fc->dax)
12601264
flags |= FUSE_MAP_ALIGNMENT;

fs/fuse/ioctl.c

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,23 @@
99
#include <linux/compat.h>
1010
#include <linux/fileattr.h>
1111

12-
static ssize_t fuse_send_ioctl(struct fuse_mount *fm, struct fuse_args *args)
12+
static ssize_t fuse_send_ioctl(struct fuse_mount *fm, struct fuse_args *args,
13+
struct fuse_ioctl_out *outarg)
1314
{
14-
ssize_t ret = fuse_simple_request(fm, args);
15+
ssize_t ret;
16+
17+
args->out_args[0].size = sizeof(*outarg);
18+
args->out_args[0].value = outarg;
19+
20+
ret = fuse_simple_request(fm, args);
1521

1622
/* Translate ENOSYS, which shouldn't be returned from fs */
1723
if (ret == -ENOSYS)
1824
ret = -ENOTTY;
1925

26+
if (ret >= 0 && outarg->result == -ENOSYS)
27+
outarg->result = -ENOTTY;
28+
2029
return ret;
2130
}
2231

@@ -264,13 +273,11 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,
264273
}
265274

266275
ap.args.out_numargs = 2;
267-
ap.args.out_args[0].size = sizeof(outarg);
268-
ap.args.out_args[0].value = &outarg;
269276
ap.args.out_args[1].size = out_size;
270277
ap.args.out_pages = true;
271278
ap.args.out_argvar = true;
272279

273-
transferred = fuse_send_ioctl(fm, &ap.args);
280+
transferred = fuse_send_ioctl(fm, &ap.args, &outarg);
274281
err = transferred;
275282
if (transferred < 0)
276283
goto out;
@@ -399,12 +406,10 @@ static int fuse_priv_ioctl(struct inode *inode, struct fuse_file *ff,
399406
args.in_args[1].size = inarg.in_size;
400407
args.in_args[1].value = ptr;
401408
args.out_numargs = 2;
402-
args.out_args[0].size = sizeof(outarg);
403-
args.out_args[0].value = &outarg;
404409
args.out_args[1].size = inarg.out_size;
405410
args.out_args[1].value = ptr;
406411

407-
err = fuse_send_ioctl(fm, &args);
412+
err = fuse_send_ioctl(fm, &args, &outarg);
408413
if (!err) {
409414
if (outarg.result < 0)
410415
err = outarg.result;

include/uapi/linux/fuse.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@
206206
* - add extension header
207207
* - add FUSE_EXT_GROUPS
208208
* - add FUSE_CREATE_SUPP_GROUP
209+
* - add FUSE_HAS_EXPIRE_ONLY
209210
*/
210211

211212
#ifndef _LINUX_FUSE_H
@@ -369,6 +370,7 @@ struct fuse_file_lock {
369370
* FUSE_HAS_INODE_DAX: use per inode DAX
370371
* FUSE_CREATE_SUPP_GROUP: add supplementary group info to create, mkdir,
371372
* symlink and mknod (single group that matches parent)
373+
* FUSE_HAS_EXPIRE_ONLY: kernel supports expiry-only entry invalidation
372374
*/
373375
#define FUSE_ASYNC_READ (1 << 0)
374376
#define FUSE_POSIX_LOCKS (1 << 1)
@@ -406,6 +408,7 @@ struct fuse_file_lock {
406408
#define FUSE_SECURITY_CTX (1ULL << 32)
407409
#define FUSE_HAS_INODE_DAX (1ULL << 33)
408410
#define FUSE_CREATE_SUPP_GROUP (1ULL << 34)
411+
#define FUSE_HAS_EXPIRE_ONLY (1ULL << 35)
409412

410413
/**
411414
* CUSE INIT request/reply flags

0 commit comments

Comments
 (0)