This is a note to let you know that I've just added the patch titled 9p: fix enodata when reading growing file to the 5.16-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: 9p-fix-enodata-when-reading-growing-file.patch and it can be found in the queue-5.16 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 19d1c32652bbbf406063025354845fdddbcecd3a Mon Sep 17 00:00:00 2001 From: Dominique Martinet <asmadeus@xxxxxxxxxxxxx> Date: Mon, 10 Jan 2022 20:10:31 +0900 Subject: 9p: fix enodata when reading growing file From: Dominique Martinet <asmadeus@xxxxxxxxxxxxx> commit 19d1c32652bbbf406063025354845fdddbcecd3a upstream. 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 Link: https://lkml.kernel.org/r/20220110111444.926753-1-asmadeus@xxxxxxxxxxxxx Cc: stable@xxxxxxxxxxxxxxx Fixes: eb497943fa21 ("9p: Convert to using the netfs helper lib to do reads and caching") Co-authored-by: David Howells <dhowells@xxxxxxxxxx> Reviewed-by: David Howells <dhowells@xxxxxxxxxx> Tested-by: David Howells <dhowells@xxxxxxxxxx> Signed-off-by: Dominique Martinet <asmadeus@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/9p/vfs_addr.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/fs/9p/vfs_addr.c +++ b/fs/9p/vfs_addr.c @@ -42,6 +42,11 @@ static void v9fs_req_issue_op(struct net 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); } Patches currently in stable-queue which might be from asmadeus@xxxxxxxxxxxxx are queue-5.16/9p-fix-enodata-when-reading-growing-file.patch queue-5.16/9p-only-copy-valid-iattrs-in-9p2000.l-setattr-implementation.patch