Skip to content

Commit 885c0cc

Browse files
Trond Myklebustgregkh
authored andcommitted
NFSv4/pnfs: Fix layoutget behaviour after invalidation
[ Upstream commit 0b77f97 ] If the layout gets invalidated, we should wait for any outstanding layoutget requests for that layout to complete, and we should resend them only after re-establishing the layout stateid. Fixes: d29b468 ("pNFS/NFSv4: Improve rejection of out-of-order layouts") Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent a668a77 commit 885c0cc

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎fs/nfs/pnfs.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2015,7 +2015,7 @@ pnfs_update_layout(struct inode *ino,
20152015
* If the layout segment list is empty, but there are outstanding
20162016
* layoutget calls, then they might be subject to a layoutrecall.
20172017
*/
2018-
if (list_empty(&lo->plh_segs) &&
2018+
if ((list_empty(&lo->plh_segs) || !pnfs_layout_is_valid(lo)) &&
20192019
atomic_read(&lo->plh_outstanding) != 0) {
20202020
spin_unlock(&ino->i_lock);
20212021
lseg = ERR_PTR(wait_var_event_killable(&lo->plh_outstanding,
@@ -2391,11 +2391,13 @@ pnfs_layout_process(struct nfs4_layoutget *lgp)
23912391
goto out_forget;
23922392
}
23932393

2394+
if (!pnfs_layout_is_valid(lo) && !pnfs_is_first_layoutget(lo))
2395+
goto out_forget;
2396+
23942397
if (nfs4_stateid_match_other(&lo->plh_stateid, &res->stateid)) {
23952398
/* existing state ID, make sure the sequence number matches. */
23962399
if (pnfs_layout_stateid_blocked(lo, &res->stateid)) {
2397-
if (!pnfs_layout_is_valid(lo) &&
2398-
pnfs_is_first_layoutget(lo))
2400+
if (!pnfs_layout_is_valid(lo))
23992401
lo->plh_barrier = 0;
24002402
dprintk("%s forget reply due to sequence\n", __func__);
24012403
goto out_forget;
@@ -2416,8 +2418,6 @@ pnfs_layout_process(struct nfs4_layoutget *lgp)
24162418
goto out_forget;
24172419
} else {
24182420
/* We have a completely new layout */
2419-
if (!pnfs_is_first_layoutget(lo))
2420-
goto out_forget;
24212421
pnfs_set_layout_stateid(lo, &res->stateid, lgp->cred, true);
24222422
}
24232423

0 commit comments

Comments
 (0)