aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse/file.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2008-04-30 03:54:44 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-30 11:29:51 -0400
commite5d9a0df07484d6d191756878c974e4307fb24ce (patch)
treeb3117ed75242e523dd7c2ff9fc0878b78c7fcb0c /fs/fuse/file.c
parent5c5c5e51b26413d50a9efae2ca7d6c5c6cd453ac (diff)
fuse: fix max i/o size calculation
Fix a bug that Werner Baumann reported: fuse can send a bigger write request than the maximum specified. This only affected direct_io operation. In addition set a sane minimum for the max_read and max_write tunables, so I/O always makes some progress. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/fuse/file.c')
-rw-r--r--fs/fuse/file.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index a02418c89d4b..2d3649e42599 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -966,14 +966,15 @@ static ssize_t fuse_direct_io(struct file *file, const char __user *buf,
966 966
967 while (count) { 967 while (count) {
968 size_t nres; 968 size_t nres;
969 size_t nbytes = min(count, nmax); 969 size_t nbytes_limit = min(count, nmax);
970 int err = fuse_get_user_pages(req, buf, nbytes, !write); 970 size_t nbytes;
971 int err = fuse_get_user_pages(req, buf, nbytes_limit, !write);
971 if (err) { 972 if (err) {
972 res = err; 973 res = err;
973 break; 974 break;
974 } 975 }
975 nbytes = (req->num_pages << PAGE_SHIFT) - req->page_offset; 976 nbytes = (req->num_pages << PAGE_SHIFT) - req->page_offset;
976 nbytes = min(count, nbytes); 977 nbytes = min(nbytes_limit, nbytes);
977 if (write) 978 if (write)
978 nres = fuse_send_write(req, file, inode, pos, nbytes, 979 nres = fuse_send_write(req, file, inode, pos, nbytes,
979 current->files); 980 current->files);