Skip to content

Commit 7037c15

Browse files
Trond Myklebustvijay-suman
authored andcommitted
NFSv4/pnfs: Reset the layout state after a layoutreturn
[ Upstream commit 6d6d7f91cc8c111d40416ac9240a3bb9396c5235 ] 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 <[email protected]> Signed-off-by: Sasha Levin <[email protected]> (cherry picked from commit 65346f970490e792fe5ae8d931aece60824c4f7e) Signed-off-by: Vijayendra Suman <[email protected]>
1 parent 29191f9 commit 7037c15

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

fs/nfs/pnfs.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,14 @@ pnfs_mark_matching_lsegs_invalid(struct pnfs_layout_hdr *lo,
742742
return remaining;
743743
}
744744

745+
static void pnfs_reset_return_info(struct pnfs_layout_hdr *lo)
746+
{
747+
struct pnfs_layout_segment *lseg;
748+
749+
list_for_each_entry(lseg, &lo->plh_return_segs, pls_list)
750+
pnfs_set_plh_return_info(lo, lseg->pls_range.iomode, 0);
751+
}
752+
745753
static void
746754
pnfs_free_returned_lsegs(struct pnfs_layout_hdr *lo,
747755
struct list_head *free_me,
@@ -1289,6 +1297,7 @@ void pnfs_layoutreturn_free_lsegs(struct pnfs_layout_hdr *lo,
12891297
pnfs_mark_matching_lsegs_invalid(lo, &freeme, range, seq);
12901298
pnfs_free_returned_lsegs(lo, &freeme, range, seq);
12911299
pnfs_set_layout_stateid(lo, stateid, NULL, true);
1300+
pnfs_reset_return_info(lo);
12921301
} else
12931302
pnfs_mark_layout_stateid_invalid(lo, &freeme);
12941303
out_unlock:

0 commit comments

Comments
 (0)