The branch main has been updated by rmacklem:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=1d4afcaca282f4ba249d8508f4149d9c0b058492

commit 1d4afcaca282f4ba249d8508f4149d9c0b058492
Author:     Rick Macklem <rmack...@freebsd.org>
AuthorDate: 2021-06-01 02:41:17 +0000
Commit:     Rick Macklem <rmack...@freebsd.org>
CommitDate: 2021-06-01 02:41:17 +0000

    nfsd: Delete extraneous NFSv4 root checks
    
    There are several NFSv4.1/4.2 server operation functions which
    have unneeded checks for the NFSv4 root being set up.
    The checks are not needed because the operations always follow
    a Sequence operation, which performs the check.
    
    This patch deletes these checks, simplifying the code so
    that a future patch that fixes the checks to conform with
    RFC5661 Sec. 2.6 will be less extension.
    
    MFC after:      2 weeks
---
 sys/fs/nfsserver/nfs_nfsdserv.c | 68 -----------------------------------------
 1 file changed, 68 deletions(-)

diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c
index 5d3c6f65ced0..329c096c7570 100644
--- a/sys/fs/nfsserver/nfs_nfsdserv.c
+++ b/sys/fs/nfsserver/nfs_nfsdserv.c
@@ -4523,10 +4523,6 @@ nfsrvd_reclaimcomplete(struct nfsrv_descript *nd, 
__unused int isdgram,
        uint32_t *tl;
        int error = 0, onefs;
 
-       if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) {
-               nd->nd_repstat = NFSERR_WRONGSEC;
-               goto nfsmout;
-       }
        NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED);
        /*
         * I believe that a ReclaimComplete with rca_one_fs == TRUE is only
@@ -4644,10 +4640,6 @@ nfsrvd_freestateid(struct nfsrv_descript *nd, __unused 
int isdgram,
        int error = 0;
        struct thread *p = curthread;
 
-       if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) {
-               nd->nd_repstat = NFSERR_WRONGSEC;
-               goto nfsmout;
-       }
        NFSM_DISSECT(tl, uint32_t *, NFSX_STATEID);
        stateid.seqid = fxdr_unsigned(uint32_t, *tl++);
        NFSBCOPY(tl, stateid.other, NFSX_STATEIDOTHER);
@@ -4694,10 +4686,6 @@ nfsrvd_layoutget(struct nfsrv_descript *nd, __unused int 
isdgram,
        char *layp;
        struct thread *p = curthread;
 
-       if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) {
-               nd->nd_repstat = NFSERR_WRONGSEC;
-               goto nfsmout;
-       }
        NFSM_DISSECT(tl, uint32_t *, 4 * NFSX_UNSIGNED + 3 * NFSX_HYPER +
            NFSX_STATEID);
        tl++;           /* Signal layout available. Ignore for now. */
@@ -4795,10 +4783,6 @@ nfsrvd_layoutcommit(struct nfsrv_descript *nd, __unused 
int isdgram,
        struct thread *p = curthread;
 
        layp = NULL;
-       if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) {
-               nd->nd_repstat = NFSERR_WRONGSEC;
-               goto nfsmout;
-       }
        NFSM_DISSECT(tl, uint32_t *, 2 * NFSX_UNSIGNED + 2 * NFSX_HYPER +
            NFSX_STATEID);
        offset = fxdr_hyper(tl); tl += 2;
@@ -4878,10 +4862,6 @@ nfsrvd_layoutreturn(struct nfsrv_descript *nd, __unused 
int isdgram,
        struct thread *p = curthread;
 
        layp = NULL;
-       if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) {
-               nd->nd_repstat = NFSERR_WRONGSEC;
-               goto nfsmout;
-       }
        NFSM_DISSECT(tl, uint32_t *, 4 * NFSX_UNSIGNED);
        reclaim = *tl++;
        layouttype = fxdr_unsigned(int, *tl++);
@@ -4964,10 +4944,6 @@ nfsrvd_layouterror(struct nfsrv_descript *nd, __unused 
int isdgram,
        char devid[NFSX_V4DEVICEID];
        uint64_t offset, len;
 
-       if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) {
-               nd->nd_repstat = NFSERR_WRONGSEC;
-               goto nfsmout;
-       }
        NFSM_DISSECT(tl, uint32_t *, 2 * NFSX_HYPER + NFSX_STATEID +
            NFSX_UNSIGNED);
        offset = fxdr_hyper(tl); tl += 2;
@@ -5032,10 +5008,6 @@ nfsrvd_layoutstats(struct nfsrv_descript *nd, __unused 
int isdgram,
        uint64_t offset, len, readcount, readbytes, writecount, writebytes
            __unused;
 
-       if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) {
-               nd->nd_repstat = NFSERR_WRONGSEC;
-               goto nfsmout;
-       }
        NFSM_DISSECT(tl, uint32_t *, 6 * NFSX_HYPER + NFSX_STATEID +
            NFSX_V4DEVICEID + 2 * NFSX_UNSIGNED);
        offset = fxdr_hyper(tl); tl += 2;
@@ -5092,10 +5064,6 @@ nfsrvd_ioadvise(struct nfsrv_descript *nd, __unused int 
isdgram,
        int error = 0, ret;
        off_t offset, len;
 
-       if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) {
-               nd->nd_repstat = NFSERR_WRONGSEC;
-               goto nfsmout;
-       }
        NFSM_DISSECT(tl, uint32_t *, NFSX_STATEID + 2 * NFSX_HYPER);
        stateid.seqid = fxdr_unsigned(uint32_t, *tl++);
        NFSBCOPY(tl, stateid.other, NFSX_STATEIDOTHER);
@@ -5185,10 +5153,6 @@ nfsrvd_getdevinfo(struct nfsrv_descript *nd, __unused 
int isdgram,
        char devid[NFSX_V4DEVICEID], *devaddr;
        time_t dev_time;
 
-       if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) {
-               nd->nd_repstat = NFSERR_WRONGSEC;
-               goto nfsmout;
-       }
        NFSM_DISSECT(tl, uint32_t *, 3 * NFSX_UNSIGNED + NFSX_V4DEVICEID);
        NFSBCOPY(tl, devid, NFSX_V4DEVICEID);
        tl += (NFSX_V4DEVICEID / NFSX_UNSIGNED);
@@ -5257,10 +5221,6 @@ nfsrvd_teststateid(struct nfsrv_descript *nd, __unused 
int isdgram,
        int cnt, error = 0, i, ret;
        struct thread *p = curthread;
 
-       if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) {
-               nd->nd_repstat = NFSERR_WRONGSEC;
-               goto nfsmout;
-       }
        NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED);
        cnt = fxdr_unsigned(int, *tl);
        if (cnt <= 0 || cnt > 1024) {
@@ -5307,10 +5267,6 @@ nfsrvd_allocate(struct nfsrv_descript *nd, __unused int 
isdgram,
        nfsquad_t clientid;
        nfsattrbit_t attrbits;
 
-       if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) {
-               nd->nd_repstat = NFSERR_WRONGSEC;
-               goto nfsmout;
-       }
        gotproxystateid = 0;
        NFSM_DISSECT(tl, uint32_t *, NFSX_STATEID + 2 * NFSX_HYPER);
        stp->ls_flags = (NFSLCK_CHECK | NFSLCK_WRITEACCESS);
@@ -5404,10 +5360,6 @@ nfsrvd_copy_file_range(struct nfsrv_descript *nd, 
__unused int isdgram,
        void *rl_rcookie, *rl_wcookie;
 
        rl_rcookie = rl_wcookie = NULL;
-       if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) {
-               nd->nd_repstat = NFSERR_WRONGSEC;
-               goto nfsmout;
-       }
        if (nfsrv_devidcnt > 0) {
                /*
                 * For a pNFS server, reply NFSERR_NOTSUPP so that the client
@@ -5634,10 +5586,6 @@ nfsrvd_seek(struct nfsrv_descript *nd, __unused int 
isdgram,
        nfsattrbit_t attrbits;
        bool eof;
 
-       if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) {
-               nd->nd_repstat = NFSERR_WRONGSEC;
-               goto nfsmout;
-       }
        NFSM_DISSECT(tl, uint32_t *, NFSX_STATEID + NFSX_HYPER + NFSX_UNSIGNED);
        /* Ignore the stateid for now. */
        tl += (NFSX_STATEID / NFSX_UNSIGNED);
@@ -5707,10 +5655,6 @@ nfsrvd_getxattr(struct nfsrv_descript *nd, __unused int 
isdgram,
        uint16_t off;
 
        error = 0;
-       if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) {
-               nd->nd_repstat = NFSERR_WRONGSEC;
-               goto nfsmout;
-       }
        NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED);
        len = fxdr_unsigned(int, *tl);
        if (len <= 0) {
@@ -5779,10 +5723,6 @@ nfsrvd_setxattr(struct nfsrv_descript *nd, __unused int 
isdgram,
 
        error = 0;
        name = NULL;
-       if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) {
-               nd->nd_repstat = NFSERR_WRONGSEC;
-               goto nfsmout;
-       }
        NFSM_DISSECT(tl, uint32_t *, 2 * NFSX_UNSIGNED);
        opt = fxdr_unsigned(int, *tl++);
        len = fxdr_unsigned(int, *tl);
@@ -5872,10 +5812,6 @@ nfsrvd_rmxattr(struct nfsrv_descript *nd, __unused int 
isdgram,
 
        error = 0;
        name = NULL;
-       if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) {
-               nd->nd_repstat = NFSERR_WRONGSEC;
-               goto nfsmout;
-       }
        NFSM_DISSECT(tl, uint32_t *, NFSX_UNSIGNED);
        len = fxdr_unsigned(int, *tl);
        if (len <= 0) {
@@ -5942,10 +5878,6 @@ nfsrvd_listxattr(struct nfsrv_descript *nd, __unused int 
isdgram,
 
        error = 0;
        buf = NULL;
-       if (nfs_rootfhset == 0 || nfsd_checkrootexp(nd) != 0) {
-               nd->nd_repstat = NFSERR_WRONGSEC;
-               goto nfsmout;
-       }
        NFSM_DISSECT(tl, uint32_t *, NFSX_HYPER + NFSX_UNSIGNED);
        /*
         * The cookie doesn't need to be in net byte order, but FreeBSD
_______________________________________________
dev-commits-src-main@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "dev-commits-src-main-unsubscr...@freebsd.org"

Reply via email to