[PATCH 02/16] nfsd: simplify exp_find_key return value
Trond Myklebust
trond.myklebust at fys.uio.no
Fri May 18 18:00:05 EDT 2007
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;
Trond
More information about the NFSv4
mailing list