linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] 9p: set page uptodate when required in write_end()
@ 2017-04-10 18:46 alexander.levin
  2017-06-02  2:31 ` Levin, Alexander (Sasha Levin)
  0 siblings, 1 reply; 5+ messages in thread
From: alexander.levin @ 2017-04-10 18:46 UTC (permalink / raw)
  To: ericvh, rminnich, lucho
  Cc: v9fs-developer, linux-kernel, jack, viro, alexander.levin

From: Alexander Levin <alexander.levin@verizon.com>

Commit 77469c3f570 prevented setting the page as uptodate when we wrote the
right amount of data, fix that.

Fixes: 77469c3f570 ("9p: saner ->write_end() on failing copy into non-uptodate page")
Reviewed-by: Jan Kara <jack@suse.com>
Signed-off-by: Alexander Levin <alexander.levin@verizon.com>
---
 fs/9p/vfs_addr.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
index adaf6f6..e1cbdfd 100644
--- a/fs/9p/vfs_addr.c
+++ b/fs/9p/vfs_addr.c
@@ -310,9 +310,13 @@ static int v9fs_write_end(struct file *filp, struct address_space *mapping,
 
 	p9_debug(P9_DEBUG_VFS, "filp %p, mapping %p\n", filp, mapping);
 
-	if (unlikely(copied < len && !PageUptodate(page))) {
-		copied = 0;
-		goto out;
+	if (!PageUptodate(page)) {
+		if (unlikely(copied < len)) {
+			copied = 0;
+			goto out;
+		} else if (len == PAGE_SIZE) {
+			SetPageUptodate(page);
+		}
 	}
 	/*
 	 * No need to use i_size_read() here, the i_size
-- 
2.7.4

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

* Re: [PATCH] 9p: set page uptodate when required in write_end()
  2017-04-10 18:46 [PATCH] 9p: set page uptodate when required in write_end() alexander.levin
@ 2017-06-02  2:31 ` Levin, Alexander (Sasha Levin)
  2017-10-11 12:27   ` Levin, Alexander (Sasha Levin)
  0 siblings, 1 reply; 5+ messages in thread
From: Levin, Alexander (Sasha Levin) @ 2017-06-02  2:31 UTC (permalink / raw)
  To: ericvh, rminnich, lucho; +Cc: v9fs-developer, linux-kernel, jack, viro

Ping?

On Mon, Apr 10, 2017 at 02:46:57PM -0400, Sasha Levin wrote:
> From: Alexander Levin <alexander.levin@verizon.com>
> 
> Commit 77469c3f570 prevented setting the page as uptodate when we wrote the
> right amount of data, fix that.
> 
> Fixes: 77469c3f570 ("9p: saner ->write_end() on failing copy into non-uptodate page")
> Reviewed-by: Jan Kara <jack@suse.com>
> Signed-off-by: Alexander Levin <alexander.levin@verizon.com>
> ---
>  fs/9p/vfs_addr.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
> index adaf6f6..e1cbdfd 100644
> --- a/fs/9p/vfs_addr.c
> +++ b/fs/9p/vfs_addr.c
> @@ -310,9 +310,13 @@ static int v9fs_write_end(struct file *filp, struct address_space *mapping,
>  
>  	p9_debug(P9_DEBUG_VFS, "filp %p, mapping %p\n", filp, mapping);
>  
> -	if (unlikely(copied < len && !PageUptodate(page))) {
> -		copied = 0;
> -		goto out;
> +	if (!PageUptodate(page)) {
> +		if (unlikely(copied < len)) {
> +			copied = 0;
> +			goto out;
> +		} else if (len == PAGE_SIZE) {
> +			SetPageUptodate(page);
> +		}
>  	}
>  	/*
>  	 * No need to use i_size_read() here, the i_size
> -- 
> 2.7.4

-- 

Thanks,
Sasha

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

* Re: [PATCH] 9p: set page uptodate when required in write_end()
  2017-06-02  2:31 ` Levin, Alexander (Sasha Levin)
@ 2017-10-11 12:27   ` Levin, Alexander (Sasha Levin)
  2017-10-11 16:30     ` Linus Torvalds
  2017-10-11 16:46     ` Al Viro
  0 siblings, 2 replies; 5+ messages in thread
From: Levin, Alexander (Sasha Levin) @ 2017-10-11 12:27 UTC (permalink / raw)
  To: ericvh, rminnich, lucho, torvalds
  Cc: v9fs-developer, linux-kernel, jack, viro

Linus, Al,

Can one of you please pick this one directly?

This has been on LKML since April, but the 9p maintainers seem to be MIA?

On Thu, Jun 01, 2017 at 10:31:09PM -0400, Sasha Levin wrote:
>Ping?
>
>On Mon, Apr 10, 2017 at 02:46:57PM -0400, Sasha Levin wrote:
>> From: Alexander Levin <alexander.levin@verizon.com>
>>
>> Commit 77469c3f570 prevented setting the page as uptodate when we wrote the
>> right amount of data, fix that.
>>
>> Fixes: 77469c3f570 ("9p: saner ->write_end() on failing copy into non-uptodate page")
>> Reviewed-by: Jan Kara <jack@suse.com>
>> Signed-off-by: Alexander Levin <alexander.levin@verizon.com>
>> ---
>>  fs/9p/vfs_addr.c | 10 +++++++---
>>  1 file changed, 7 insertions(+), 3 deletions(-)
>>
>> diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
>> index adaf6f6..e1cbdfd 100644
>> --- a/fs/9p/vfs_addr.c
>> +++ b/fs/9p/vfs_addr.c
>> @@ -310,9 +310,13 @@ static int v9fs_write_end(struct file *filp, struct address_space *mapping,
>>
>>  	p9_debug(P9_DEBUG_VFS, "filp %p, mapping %p\n", filp, mapping);
>>
>> -	if (unlikely(copied < len && !PageUptodate(page))) {
>> -		copied = 0;
>> -		goto out;
>> +	if (!PageUptodate(page)) {
>> +		if (unlikely(copied < len)) {
>> +			copied = 0;
>> +			goto out;
>> +		} else if (len == PAGE_SIZE) {
>> +			SetPageUptodate(page);
>> +		}
>>  	}
>>  	/*
>>  	 * No need to use i_size_read() here, the i_size
>> --
>> 2.7.4
>
>-- 
>
>Thanks,
>Sasha

-- 

Thanks,
Sasha

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

* Re: [PATCH] 9p: set page uptodate when required in write_end()
  2017-10-11 12:27   ` Levin, Alexander (Sasha Levin)
@ 2017-10-11 16:30     ` Linus Torvalds
  2017-10-11 16:46     ` Al Viro
  1 sibling, 0 replies; 5+ messages in thread
From: Linus Torvalds @ 2017-10-11 16:30 UTC (permalink / raw)
  To: Levin, Alexander (Sasha Levin)
  Cc: ericvh, rminnich, lucho, v9fs-developer, linux-kernel, jack, viro

On Wed, Oct 11, 2017 at 5:27 AM, Levin, Alexander (Sasha Levin)
<alexander.levin@verizon.com> wrote:
>
> Can one of you please pick this one directly?
>
> This has been on LKML since April, but the 9p maintainers seem to be MIA?

Applied.

Thanks,

                      Linus

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

* Re: [PATCH] 9p: set page uptodate when required in write_end()
  2017-10-11 12:27   ` Levin, Alexander (Sasha Levin)
  2017-10-11 16:30     ` Linus Torvalds
@ 2017-10-11 16:46     ` Al Viro
  1 sibling, 0 replies; 5+ messages in thread
From: Al Viro @ 2017-10-11 16:46 UTC (permalink / raw)
  To: Levin, Alexander (Sasha Levin)
  Cc: ericvh, rminnich, lucho, torvalds, v9fs-developer, linux-kernel, jack

On Wed, Oct 11, 2017 at 12:27:43PM +0000, Levin, Alexander (Sasha Levin) wrote:
> >> diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
> >> index adaf6f6..e1cbdfd 100644
> >> --- a/fs/9p/vfs_addr.c
> >> +++ b/fs/9p/vfs_addr.c
> >> @@ -310,9 +310,13 @@ static int v9fs_write_end(struct file *filp, struct address_space *mapping,
> >>
> >>  	p9_debug(P9_DEBUG_VFS, "filp %p, mapping %p\n", filp, mapping);
> >>
> >> -	if (unlikely(copied < len && !PageUptodate(page))) {
> >> -		copied = 0;
> >> -		goto out;
> >> +	if (!PageUptodate(page)) {
> >> +		if (unlikely(copied < len)) {
> >> +			copied = 0;
> >> +			goto out;
> >> +		} else if (len == PAGE_SIZE) {
> >> +			SetPageUptodate(page);
> >> +		}

Umm...  I'm not sure I like it in that form.  Look: to get here
we need to successfully pass through ->write_begin().  Which
means that we either have returned with PageUptodate(page) or
had hit len == PAGE_SIZE && !PageUptodate(page).  Case of
non-uptodate with len < PAGE_SIZE is handled by forcing readpage
and repeating the entire thing.

So the only way to get !PageUptodate(page) in ->write_end() is
to have had len == PAGE_SIZE.  It needs a comment, at the very
least.

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

end of thread, other threads:[~2017-10-11 16:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-10 18:46 [PATCH] 9p: set page uptodate when required in write_end() alexander.levin
2017-06-02  2:31 ` Levin, Alexander (Sasha Levin)
2017-10-11 12:27   ` Levin, Alexander (Sasha Levin)
2017-10-11 16:30     ` Linus Torvalds
2017-10-11 16:46     ` Al Viro

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