NFSv4.1/pNFS: Add a helper to mark the layout as returned

This ensures that we don't reuse the stateid if a layout return or
implied layout return means that we've returned all layout segments

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
This commit is contained in:
Trond Myklebust
2015-12-28 11:48:14 -05:00
parent ab7d763e47
commit 0654cc726f
4 changed files with 17 additions and 1 deletions

View File

@@ -556,6 +556,19 @@ pnfs_calc_offset_length(u64 offset, u64 end)
return 1 + end - offset;
}
/**
* pnfs_mark_layout_returned_if_empty - marks the layout as returned
* @lo: layout header
*
* Note: Caller must hold inode->i_lock
*/
static inline void
pnfs_mark_layout_returned_if_empty(struct pnfs_layout_hdr *lo)
{
if (list_empty(&lo->plh_segs))
set_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags);
}
extern unsigned int layoutstats_timer;
#ifdef NFS_DEBUG