pNFS/NFSv4: Try to return invalid layout in pnfs_layout_process()

If the server returns a new stateid that does not match the one in our
cache, then try to return the one we hold instead of just invalidating
it on the client side. This ensures that both client and server will
agree that the stateid is invalid.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>

+7 -2
+7 -2
fs/nfs/pnfs.c
··· 2398 * We got an entirely new state ID. Mark all segments for the 2399 * inode invalid, and retry the layoutget 2400 */ 2401 - pnfs_mark_layout_stateid_invalid(lo, &free_me); 2402 goto out_forget; 2403 } 2404 ··· 2423 spin_unlock(&ino->i_lock); 2424 lseg->pls_layout = lo; 2425 NFS_SERVER(ino)->pnfs_curr_ld->free_lseg(lseg); 2426 - pnfs_free_lseg_list(&free_me); 2427 return ERR_PTR(-EAGAIN); 2428 } 2429
··· 2398 * We got an entirely new state ID. Mark all segments for the 2399 * inode invalid, and retry the layoutget 2400 */ 2401 + struct pnfs_layout_range range = { 2402 + .iomode = IOMODE_ANY, 2403 + .length = NFS4_MAX_UINT64, 2404 + }; 2405 + pnfs_set_plh_return_info(lo, IOMODE_ANY, 0); 2406 + pnfs_mark_matching_lsegs_return(lo, &lo->plh_return_segs, 2407 + &range, 0); 2408 goto out_forget; 2409 } 2410 ··· 2417 spin_unlock(&ino->i_lock); 2418 lseg->pls_layout = lo; 2419 NFS_SERVER(ino)->pnfs_curr_ld->free_lseg(lseg); 2420 return ERR_PTR(-EAGAIN); 2421 } 2422