aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/fuse/cuse.c7
-rw-r--r--fs/fuse/file.c23
-rw-r--r--fs/fuse/fuse_i.h5
3 files changed, 16 insertions, 19 deletions
diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c
index fb9dcfdf040b..6f96a8def147 100644
--- a/fs/fuse/cuse.c
+++ b/fs/fuse/cuse.c
@@ -91,19 +91,22 @@ static ssize_t cuse_read(struct file *file, char __user *buf, size_t count,
91 loff_t *ppos) 91 loff_t *ppos)
92{ 92{
93 loff_t pos = 0; 93 loff_t pos = 0;
94 struct iovec iov = { .iov_base = buf, .iov_len = count };
94 95
95 return fuse_direct_io(file, buf, count, &pos, 0); 96 return fuse_direct_io(file, &iov, 1, count, &pos, 0);
96} 97}
97 98
98static ssize_t cuse_write(struct file *file, const char __user *buf, 99static ssize_t cuse_write(struct file *file, const char __user *buf,
99 size_t count, loff_t *ppos) 100 size_t count, loff_t *ppos)
100{ 101{
101 loff_t pos = 0; 102 loff_t pos = 0;
103 struct iovec iov = { .iov_base = (void __user *)buf, .iov_len = count };
104
102 /* 105 /*
103 * No locking or generic_write_checks(), the server is 106 * No locking or generic_write_checks(), the server is
104 * responsible for locking and sanity checks. 107 * responsible for locking and sanity checks.
105 */ 108 */
106 return fuse_direct_io(file, buf, count, &pos, 1); 109 return fuse_direct_io(file, &iov, 1, count, &pos, 1);
107} 110}
108 111
109static int cuse_open(struct inode *inode, struct file *file) 112static int cuse_open(struct inode *inode, struct file *file)
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 68e10d43bd3f..28bc9c672196 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1148,9 +1148,9 @@ static inline int fuse_iter_npages(const struct iov_iter *ii_p)
1148 return min(npages, FUSE_MAX_PAGES_PER_REQ); 1148 return min(npages, FUSE_MAX_PAGES_PER_REQ);
1149} 1149}
1150 1150
1151static ssize_t __fuse_direct_io(struct file *file, const struct iovec *iov, 1151ssize_t fuse_direct_io(struct file *file, const struct iovec *iov,
1152 unsigned long nr_segs, size_t count, 1152 unsigned long nr_segs, size_t count, loff_t *ppos,
1153 loff_t *ppos, int write) 1153 int write)
1154{ 1154{
1155 struct fuse_file *ff = file->private_data; 1155 struct fuse_file *ff = file->private_data;
1156 struct fuse_conn *fc = ff->fc; 1156 struct fuse_conn *fc = ff->fc;
@@ -1209,13 +1209,6 @@ static ssize_t __fuse_direct_io(struct file *file, const struct iovec *iov,
1209 1209
1210 return res; 1210 return res;
1211} 1211}
1212
1213ssize_t fuse_direct_io(struct file *file, const char __user *buf,
1214 size_t count, loff_t *ppos, int write)
1215{
1216 struct iovec iov = { .iov_base = (void *)buf, .iov_len = count };
1217 return __fuse_direct_io(file, &iov, 1, count, ppos, write);
1218}
1219EXPORT_SYMBOL_GPL(fuse_direct_io); 1212EXPORT_SYMBOL_GPL(fuse_direct_io);
1220 1213
1221static ssize_t __fuse_direct_read(struct file *file, const struct iovec *iov, 1214static ssize_t __fuse_direct_read(struct file *file, const struct iovec *iov,
@@ -1227,8 +1220,8 @@ static ssize_t __fuse_direct_read(struct file *file, const struct iovec *iov,
1227 if (is_bad_inode(inode)) 1220 if (is_bad_inode(inode))
1228 return -EIO; 1221 return -EIO;
1229 1222
1230 res = __fuse_direct_io(file, iov, nr_segs, iov_length(iov, nr_segs), 1223 res = fuse_direct_io(file, iov, nr_segs, iov_length(iov, nr_segs),
1231 ppos, 0); 1224 ppos, 0);
1232 1225
1233 fuse_invalidate_attr(inode); 1226 fuse_invalidate_attr(inode);
1234 1227
@@ -1238,7 +1231,7 @@ static ssize_t __fuse_direct_read(struct file *file, const struct iovec *iov,
1238static ssize_t fuse_direct_read(struct file *file, char __user *buf, 1231static ssize_t fuse_direct_read(struct file *file, char __user *buf,
1239 size_t count, loff_t *ppos) 1232 size_t count, loff_t *ppos)
1240{ 1233{
1241 struct iovec iov = { .iov_base = (void *)buf, .iov_len = count }; 1234 struct iovec iov = { .iov_base = buf, .iov_len = count };
1242 return __fuse_direct_read(file, &iov, 1, ppos); 1235 return __fuse_direct_read(file, &iov, 1, ppos);
1243} 1236}
1244 1237
@@ -1251,7 +1244,7 @@ static ssize_t __fuse_direct_write(struct file *file, const struct iovec *iov,
1251 1244
1252 res = generic_write_checks(file, ppos, &count, 0); 1245 res = generic_write_checks(file, ppos, &count, 0);
1253 if (!res) { 1246 if (!res) {
1254 res = __fuse_direct_io(file, iov, nr_segs, count, ppos, 1); 1247 res = fuse_direct_io(file, iov, nr_segs, count, ppos, 1);
1255 if (res > 0) 1248 if (res > 0)
1256 fuse_write_update_size(inode, *ppos); 1249 fuse_write_update_size(inode, *ppos);
1257 } 1250 }
@@ -1264,7 +1257,7 @@ static ssize_t __fuse_direct_write(struct file *file, const struct iovec *iov,
1264static ssize_t fuse_direct_write(struct file *file, const char __user *buf, 1257static ssize_t fuse_direct_write(struct file *file, const char __user *buf,
1265 size_t count, loff_t *ppos) 1258 size_t count, loff_t *ppos)
1266{ 1259{
1267 struct iovec iov = { .iov_base = (void *)buf, .iov_len = count }; 1260 struct iovec iov = { .iov_base = (void __user *)buf, .iov_len = count };
1268 struct inode *inode = file->f_path.dentry->d_inode; 1261 struct inode *inode = file->f_path.dentry->d_inode;
1269 ssize_t res; 1262 ssize_t res;
1270 1263
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 70cef60afe0e..13befcd29c5b 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -811,8 +811,9 @@ int fuse_reverse_inval_entry(struct super_block *sb, u64 parent_nodeid,
811 811
812int fuse_do_open(struct fuse_conn *fc, u64 nodeid, struct file *file, 812int fuse_do_open(struct fuse_conn *fc, u64 nodeid, struct file *file,
813 bool isdir); 813 bool isdir);
814ssize_t fuse_direct_io(struct file *file, const char __user *buf, 814ssize_t fuse_direct_io(struct file *file, const struct iovec *iov,
815 size_t count, loff_t *ppos, int write); 815 unsigned long nr_segs, size_t count, loff_t *ppos,
816 int write);
816long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg, 817long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg,
817 unsigned int flags); 818 unsigned int flags);
818long fuse_ioctl_common(struct file *file, unsigned int cmd, 819long fuse_ioctl_common(struct file *file, unsigned int cmd,