aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse/dev.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/fuse/dev.c')
-rw-r--r--fs/fuse/dev.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index b72361479be2..85a23bb524f7 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -1,6 +1,6 @@
1/* 1/*
2 FUSE: Filesystem in Userspace 2 FUSE: Filesystem in Userspace
3 Copyright (C) 2001-2006 Miklos Szeredi <miklos@szeredi.hu> 3 Copyright (C) 2001-2008 Miklos Szeredi <miklos@szeredi.hu>
4 4
5 This program can be distributed under the terms of the GNU GPL. 5 This program can be distributed under the terms of the GNU GPL.
6 See the file COPYING. 6 See the file COPYING.
@@ -539,8 +539,8 @@ static int fuse_copy_fill(struct fuse_copy_state *cs)
539 BUG_ON(!cs->nr_segs); 539 BUG_ON(!cs->nr_segs);
540 cs->seglen = cs->iov[0].iov_len; 540 cs->seglen = cs->iov[0].iov_len;
541 cs->addr = (unsigned long) cs->iov[0].iov_base; 541 cs->addr = (unsigned long) cs->iov[0].iov_base;
542 cs->iov ++; 542 cs->iov++;
543 cs->nr_segs --; 543 cs->nr_segs--;
544 } 544 }
545 down_read(&current->mm->mmap_sem); 545 down_read(&current->mm->mmap_sem);
546 err = get_user_pages(current, current->mm, cs->addr, 1, cs->write, 0, 546 err = get_user_pages(current, current->mm, cs->addr, 1, cs->write, 0,
@@ -589,9 +589,11 @@ static int fuse_copy_page(struct fuse_copy_state *cs, struct page *page,
589 kunmap_atomic(mapaddr, KM_USER1); 589 kunmap_atomic(mapaddr, KM_USER1);
590 } 590 }
591 while (count) { 591 while (count) {
592 int err; 592 if (!cs->len) {
593 if (!cs->len && (err = fuse_copy_fill(cs))) 593 int err = fuse_copy_fill(cs);
594 return err; 594 if (err)
595 return err;
596 }
595 if (page) { 597 if (page) {
596 void *mapaddr = kmap_atomic(page, KM_USER1); 598 void *mapaddr = kmap_atomic(page, KM_USER1);
597 void *buf = mapaddr + offset; 599 void *buf = mapaddr + offset;
@@ -631,9 +633,11 @@ static int fuse_copy_pages(struct fuse_copy_state *cs, unsigned nbytes,
631static int fuse_copy_one(struct fuse_copy_state *cs, void *val, unsigned size) 633static int fuse_copy_one(struct fuse_copy_state *cs, void *val, unsigned size)
632{ 634{
633 while (size) { 635 while (size) {
634 int err; 636 if (!cs->len) {
635 if (!cs->len && (err = fuse_copy_fill(cs))) 637 int err = fuse_copy_fill(cs);
636 return err; 638 if (err)
639 return err;
640 }
637 fuse_copy_do(cs, &val, &size); 641 fuse_copy_do(cs, &val, &size);
638 } 642 }
639 return 0; 643 return 0;