Skip to content

Commit

Permalink
NFS: Don't discard pNFS layout segments that are marked for return
Browse files Browse the repository at this point in the history
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: e0b7d42 ("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>
  • Loading branch information
Trond Myklebust committed Apr 16, 2021
1 parent 8926cc8 commit 39fd018
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fs/nfs/pnfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2468,13 +2468,18 @@ 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 "
"offset %llu length %llu\n", __func__,
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++;
Expand Down

0 comments on commit 39fd018

Please sign in to comment.