This is a note to let you know that I've just added the patch titled NFSv4: Don't discard segments marked for return in _pnfs_return_layout() to the 5.12-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: nfsv4-don-t-discard-segments-marked-for-return-in-_pnfs_return_layout.patch and it can be found in the queue-5.12 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From de144ff4234f935bd2150108019b5d87a90a8a96 Mon Sep 17 00:00:00 2001 From: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx> Date: Sun, 18 Apr 2021 15:00:45 -0400 Subject: NFSv4: Don't discard segments marked for return in _pnfs_return_layout() From: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx> commit de144ff4234f935bd2150108019b5d87a90a8a96 upstream. If the pNFS layout segment is marked with the NFS_LSEG_LAYOUTRETURN flag, then the assumption is that it has some reporting requirement to perform through a layoutreturn (e.g. flexfiles layout stats or error information). Fixes: 6d597e175012 ("pnfs: only tear down lsegs that precede seqid in LAYOUTRETURN args") Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/nfs/pnfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -1344,7 +1344,7 @@ _pnfs_return_layout(struct inode *ino) } valid_layout = pnfs_layout_is_valid(lo); pnfs_clear_layoutcommit(ino, &tmp_list); - pnfs_mark_matching_lsegs_invalid(lo, &tmp_list, NULL, 0); + pnfs_mark_matching_lsegs_return(lo, &tmp_list, NULL, 0); if (NFS_SERVER(ino)->pnfs_curr_ld->return_range) { struct pnfs_layout_range range = { Patches currently in stable-queue which might be from trond.myklebust@xxxxxxxxxxxxxxx are queue-5.12/nfs-don-t-discard-pnfs-layout-segments-that-are-marked-for-return.patch queue-5.12/nfs-fs_context-validate-udp-retrans-to-prevent-shift-out-of-bounds.patch queue-5.12/nfsv4-don-t-discard-segments-marked-for-return-in-_pnfs_return_layout.patch