diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2016-11-30 16:23:38 -0500 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2016-12-01 17:21:50 -0500 |
commit | 29ade5db12930ec60133f6a02791f4b1a4af2943 (patch) | |
tree | 902a708ad74aa0a914489f696051bba762b297f1 /fs/nfs/pnfs.c | |
parent | abb3e1c8777ec2baffa2c736aa06280821018995 (diff) |
pNFS: Wait on outstanding layoutreturns to complete in pnfs_roc()
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/pnfs.c')
-rw-r--r-- | fs/nfs/pnfs.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 57ec46b57364..550010826bdd 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -1245,11 +1245,20 @@ bool pnfs_roc(struct inode *ino, | |||
1245 | 1245 | ||
1246 | if (!nfs_have_layout(ino)) | 1246 | if (!nfs_have_layout(ino)) |
1247 | return false; | 1247 | return false; |
1248 | retry: | ||
1248 | spin_lock(&ino->i_lock); | 1249 | spin_lock(&ino->i_lock); |
1249 | lo = nfsi->layout; | 1250 | lo = nfsi->layout; |
1250 | if (!lo || !pnfs_layout_is_valid(lo) || | 1251 | if (!lo || !pnfs_layout_is_valid(lo) || |
1251 | test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags)) | 1252 | test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags)) |
1252 | goto out_noroc; | 1253 | goto out_noroc; |
1254 | if (test_bit(NFS_LAYOUT_RETURN_LOCK, &lo->plh_flags)) { | ||
1255 | pnfs_get_layout_hdr(lo); | ||
1256 | spin_unlock(&ino->i_lock); | ||
1257 | wait_on_bit(&lo->plh_flags, NFS_LAYOUT_RETURN, | ||
1258 | TASK_UNINTERRUPTIBLE); | ||
1259 | pnfs_put_layout_hdr(lo); | ||
1260 | goto retry; | ||
1261 | } | ||
1253 | 1262 | ||
1254 | /* no roc if we hold a delegation */ | 1263 | /* no roc if we hold a delegation */ |
1255 | if (nfs4_check_delegation(ino, FMODE_READ)) | 1264 | if (nfs4_check_delegation(ino, FMODE_READ)) |