pNFS: Fix pnfs_mark_matching_lsegs_return()
Subsystems (2)
PATCH 1/2 pNFS: Fix pnfs_mark_matching_lsegs_return()
We don't need to schedule a layoutreturn if the layout segment can be freed immediately.
Signed-off-by Trond Myklebust <[email protected]>
--- fs/nfs/pnfs.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
fs/nfs/pnfs.c +13 -2
@@ -1740,6 +1740,16 @@ pnfs_set_plh_return_iomode(struct pnfs_layout_hdr *lo, enum pnfs_iomode iomode) lo->plh_return_iomode = iomode; } +/** +* pnfs_mark_matching_lsegs_return - Free or return matching layout segments +* @lo: pointer to layout header +* @tmp_list: list header to be used with pnfs_free_lseg_list() +* @return_range: describe layout segment ranges to be returned +* +* This function is mainly intended for use by layoutrecall. It attempts +* to free the layout segment immediately, or else to mark it for return +* as soon as its reference count drops to zero. +*/ int pnfs_mark_matching_lsegs_return(struct pnfs_layout_hdr *lo, struct list_head *tmp_list,
@@ -1762,10 +1772,11 @@ pnfs_mark_matching_lsegs_return(struct pnfs_layout_hdr *lo, lseg, lseg->pls_range.iomode, lseg->pls_range.offset, lseg->pls_range.length); +if (mark_lseg_invalid (lseg, tmp_list)) +continue ; + remaining++;set_bit (NFS_LSEG_LAYOUTRETURN , &lseg->pls_flags);pnfs_set_plh_return_iomode (lo, return_range->iomode); -if (!mark_lseg_invalid (lseg, tmp_list)) - remaining++;set_bit (NFS_LAYOUT_RETURN_REQUESTED , &lo->plh_flags); }
Signature · 1 line
2.5.0
PATCH 2/2 pNFS: Always set NFS_LAYOUT_RETURN_REQUESTED with lo->plh_return_iomode
When setting the layout return mode, we must always also set the NFS_LAYOUT_RETURN_REQUESTED flag to ensure that we send a layoutreturn. Otherwise pnfs_error_mark_layout_for_return() could set the mode, but fail to send the layoutreturn because another is already in flight.
Signed-off-by Trond Myklebust <[email protected]>
--- fs/nfs/pnfs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/nfs/pnfs.c +1 -2
@@ -1738,6 +1738,7 @@ pnfs_set_plh_return_iomode(struct pnfs_layout_hdr *lo, enum pnfs_iomode iomode)if (lo->plh_return_iomode !=0 ) iomode =IOMODE_ANY ; lo->plh_return_iomode = iomode; +set_bit (NFS_LAYOUT_RETURN_REQUESTED , &lo->plh_flags); }/**
@@ -1777,8 +1778,6 @@ pnfs_mark_matching_lsegs_return(struct pnfs_layout_hdr *lo, remaining++;set_bit (NFS_LSEG_LAYOUTRETURN , &lseg->pls_flags);pnfs_set_plh_return_iomode (lo, return_range->iomode); -set_bit (NFS_LAYOUT_RETURN_REQUESTED , - &lo->plh_flags); }return remaining; }
Signature · 1 line
2.5.0