diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-12-28 11:48:14 -0500 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-12-28 14:33:04 -0500 |
commit | 0654cc726fc6eed6dca915fb65ba7975716ea080 (patch) | |
tree | 367e0058259d17d89ffec6d02ea333aa4bb5485f /fs/nfs | |
parent | ab7d763e477c5be33ac9cffc68e808bbd69371f7 (diff) |
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>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/callback_proc.c | 1 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 3 | ||||
-rw-r--r-- | fs/nfs/pnfs.c | 1 | ||||
-rw-r--r-- | fs/nfs/pnfs.h | 13 |
4 files changed, 17 insertions, 1 deletions
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c index 807eb6ef4f91..716cbff24450 100644 --- a/fs/nfs/callback_proc.c +++ b/fs/nfs/callback_proc.c | |||
@@ -192,6 +192,7 @@ static u32 initiate_file_draining(struct nfs_client *clp, | |||
192 | NFS_SERVER(ino)->pnfs_curr_ld->return_range(lo, | 192 | NFS_SERVER(ino)->pnfs_curr_ld->return_range(lo, |
193 | &args->cbl_range); | 193 | &args->cbl_range); |
194 | } | 194 | } |
195 | pnfs_mark_layout_returned_if_empty(lo); | ||
195 | unlock: | 196 | unlock: |
196 | spin_unlock(&ino->i_lock); | 197 | spin_unlock(&ino->i_lock); |
197 | pnfs_free_lseg_list(&free_me_list); | 198 | pnfs_free_lseg_list(&free_me_list); |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index fcd7a9039020..883da29b9ace 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -8049,9 +8049,10 @@ static void nfs4_layoutreturn_release(void *calldata) | |||
8049 | 8049 | ||
8050 | dprintk("--> %s\n", __func__); | 8050 | dprintk("--> %s\n", __func__); |
8051 | spin_lock(&lo->plh_inode->i_lock); | 8051 | spin_lock(&lo->plh_inode->i_lock); |
8052 | pnfs_mark_matching_lsegs_invalid(lo, &freeme, &lrp->args.range); | ||
8053 | pnfs_mark_layout_returned_if_empty(lo); | ||
8052 | if (lrp->res.lrs_present) | 8054 | if (lrp->res.lrs_present) |
8053 | pnfs_set_layout_stateid(lo, &lrp->res.stateid, true); | 8055 | pnfs_set_layout_stateid(lo, &lrp->res.stateid, true); |
8054 | pnfs_mark_matching_lsegs_invalid(lo, &freeme, &lrp->args.range); | ||
8055 | pnfs_clear_layoutreturn_waitbit(lo); | 8056 | pnfs_clear_layoutreturn_waitbit(lo); |
8056 | lo->plh_block_lgets--; | 8057 | lo->plh_block_lgets--; |
8057 | spin_unlock(&lo->plh_inode->i_lock); | 8058 | spin_unlock(&lo->plh_inode->i_lock); |
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 6095a8d42766..b3fb6bb02275 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -1149,6 +1149,7 @@ void pnfs_roc_set_barrier(struct inode *ino, u32 barrier) | |||
1149 | 1149 | ||
1150 | spin_lock(&ino->i_lock); | 1150 | spin_lock(&ino->i_lock); |
1151 | lo = NFS_I(ino)->layout; | 1151 | lo = NFS_I(ino)->layout; |
1152 | pnfs_mark_layout_returned_if_empty(lo); | ||
1152 | if (pnfs_seqid_is_newer(barrier, lo->plh_barrier)) | 1153 | if (pnfs_seqid_is_newer(barrier, lo->plh_barrier)) |
1153 | lo->plh_barrier = barrier; | 1154 | lo->plh_barrier = barrier; |
1154 | spin_unlock(&ino->i_lock); | 1155 | spin_unlock(&ino->i_lock); |
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index d1990e90e7a0..be24a759b655 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h | |||
@@ -556,6 +556,19 @@ pnfs_calc_offset_length(u64 offset, u64 end) | |||
556 | return 1 + end - offset; | 556 | return 1 + end - offset; |
557 | } | 557 | } |
558 | 558 | ||
559 | /** | ||
560 | * pnfs_mark_layout_returned_if_empty - marks the layout as returned | ||
561 | * @lo: layout header | ||
562 | * | ||
563 | * Note: Caller must hold inode->i_lock | ||
564 | */ | ||
565 | static inline void | ||
566 | pnfs_mark_layout_returned_if_empty(struct pnfs_layout_hdr *lo) | ||
567 | { | ||
568 | if (list_empty(&lo->plh_segs)) | ||
569 | set_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags); | ||
570 | } | ||
571 | |||
559 | extern unsigned int layoutstats_timer; | 572 | extern unsigned int layoutstats_timer; |
560 | 573 | ||
561 | #ifdef NFS_DEBUG | 574 | #ifdef NFS_DEBUG |