Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752636AbcDSW6M (ORCPT ); Tue, 19 Apr 2016 18:58:12 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:26887 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752067AbcDSW6K (ORCPT ); Tue, 19 Apr 2016 18:58:10 -0400 Reply-To: ashish.samant@oracle.com Subject: Re: [fuse-devel] [PATCH] fuse: Fix fuse_get_user_pages() return value References: <1461105785-83223-1-git-send-email-seth.forshee@canonical.com> To: Seth Forshee , Miklos Szeredi Cc: fuse-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org From: Ashish Samant Message-ID: <5716B7F0.8000304@oracle.com> Date: Tue, 19 Apr 2016 15:57:52 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <1461105785-83223-1-git-send-email-seth.forshee@canonical.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1318 Lines: 40 Hi Seth, On 04/19/2016 03:43 PM, Seth Forshee wrote: > 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 > --- > 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) I have already sent a patch to the list that does exactly the same thing :) https://sourceforge.net/p/fuse/mailman/message/34966327/ Thanks, Ashish