Skip to content

Commit ff04172

Browse files
author
Trond Myklebust
committed
NFS: Don't move layouts to plh_return_segs list while in use
If the layout segment is still in use for a read or a write, we should not move it to the layout plh_return_segs list. If we do, we can end up returning the layout while I/O is still in progress. Fixes: e0b7d42 ("pNFS: Don't discard layout segments that are marked for return") Cc: [email protected] # v4.19+ Signed-off-by: Trond Myklebust <[email protected]>
1 parent 54898f7 commit ff04172

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

fs/nfs/pnfs.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2392,16 +2392,6 @@ pnfs_layout_process(struct nfs4_layoutget *lgp)
23922392
return ERR_PTR(-EAGAIN);
23932393
}
23942394

2395-
static int
2396-
mark_lseg_invalid_or_return(struct pnfs_layout_segment *lseg,
2397-
struct list_head *tmp_list)
2398-
{
2399-
if (!mark_lseg_invalid(lseg, tmp_list))
2400-
return 0;
2401-
pnfs_cache_lseg_for_layoutreturn(lseg->pls_layout, lseg);
2402-
return 1;
2403-
}
2404-
24052395
/**
24062396
* pnfs_mark_matching_lsegs_return - Free or return matching layout segments
24072397
* @lo: pointer to layout header
@@ -2438,7 +2428,7 @@ pnfs_mark_matching_lsegs_return(struct pnfs_layout_hdr *lo,
24382428
lseg, lseg->pls_range.iomode,
24392429
lseg->pls_range.offset,
24402430
lseg->pls_range.length);
2441-
if (mark_lseg_invalid_or_return(lseg, tmp_list))
2431+
if (mark_lseg_invalid(lseg, tmp_list))
24422432
continue;
24432433
remaining++;
24442434
set_bit(NFS_LSEG_LAYOUTRETURN, &lseg->pls_flags);

0 commit comments

Comments
 (0)