* [PATCH] 9p: fix enodata when reading growing file
@ 2022-01-10 11:14 Dominique Martinet
2022-01-10 11:18 ` David Howells
2022-01-10 11:22 ` David Howells
0 siblings, 2 replies; 3+ messages in thread
From: Dominique Martinet @ 2022-01-10 11:14 UTC (permalink / raw)
To: dhowells, v9fs-developer
Cc: linux-kernel, lucho, ericvh, Dominique Martinet, stable
Reading from a file that was just extended by a write, but the write had
not yet reached the server would return ENODATA as illustrated by this
command:
$ xfs_io -c 'open -ft test' -c 'w 4096 1000' -c 'r 0 1000'
wrote 1000/1000 bytes at offset 4096
1000.000000 bytes, 1 ops; 0.0001 sec (5.610 MiB/sec and 5882.3529 ops/sec)
pread: No data available
Fix this case by having netfs assume zeroes when reads from server come
short like AFS and CEPH do
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
Co-authored-by: David Howells <dhowells@redhat.com>
Cc: stable@vger.kernel.org
---
fs/9p/vfs_addr.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
index c72e9f8f5f32..9a10e68c5f30 100644
--- a/fs/9p/vfs_addr.c
+++ b/fs/9p/vfs_addr.c
@@ -43,6 +43,11 @@ static void v9fs_req_issue_op(struct netfs_read_subrequest *subreq)
iov_iter_xarray(&to, READ, &rreq->mapping->i_pages, pos, len);
total = p9_client_read(fid, pos, &to, &err);
+
+ /* if we just extended the file size, any portion not in
+ * cache won't be on server and is zeroes */
+ __set_bit(NETFS_SREQ_CLEAR_TAIL, &subreq->flags);
+
netfs_subreq_terminated(subreq, err ?: total, false);
}
--
2.33.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] 9p: fix enodata when reading growing file
2022-01-10 11:14 [PATCH] 9p: fix enodata when reading growing file Dominique Martinet
@ 2022-01-10 11:18 ` David Howells
2022-01-10 11:22 ` David Howells
1 sibling, 0 replies; 3+ messages in thread
From: David Howells @ 2022-01-10 11:18 UTC (permalink / raw)
To: Dominique Martinet
Cc: dhowells, v9fs-developer, linux-kernel, lucho, ericvh, stable
Dominique Martinet <asmadeus@codewreck.org> wrote:
> Reading from a file that was just extended by a write, but the write had
> not yet reached the server would return ENODATA as illustrated by this
> command:
> $ xfs_io -c 'open -ft test' -c 'w 4096 1000' -c 'r 0 1000'
> wrote 1000/1000 bytes at offset 4096
> 1000.000000 bytes, 1 ops; 0.0001 sec (5.610 MiB/sec and 5882.3529 ops/sec)
> pread: No data available
>
> Fix this case by having netfs assume zeroes when reads from server come
> short like AFS and CEPH do
>
> Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
> Co-authored-by: David Howells <dhowells@redhat.com>
> Cc: stable@vger.kernel.org
I think you want this also:
Fixes: eb497943fa21 ("9p: Convert to using the netfs helper lib to do reads and caching")
Reviewed-by: David Howells <dhowells@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] 9p: fix enodata when reading growing file
2022-01-10 11:14 [PATCH] 9p: fix enodata when reading growing file Dominique Martinet
2022-01-10 11:18 ` David Howells
@ 2022-01-10 11:22 ` David Howells
1 sibling, 0 replies; 3+ messages in thread
From: David Howells @ 2022-01-10 11:22 UTC (permalink / raw)
To: Dominique Martinet
Cc: dhowells, v9fs-developer, linux-kernel, lucho, ericvh, stable
David Howells <dhowells@redhat.com> wrote:
> Reviewed-by: David Howells <dhowells@redhat.com>
Make that:
Reviewed-and-tested-by: David Howells <dhowells@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-10 11:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-10 11:14 [PATCH] 9p: fix enodata when reading growing file Dominique Martinet
2022-01-10 11:18 ` David Howells
2022-01-10 11:22 ` David Howells
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).