NFSv4.1: Fix a potential layoutget/layoutrecall deadlock

If the client is sending a layoutget, but the server issues a callback
to recall what it thinks may be an outstanding layout, then we may find
an uninitialised layout attached to the inode due to the layoutget.
In that case, it is appropriate to return NFS4ERR_NOMATCHING_LAYOUT
rather than NFS4ERR_DELAY, as the latter can end up deadlocking.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
This commit is contained in:
Trond Myklebust 2018-07-12 14:19:03 -04:00
parent af9b6d7570
commit bd3d16a887
1 changed files with 2 additions and 2 deletions

View File

@ -215,9 +215,9 @@ static u32 pnfs_check_callback_stateid(struct pnfs_layout_hdr *lo,
{ {
u32 oldseq, newseq; u32 oldseq, newseq;
/* Is the stateid still not initialised? */ /* Is the stateid not initialised? */
if (!pnfs_layout_is_valid(lo)) if (!pnfs_layout_is_valid(lo))
return NFS4ERR_DELAY; return NFS4ERR_NOMATCHING_LAYOUT;
/* Mismatched stateid? */ /* Mismatched stateid? */
if (!nfs4_stateid_match_other(&lo->plh_stateid, new)) if (!nfs4_stateid_match_other(&lo->plh_stateid, new))