lkml.org 
[lkml]   [2016]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] fuse: Fix fuse_get_user_pages() return value
Date
fuse_direct_io() expects this to return either 0 or a negative
error code, but on success it may return a positive value.
fuse_direct_io() may return this same value when the subsequent
I/O operation doesn't transfer any data, which means that it will
return a positive value when no bytes were transferred. This is
obviously problematic.

Fix fuse_get_user_pages() to return 0 on success. This will in
turn make it so that fuse_direct_io() returns 0 if no bytes are
transferred.

Fixes: 742f992708df ("fuse: return patrial success from fuse_direct_io()")
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
---
fs/fuse/file.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index b5c616c5ec98..78af5c0996b8 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1295,7 +1295,7 @@ static int fuse_get_user_pages(struct fuse_req *req, struct iov_iter *ii,

*nbytesp = nbytes;

- return ret;
+ return ret < 0 ? ret : 0;
}

static inline int fuse_iter_npages(const struct iov_iter *ii_p)
--
1.9.1
\
 
 \ /
  Last update: 2016-04-20 01:01    [W:0.041 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site