[PATCH 02/16] nfsd: simplify exp_find_key return value
J. Bruce Fields
bfields at fieldses.org
Fri May 18 18:32:18 EDT 2007
On Fri, May 18, 2007 at 06:00:05PM -0400, Trond Myklebust wrote:
> On Fri, 2007-05-18 at 17:27 -0400, J. Bruce Fields wrote:
> > From: J. Bruce Fields <bfields at citi.umich.edu>
> >
> > exp_find_key can return either NULL or -ENOENT on a lookup failure, but
> > there's no reason to distinguish the two cases. Returning NULL in both
> > cases (as exp_get_by_name does) makes life a little simpler for callers
> > (such as fh_verify).
>
> It is poor practice to mix the ERR_PTR() and NULL return value
> conventions: you force callers to deal with 3 types of return value
> (ERR_PTR(), NULL, and valid pointer) instead of just 2.
>
> How about just simplifying the other way: always return -ENOENT if the
> lookup failed?
>
> You can still simplify fh_verify():
>
> error = nfserr_stale;
> if (PTR_ERR(exp) == -ENOENT)
> goto out;
>
> error = nfserrno(PTR_ERR(exp));
> if (IS_ERR(exp))
> goto out;
Hm, yes, could be; that requires some more changes. I'll take a look.
--b.
More information about the NFSv4
mailing list