nfsd: remove some dead code in nfsd_create_locked()
Subsystems (3)
PATCH 1/1 nfsd: remove some dead code in nfsd_create_locked()
We changed this around in f13058a93484 ('nfsd: reorganize nfsd_create') so "dchild" can't be an error pointer any more. Also we don't need to test if dchild is NULL because dput has a check built-in. Can it even be NULL?
fs/nfsd/vfs.c +2 -3
@@ -1141,7 +1141,7 @@ nfsd_create_locked(struct svc_rqst *rqstp, struct svc_fh *fhp, char *fname, int flen, struct iattr *iap, int type, dev_t rdev, struct svc_fh *resfhp) { - struct dentry *dentry, *dchild = NULL; + struct dentry *dentry, *dchild;struct inode *dirp;__be32 err;__be32 err2;
@@ -1208,8 +1208,7 @@ nfsd_create_locked(struct svc_rqst *rqstp, struct svc_fh *fhp,if (!err) err =fh_update (resfhp); out: -if (dchild && !IS_ERR (dchild)) -dput (dchild); +dput (dchild);return err; out_nfserr:
Quoted 3 lines · Dan Carpenter
We changed this around in
f13058a93484('nfsd: reorganizenfsd_create') so "dchild" can't be an error pointer any more. Also we don't need to test if dchild is NULL because dput has a check built-in.
Thanks!
Quoted 1 line
Can it even be NULL?
It was returned from a caller's lookup_one_len, which can only return pointers or errors, I believe. (And looks like callers also do fh_verify and would already oops if it was null.)
Anyway, added a brief comment to that effect, fixed up the referenced commitid (I rewrote some history there, apologies) and committed, will push out after a few tests....
--b.
Quoted 26 lines
Signed-off-by Dan Carpenter <[email protected]>fs/nfsd/vfs.c +2
-3@@ -1141,7 +1141,7 @@ nfsd_create_locked(struct svc_rqst *rqstp, struct svc_fh *fhp, char *fname, int flen, struct iattr *iap, int type, dev_t rdev, struct svc_fh *resfhp) { - struct dentry *dentry, *dchild = NULL; + struct dentry *dentry, *dchild;struct inode *dirp;__be32 err;__be32 err2;@@ -1208,8 +1208,7 @@ nfsd_create_locked(struct svc_rqst *rqstp, struct svc_fh *fhp,if (!err) err =fh_update (resfhp); out: -if (dchild && !IS_ERR (dchild)) -dput (dchild); +dput (dchild);return err; out_nfserr: