linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fuse: Fix fuse_get_user_pages() return value
@ 2016-04-19 22:43 Seth Forshee
  2016-04-19 22:57 ` [fuse-devel] " Ashish Samant
  0 siblings, 1 reply; 4+ messages in thread
From: Seth Forshee @ 2016-04-19 22:43 UTC (permalink / raw)
  To: Miklos Szeredi; +Cc: Seth Forshee, fuse-devel, linux-kernel

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [fuse-devel] [PATCH] fuse: Fix fuse_get_user_pages() return value
  2016-04-19 22:43 [PATCH] fuse: Fix fuse_get_user_pages() return value Seth Forshee
@ 2016-04-19 22:57 ` Ashish Samant
  2016-04-20 15:43   ` Seth Forshee
  0 siblings, 1 reply; 4+ messages in thread
From: Ashish Samant @ 2016-04-19 22:57 UTC (permalink / raw)
  To: Seth Forshee, Miklos Szeredi; +Cc: fuse-devel, linux-kernel

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 <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)


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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [fuse-devel] [PATCH] fuse: Fix fuse_get_user_pages() return value
  2016-04-19 22:57 ` [fuse-devel] " Ashish Samant
@ 2016-04-20 15:43   ` Seth Forshee
  2016-04-25 11:03     ` Miklos Szeredi
  0 siblings, 1 reply; 4+ messages in thread
From: Seth Forshee @ 2016-04-20 15:43 UTC (permalink / raw)
  To: Ashish Samant; +Cc: Miklos Szeredi, fuse-devel, linux-kernel

On Tue, Apr 19, 2016 at 03:57:52PM -0700, Ashish Samant wrote:
> 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 <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)
> 
> 
> I have already sent a patch to the list that does exactly the same thing :)
> 
> https://sourceforge.net/p/fuse/mailman/message/34966327/

Oops, should have checked the list first I guess :-)

But that's from several weeks ago, and it's still not applied? This is
causing big problems for lxcfs on 4.6-rc kernels, so it's definitely a
regression and needs to get fixed.

Thanks,
Seth

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [fuse-devel] [PATCH] fuse: Fix fuse_get_user_pages() return value
  2016-04-20 15:43   ` Seth Forshee
@ 2016-04-25 11:03     ` Miklos Szeredi
  0 siblings, 0 replies; 4+ messages in thread
From: Miklos Szeredi @ 2016-04-25 11:03 UTC (permalink / raw)
  To: Seth Forshee; +Cc: Ashish Samant, fuse-devel, Kernel Mailing List

On Wed, Apr 20, 2016 at 5:43 PM, Seth Forshee
<seth.forshee@canonical.com> wrote:
> On Tue, Apr 19, 2016 at 03:57:52PM -0700, Ashish Samant wrote:
>> 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 <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)
>>
>>
>> I have already sent a patch to the list that does exactly the same thing :)
>>
>> https://sourceforge.net/p/fuse/mailman/message/34966327/
>
> Oops, should have checked the list first I guess :-)
>
> But that's from several weeks ago, and it's still not applied? This is
> causing big problems for lxcfs on 4.6-rc kernels, so it's definitely a
> regression and needs to get fixed.

Applied, thanks.

Miklos

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-04-25 11:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-19 22:43 [PATCH] fuse: Fix fuse_get_user_pages() return value Seth Forshee
2016-04-19 22:57 ` [fuse-devel] " Ashish Samant
2016-04-20 15:43   ` Seth Forshee
2016-04-25 11:03     ` Miklos Szeredi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).