Skip to content

Commit

Permalink
NFSv4/pnfs: Reset the layout state after a layoutreturn
Browse files Browse the repository at this point in the history
[ Upstream commit 6d6d7f9 ]

If there are still layout segments in the layout plh_return_lsegs list
after a layout return, we should be resetting the state to ensure they
eventually get returned as well.

Fixes: 68f7447 ("pNFS: Do not free layout segments that are marked for return")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Trond Myklebust authored and Greg Kroah-Hartman committed May 22, 2025
1 parent 8f7f965 commit 8f2eb3a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions fs/nfs/pnfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,14 @@ pnfs_mark_matching_lsegs_invalid(struct pnfs_layout_hdr *lo,
return remaining;
}

static void pnfs_reset_return_info(struct pnfs_layout_hdr *lo)
{
struct pnfs_layout_segment *lseg;

list_for_each_entry(lseg, &lo->plh_return_segs, pls_list)
pnfs_set_plh_return_info(lo, lseg->pls_range.iomode, 0);
}

static void
pnfs_free_returned_lsegs(struct pnfs_layout_hdr *lo,
struct list_head *free_me,
Expand Down Expand Up @@ -1180,6 +1188,7 @@ void pnfs_layoutreturn_free_lsegs(struct pnfs_layout_hdr *lo,
pnfs_mark_matching_lsegs_invalid(lo, &freeme, range, seq);
pnfs_free_returned_lsegs(lo, &freeme, range, seq);
pnfs_set_layout_stateid(lo, stateid, NULL, true);
pnfs_reset_return_info(lo);
} else
pnfs_mark_layout_stateid_invalid(lo, &freeme);
out_unlock:
Expand Down

0 comments on commit 8f2eb3a

Please sign in to comment.