nfsd: clean up bad-type check in nfsd_create_locked
authorJ. Bruce Fields <bfields@redhat.com>
Fri, 22 Jul 2016 16:03:46 +0000 (12:03 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Thu, 4 Aug 2016 21:11:51 +0000 (17:11 -0400)
Minor cleanup, no change in behavior.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/vfs.c

index c95709486ca4632b5012e6e66dd1e1bf0629180c..1809624997f0df77c0f1486691a7eaee69cd3942 100644 (file)
@@ -1166,13 +1166,6 @@ nfsd_create_locked(struct svc_rqst *rqstp, struct svc_fh *fhp,
                iap->ia_mode = 0;
        iap->ia_mode = (iap->ia_mode & S_IALLUGO) | type;
 
-       err = nfserr_inval;
-       if (!S_ISREG(type) && !S_ISDIR(type) && !special_file(type)) {
-               printk(KERN_WARNING "nfsd: bad file type %o in nfsd_create\n",
-                      type);
-               goto out;
-       }
-
        err = 0;
        host_err = 0;
        switch (type) {
@@ -1190,6 +1183,10 @@ nfsd_create_locked(struct svc_rqst *rqstp, struct svc_fh *fhp,
        case S_IFSOCK:
                host_err = vfs_mknod(dirp, dchild, iap->ia_mode, rdev);
                break;
+       default:
+               printk(KERN_WARNING "nfsd: bad file type %o in nfsd_create\n",
+                      type);
+               host_err = -EINVAL;
        }
        if (host_err < 0)
                goto out_nfserr;