Skip to content

Commit 92f90cc

Browse files
committed
Merge tag 'fuse-fixes-5.17-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse
Pull fuse fixes from Miklos Szeredi: - Fix an issue with splice on the fuse device - Fix a regression in the fileattr API conversion - Add a small userspace API improvement * tag 'fuse-fixes-5.17-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse: fuse: fix pipe buffer lifetime for direct_io fuse: move FUSE_SUPER_MAGIC definition to magic.h fuse: fix fileattr op failure
2 parents cd22a8b + 0c4bcfd commit 92f90cc

File tree

6 files changed

+21
-6
lines changed

6 files changed

+21
-6
lines changed

fs/fuse/dev.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,17 @@ static int fuse_copy_page(struct fuse_copy_state *cs, struct page **pagep,
941941

942942
while (count) {
943943
if (cs->write && cs->pipebufs && page) {
944-
return fuse_ref_page(cs, page, offset, count);
944+
/*
945+
* Can't control lifetime of pipe buffers, so always
946+
* copy user pages.
947+
*/
948+
if (cs->req->args->user_pages) {
949+
err = fuse_copy_fill(cs);
950+
if (err)
951+
return err;
952+
} else {
953+
return fuse_ref_page(cs, page, offset, count);
954+
}
945955
} else if (!cs->len) {
946956
if (cs->move_pages && page &&
947957
offset == 0 && count == PAGE_SIZE) {

fs/fuse/file.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,6 +1413,7 @@ static int fuse_get_user_pages(struct fuse_args_pages *ap, struct iov_iter *ii,
14131413
(PAGE_SIZE - ret) & (PAGE_SIZE - 1);
14141414
}
14151415

1416+
ap->args.user_pages = true;
14161417
if (write)
14171418
ap->args.in_pages = true;
14181419
else

fs/fuse/fuse_i.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ struct fuse_args {
256256
bool nocreds:1;
257257
bool in_pages:1;
258258
bool out_pages:1;
259+
bool user_pages:1;
259260
bool out_argvar:1;
260261
bool page_zeroing:1;
261262
bool page_replace:1;

fs/fuse/inode.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/exportfs.h>
2424
#include <linux/posix_acl.h>
2525
#include <linux/pid_namespace.h>
26+
#include <uapi/linux/magic.h>
2627

2728
MODULE_AUTHOR("Miklos Szeredi <[email protected]>");
2829
MODULE_DESCRIPTION("Filesystem in Userspace");
@@ -50,8 +51,6 @@ MODULE_PARM_DESC(max_user_congthresh,
5051
"Global limit for the maximum congestion threshold an "
5152
"unprivileged user can set");
5253

53-
#define FUSE_SUPER_MAGIC 0x65735546
54-
5554
#define FUSE_DEFAULT_BLKSIZE 512
5655

5756
/** Maximum number of outstanding background requests */

fs/fuse/ioctl.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -394,9 +394,12 @@ static int fuse_priv_ioctl(struct inode *inode, struct fuse_file *ff,
394394
args.out_args[1].value = ptr;
395395

396396
err = fuse_simple_request(fm, &args);
397-
if (!err && outarg.flags & FUSE_IOCTL_RETRY)
398-
err = -EIO;
399-
397+
if (!err) {
398+
if (outarg.result < 0)
399+
err = outarg.result;
400+
else if (outarg.flags & FUSE_IOCTL_RETRY)
401+
err = -EIO;
402+
}
400403
return err;
401404
}
402405

include/uapi/linux/magic.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#define EFIVARFS_MAGIC 0xde5e81e4
3737
#define HOSTFS_SUPER_MAGIC 0x00c0ffee
3838
#define OVERLAYFS_SUPER_MAGIC 0x794c7630
39+
#define FUSE_SUPER_MAGIC 0x65735546
3940

4041
#define MINIX_SUPER_MAGIC 0x137F /* minix v1 fs, 14 char names */
4142
#define MINIX_SUPER_MAGIC2 0x138F /* minix v1 fs, 30 char names */

0 commit comments

Comments
 (0)