diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-07-09 17:38:11 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-07-11 10:16:16 -0400 |
commit | df9cecc1a36d70ec09d34e83bad452064754fdc4 (patch) | |
tree | f33c7a8223980190c79e1e64667c16a2e01988ca /fs | |
parent | c5d73716e95d510c0655272ce44f318932309cb1 (diff) |
pNFS: pnfs_roc_drain should return 'true' when sleeping
Also clean up the case where we don't find a return-on-close layout segment.
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/pnfs.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 0ba9a02c9566..8e9f467e409c 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -1146,14 +1146,14 @@ bool pnfs_roc_drain(struct inode *ino, u32 *barrier, struct rpc_task *task) | |||
1146 | struct pnfs_layout_segment *lseg; | 1146 | struct pnfs_layout_segment *lseg; |
1147 | nfs4_stateid stateid; | 1147 | nfs4_stateid stateid; |
1148 | u32 current_seqid; | 1148 | u32 current_seqid; |
1149 | bool found = false, layoutreturn = false; | 1149 | bool layoutreturn = false; |
1150 | 1150 | ||
1151 | spin_lock(&ino->i_lock); | 1151 | spin_lock(&ino->i_lock); |
1152 | list_for_each_entry(lseg, &nfsi->layout->plh_segs, pls_list) | 1152 | list_for_each_entry(lseg, &nfsi->layout->plh_segs, pls_list) |
1153 | if (test_bit(NFS_LSEG_ROC, &lseg->pls_flags)) { | 1153 | if (test_bit(NFS_LSEG_ROC, &lseg->pls_flags)) { |
1154 | rpc_sleep_on(&NFS_SERVER(ino)->roc_rpcwaitq, task, NULL); | 1154 | rpc_sleep_on(&NFS_SERVER(ino)->roc_rpcwaitq, task, NULL); |
1155 | found = true; | 1155 | spin_unlock(&ino->i_lock); |
1156 | goto out; | 1156 | return true; |
1157 | } | 1157 | } |
1158 | lo = nfsi->layout; | 1158 | lo = nfsi->layout; |
1159 | current_seqid = be32_to_cpu(lo->plh_stateid.seqid); | 1159 | current_seqid = be32_to_cpu(lo->plh_stateid.seqid); |
@@ -1162,23 +1162,21 @@ bool pnfs_roc_drain(struct inode *ino, u32 *barrier, struct rpc_task *task) | |||
1162 | * a barrier, we choose the worst-case barrier. | 1162 | * a barrier, we choose the worst-case barrier. |
1163 | */ | 1163 | */ |
1164 | *barrier = current_seqid + atomic_read(&lo->plh_outstanding); | 1164 | *barrier = current_seqid + atomic_read(&lo->plh_outstanding); |
1165 | out: | 1165 | stateid = lo->plh_stateid; |
1166 | if (!found) { | 1166 | layoutreturn = test_and_clear_bit(NFS_LAYOUT_RETURN_BEFORE_CLOSE, |
1167 | stateid = lo->plh_stateid; | ||
1168 | layoutreturn = | ||
1169 | test_and_clear_bit(NFS_LAYOUT_RETURN_BEFORE_CLOSE, | ||
1170 | &lo->plh_flags); | 1167 | &lo->plh_flags); |
1171 | if (layoutreturn) { | 1168 | if (layoutreturn) { |
1172 | lo->plh_block_lgets++; | 1169 | lo->plh_block_lgets++; |
1173 | pnfs_get_layout_hdr(lo); | 1170 | pnfs_get_layout_hdr(lo); |
1174 | } | ||
1175 | } | 1171 | } |
1172 | |||
1176 | spin_unlock(&ino->i_lock); | 1173 | spin_unlock(&ino->i_lock); |
1177 | if (layoutreturn) { | 1174 | if (layoutreturn) { |
1178 | rpc_sleep_on(&NFS_SERVER(ino)->roc_rpcwaitq, task, NULL); | 1175 | rpc_sleep_on(&NFS_SERVER(ino)->roc_rpcwaitq, task, NULL); |
1179 | pnfs_send_layoutreturn(lo, stateid, IOMODE_ANY, false); | 1176 | pnfs_send_layoutreturn(lo, stateid, IOMODE_ANY, false); |
1177 | return true; | ||
1180 | } | 1178 | } |
1181 | return found; | 1179 | return false; |
1182 | } | 1180 | } |
1183 | 1181 | ||
1184 | /* | 1182 | /* |