Re: [PATCH] nfsd4: fix seqid_mutating_error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 23, 2011 at 09:22:48PM -0400, J. Bruce Fields wrote:
> On Tue, Aug 23, 2011 at 03:58:05PM -0700, Myklebust, Trond wrote:
> > > -----Original Message-----
> > > From: J. Bruce Fields [mailto:bfields@xxxxxxxxxxxx]
> > > diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
> > > index 76f99e8..b875b03 100644
> > > --- a/include/linux/nfs4.h
> > > +++ b/include/linux/nfs4.h
> > > @@ -373,6 +373,22 @@ enum nfsstat4 {
> > >  	NFS4ERR_DELEG_REVOKED	= 10087,	/* deleg./layout revoked
> > */
> > >  };
> > > 
> > > +static inline bool seqid_mutating_err(u32 err)
> > > +{
> > > +	/* rfc 3530 section 8.1.5: */
> > > +	switch (err) {
> > > +	case NFS4ERR_STALE_CLIENTID:
> > > +	case NFS4ERR_STALE_STATEID:
> > > +	case NFS4ERR_BAD_STATEID:
> > > +	case NFS4ERR_BAD_SEQID:
> > > +	case NFS4ERR_BADXDR:
> > > +	case NFS4ERR_RESOURCE:
> > > +	case NFS4ERR_NOFILEHANDLE:
> > > +		return false;
> > > +	};
> > > +	return true;
> > > +}
> > > +
> > >  /*
> > >   * Note: NF4BAD is not actually part of the protocol; it is just used
> > >   * internally by nfsd.
> > 
> > Should we make it take a 's32' rather than a 'u32' argument? We do
> > usually expect those errors to be signed.
> 
> On the server side it's unsigned--bigendian in fact.  The caller is:
> 
> > > +	if (seqid_mutating_err(ntohl(nfserr)) && stateowner) { 	\
> 
> I put this in nfs4.h which is mostly protocol constants, and I figure
> u32 is the type closest to the relevant xdr, and we should convert as
> necessary in callers.  I dunno.

(Translation: "I dunno" == "I have no strong opinion, but I'm sticking
with this patch unless you want to write another".)

--b.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux