]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
NFS: Don't discard pNFS layout segments that are marked for return
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Thu, 15 Apr 2021 19:41:57 +0000 (15:41 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 May 2021 12:04:14 +0000 (14:04 +0200)
commit 39fd01863616964f009599e50ca5c6ea9ebf88d6 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: e0b7d420f72a ("pNFS: Don't discard layout segments that are marked for return")
Cc: stable@vger.kernel.org
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfs/pnfs.c

index e3a79e6958124ef3bac7bda573324dfcc1e3aaa6..bc913f2e2aa3e742da02dff21723c75f2c6056d6 100644 (file)
@@ -2427,6 +2427,9 @@ pnfs_mark_matching_lsegs_return(struct pnfs_layout_hdr *lo,
 
        assert_spin_locked(&lo->plh_inode->i_lock);
 
+       if (test_bit(NFS_LAYOUT_RETURN_REQUESTED, &lo->plh_flags))
+               tmp_list = &lo->plh_return_segs;
+
        list_for_each_entry_safe(lseg, next, &lo->plh_segs, pls_list)
                if (pnfs_match_lseg_recall(lseg, return_range, seq)) {
                        dprintk("%s: marking lseg %p iomode %d "
@@ -2434,6 +2437,8 @@ pnfs_mark_matching_lsegs_return(struct pnfs_layout_hdr *lo,
                                lseg, lseg->pls_range.iomode,
                                lseg->pls_range.offset,
                                lseg->pls_range.length);
+                       if (test_bit(NFS_LSEG_LAYOUTRETURN, &lseg->pls_flags))
+                               tmp_list = &lo->plh_return_segs;
                        if (mark_lseg_invalid(lseg, tmp_list))
                                continue;
                        remaining++;