summaryrefslogtreecommitdiff
path: root/fs/nfs/pnfs.c
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2016-11-15 18:29:59 -0500
committerTrond Myklebust <trond.myklebust@primarydata.com>2016-12-01 17:21:45 -0500
commit69820d22c559c46f94e9ae08677581365c3748d5 (patch)
treed5bf7d3dd9123681729aec3e4ede72e78838dcad /fs/nfs/pnfs.c
parent94e5c571fccb8eb551d3d5f5d163bf0c253a6ed8 (diff)
pNFS: Don't mark layout segments invalid on layoutreturn in pnfs_roc
The layoutreturn call will take care of invalidating the layout segments once the call is successful. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/pnfs.c')
-rw-r--r--fs/nfs/pnfs.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 330f3a012f8e..d7b5ad437b14 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1205,22 +1205,28 @@ bool pnfs_roc(struct inode *ino)
goto out_noroc;
}
- /* always send layoutreturn if being marked so */
- if (test_bit(NFS_LAYOUT_RETURN_REQUESTED, &lo->plh_flags))
- layoutreturn = pnfs_prepare_layoutreturn(lo,
- &stateid, NULL);
- list_for_each_entry_safe(lseg, tmp, &lo->plh_segs, pls_list)
+ list_for_each_entry_safe(lseg, tmp, &lo->plh_segs, pls_list) {
/* If we are sending layoutreturn, invalidate all valid lsegs */
- if (layoutreturn || test_bit(NFS_LSEG_ROC, &lseg->pls_flags)) {
+ if (test_bit(NFS_LSEG_ROC, &lseg->pls_flags)) {
mark_lseg_invalid(lseg, &tmp_list);
found = true;
}
+ }
+
+ /* always send layoutreturn if being marked so */
+ if (test_bit(NFS_LAYOUT_RETURN_REQUESTED, &lo->plh_flags)) {
+ layoutreturn = pnfs_prepare_layoutreturn(lo,
+ &stateid, NULL);
+ if (layoutreturn)
+ goto out_noroc;
+ }
+
/* ROC in two conditions:
* 1. there are ROC lsegs
* 2. we don't send layoutreturn
*/
- if (found && !layoutreturn) {
+ if (found) {
/* lo ref dropped in pnfs_roc_release() */
pnfs_get_layout_hdr(lo);
roc = true;