nfsd4: implement secinfo_no_name
authorJ. Bruce Fields <bfields@redhat.com>
Thu, 16 Dec 2010 14:51:13 +0000 (09:51 -0500)
committerJ. Bruce Fields <bfields@redhat.com>
Fri, 17 Dec 2010 20:48:25 +0000 (15:48 -0500)
Implementation of this operation is mandatory for NFSv4.1.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4proc.c
fs/nfsd/nfs4xdr.c
fs/nfsd/xdr4.h
include/linux/nfs4.h

index 095431a3572240936170e2121a3d91ea90451a25..f80c3997d24ce3ac0f7c3b32eade0d79074c9c40 100644 (file)
@@ -779,6 +779,29 @@ nfsd4_secinfo(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
        return err;
 }
 
+static __be32
+nfsd4_secinfo_no_name(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
+             struct nfsd4_secinfo_no_name *sin)
+{
+       __be32 err;
+
+       switch (sin->sin_style) {
+       case NFS4_SECINFO_STYLE4_CURRENT_FH:
+               break;
+       case NFS4_SECINFO_STYLE4_PARENT:
+               err = nfsd4_do_lookupp(rqstp, &cstate->current_fh);
+               if (err)
+                       return err;
+               break;
+       default:
+               return nfserr_inval;
+       }
+       exp_get(cstate->current_fh.fh_export);
+       sin->sin_exp = cstate->current_fh.fh_export;
+       fh_put(&cstate->current_fh);
+       return nfs_ok;
+}
+
 static __be32
 nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
              struct nfsd4_setattr *setattr)
@@ -1327,6 +1350,10 @@ static struct nfsd4_operation nfsd4_ops[] = {
                .op_flags = ALLOWED_WITHOUT_FH,
                .op_name = "OP_RECLAIM_COMPLETE",
        },
+       [OP_SECINFO_NO_NAME] = {
+               .op_func = (nfsd4op_func)nfsd4_secinfo_no_name,
+               .op_name = "OP_SECINFO_NO_NAME",
+       },
 };
 
 static const char *nfsd4_op_name(unsigned opnum)
index 71d7d339e44a57b070a783b0d200b7da3c79d0a6..b543b2410b541edd2921c755f77f996e7b34824b 100644 (file)
@@ -846,6 +846,17 @@ nfsd4_decode_secinfo(struct nfsd4_compoundargs *argp,
        DECODE_TAIL;
 }
 
+static __be32
+nfsd4_decode_secinfo_no_name(struct nfsd4_compoundargs *argp,
+                    struct nfsd4_secinfo_no_name *sin)
+{
+       DECODE_HEAD;
+
+       READ_BUF(4);
+       READ32(sin->sin_style);
+       DECODE_TAIL;
+}
+
 static __be32
 nfsd4_decode_setattr(struct nfsd4_compoundargs *argp, struct nfsd4_setattr *setattr)
 {
@@ -1358,7 +1369,7 @@ static nfsd4_dec nfsd41_dec_ops[] = {
        [OP_LAYOUTCOMMIT]       = (nfsd4_dec)nfsd4_decode_notsupp,
        [OP_LAYOUTGET]          = (nfsd4_dec)nfsd4_decode_notsupp,
        [OP_LAYOUTRETURN]       = (nfsd4_dec)nfsd4_decode_notsupp,
-       [OP_SECINFO_NO_NAME]    = (nfsd4_dec)nfsd4_decode_notsupp,
+       [OP_SECINFO_NO_NAME]    = (nfsd4_dec)nfsd4_decode_secinfo_no_name,
        [OP_SEQUENCE]           = (nfsd4_dec)nfsd4_decode_sequence,
        [OP_SET_SSV]            = (nfsd4_dec)nfsd4_decode_notsupp,
        [OP_TEST_STATEID]       = (nfsd4_dec)nfsd4_decode_notsupp,
@@ -3162,7 +3173,7 @@ static nfsd4_enc nfsd4_enc_ops[] = {
        [OP_LAYOUTCOMMIT]       = (nfsd4_enc)nfsd4_encode_noop,
        [OP_LAYOUTGET]          = (nfsd4_enc)nfsd4_encode_noop,
        [OP_LAYOUTRETURN]       = (nfsd4_enc)nfsd4_encode_noop,
-       [OP_SECINFO_NO_NAME]    = (nfsd4_enc)nfsd4_encode_noop,
+       [OP_SECINFO_NO_NAME]    = (nfsd4_enc)nfsd4_encode_secinfo,
        [OP_SEQUENCE]           = (nfsd4_enc)nfsd4_encode_sequence,
        [OP_SET_SSV]            = (nfsd4_enc)nfsd4_encode_noop,
        [OP_TEST_STATEID]       = (nfsd4_enc)nfsd4_encode_noop,
index 60fce3dc5cb5d9f90d22b9f9c91ddc7ddeb9ff1d..799c30c3b495a849792d6ce10813738dfc319cc2 100644 (file)
@@ -311,6 +311,11 @@ struct nfsd4_secinfo {
        struct svc_export *si_exp;                      /* response */
 };
 
+struct nfsd4_secinfo_no_name {
+       u32 sin_style;                                  /* request */
+       struct svc_export *sin_exp;                     /* response */
+};
+
 struct nfsd4_setattr {
        stateid_t       sa_stateid;         /* request */
        u32             sa_bmval[3];        /* request */
index 4925b22219d25cfa654aa9d515950acc36d977f4..26afa3021ed6d35137c7a6d39daa4fb7f62c0bb5 100644 (file)
 #define SEQ4_STATUS_CB_PATH_DOWN_SESSION       0x00000200
 #define SEQ4_STATUS_BACKCHANNEL_FAULT          0x00000400
 
+#define NFS4_SECINFO_STYLE4_CURRENT_FH 0
+#define NFS4_SECINFO_STYLE4_PARENT     1
+
 #define NFS4_MAX_UINT64        (~(u64)0)
 
 /* An NFS4 sessions server must support at least NFS4_MAX_OPS operations.