From: Trond Myklebust Date: Wed, 5 Mar 2014 13:44:23 +0000 (-0500) Subject: NFSv4: nfs4_stateid_is_current should return 'true' for an invalid stateid X-Git-Tag: submit/tizen_common/20140905.094502~359 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ff3918ebdc2d35c0e57b6aa8c32098f40ab83bd0;p=sdk%2Femulator%2Femulator-kernel.git NFSv4: nfs4_stateid_is_current should return 'true' for an invalid stateid commit e1253be0ece1a95a02c7f5843194877471af8179 upstream. When nfs4_set_rw_stateid() can fails by returning EIO to indicate that the stateid is completely invalid, then it makes no sense to have it trigger a retry of the READ or WRITE operation. Instead, we should just have it fall through and attempt a recovery. This fixes an infinite loop in which the client keeps replaying the same bad stateid back to the server. Reported-by: Andy Adamson Link: http://lkml.kernel.org/r/1393954269-3974-1-git-send-email-andros@netapp.com Signed-off-by: Trond Myklebust Signed-off-by: Jiri Slaby --- diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index d3d7766f55e3..a53651743d4d 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -3972,8 +3972,9 @@ static bool nfs4_stateid_is_current(nfs4_stateid *stateid, { nfs4_stateid current_stateid; - if (nfs4_set_rw_stateid(¤t_stateid, ctx, l_ctx, fmode)) - return false; + /* If the current stateid represents a lost lock, then exit */ + if (nfs4_set_rw_stateid(¤t_stateid, ctx, l_ctx, fmode) == -EIO) + return true; return nfs4_stateid_match(stateid, ¤t_stateid); }