pNFS: Force a retry of LAYOUTGET if the stateid doesn't match our cache
If the server sends us a completely new stateid, and the client thinks it already holds a layout, then force a retry of the LAYOUTGET after invalidating the existing layout in order to avoid corruption due to races. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
This commit is contained in:
parent
ae5a459d5f
commit
9888d837f3
@ -1844,7 +1844,10 @@ pnfs_layout_process(struct nfs4_layoutget *lgp)
|
|||||||
goto out_forget;
|
goto out_forget;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nfs4_stateid_match_other(&lo->plh_stateid, &res->stateid)) {
|
if (!pnfs_layout_is_valid(lo)) {
|
||||||
|
/* We have a completely new layout */
|
||||||
|
pnfs_set_layout_stateid(lo, &res->stateid, true);
|
||||||
|
} else if (nfs4_stateid_match_other(&lo->plh_stateid, &res->stateid)) {
|
||||||
/* existing state ID, make sure the sequence number matches. */
|
/* existing state ID, make sure the sequence number matches. */
|
||||||
if (pnfs_layout_stateid_blocked(lo, &res->stateid)) {
|
if (pnfs_layout_stateid_blocked(lo, &res->stateid)) {
|
||||||
dprintk("%s forget reply due to sequence\n", __func__);
|
dprintk("%s forget reply due to sequence\n", __func__);
|
||||||
@ -1854,12 +1857,10 @@ pnfs_layout_process(struct nfs4_layoutget *lgp)
|
|||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* We got an entirely new state ID. Mark all segments for the
|
* We got an entirely new state ID. Mark all segments for the
|
||||||
* inode invalid, and don't bother validating the stateid
|
* inode invalid, and retry the layoutget
|
||||||
* sequence number.
|
|
||||||
*/
|
*/
|
||||||
pnfs_mark_layout_stateid_invalid(lo, &free_me);
|
pnfs_mark_layout_stateid_invalid(lo, &free_me);
|
||||||
|
goto out_forget;
|
||||||
pnfs_set_layout_stateid(lo, &res->stateid, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pnfs_get_lseg(lseg);
|
pnfs_get_lseg(lseg);
|
||||||
|
Loading…
Reference in New Issue
Block a user