2016-07-18 14:41:59

by Benjamin Coddington

[permalink] [raw]
Subject: [PATCH] nfs: don't create zero-length requests

NFS doesn't expect requests with wb_bytes set to zero and may make
unexpected decisions about how to handle that request at the page IO layer.
Skip request creation if we won't have any wb_bytes in the request.

Signed-off-by: Benjamin Coddington <[email protected]>
---
fs/nfs/write.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index e1c74d3db64d..649fa5e26050 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1289,6 +1289,9 @@ int nfs_updatepage(struct file *file, struct page *page,
dprintk("NFS: nfs_updatepage(%pD2 %d@%lld)\n",
file, count, (long long)(page_file_offset(page) + offset));

+ if (!count)
+ goto out;
+
if (nfs_can_extend_write(file, page, inode)) {
count = max(count + offset, nfs_page_length(page));
offset = 0;
@@ -1299,7 +1302,7 @@ int nfs_updatepage(struct file *file, struct page *page,
nfs_set_pageerror(page);
else
__set_page_dirty_nobuffers(page);
-
+out:
dprintk("NFS: nfs_updatepage returns %d (isize %lld)\n",
status, (long long)i_size_read(inode));
return status;
--
2.5.5



2016-07-18 17:24:44

by Alexey Dobriyan

[permalink] [raw]
Subject: Re: [PATCH] nfs: don't create zero-length requests

On Mon, Jul 18, 2016 at 10:41:57AM -0400, Benjamin Coddington wrote:
> NFS doesn't expect requests with wb_bytes set to zero and may make
> unexpected decisions about how to handle that request at the page IO layer.
> Skip request creation if we won't have any wb_bytes in the request.
>
> Signed-off-by: Benjamin Coddington <[email protected]>
Signed-off-by: Alexey Dobriyan <[email protected]>

2016-07-18 17:39:47

by Weston Andros Adamson

[permalink] [raw]
Subject: Re: [PATCH] nfs: don't create zero-length requests


> On Jul 18, 2016, at 1:24 PM, Alexey Dobriyan <[email protected]> wrote:
>=20
> On Mon, Jul 18, 2016 at 10:41:57AM -0400, Benjamin Coddington wrote:
>> NFS doesn't expect requests with wb_bytes set to zero and may make
>> unexpected decisions about how to handle that request at the page IO lay=
er.
>> Skip request creation if we won't have any wb_bytes in the request.
>>=20
>> Signed-off-by: Benjamin Coddington <[email protected]>
> Signed-off-by: Alexey Dobriyan <[email protected]>

Reviewed-by: Weston Andros Adamson <[email protected]>

> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html