usr/src/uts/common/fs/nfs/nfs4_dispatch.c
changeset 4635 5372e33d8533
parent 2822 dfa681ac52ec
child 5647 738702b10756
equal deleted inserted replaced
4634:39bfb9e90d34 4635:5372e33d8533
    18  *
    18  *
    19  * CDDL HEADER END
    19  * CDDL HEADER END
    20  */
    20  */
    21 
    21 
    22 /*
    22 /*
    23  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
    23  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
    24  * Use is subject to license terms.
    24  * Use is subject to license terms.
    25  */
    25  */
    26 
    26 
    27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
    27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
    28 
    28 
    35 #include <rpc/svc.h>
    35 #include <rpc/svc.h>
    36 #include <rpc/xdr.h>
    36 #include <rpc/xdr.h>
    37 #include <nfs/nfs4.h>
    37 #include <nfs/nfs4.h>
    38 #include <nfs/nfs_dispatch.h>
    38 #include <nfs/nfs_dispatch.h>
    39 #include <nfs/nfs4_drc.h>
    39 #include <nfs/nfs4_drc.h>
       
    40 
       
    41 #define	NFS4_MAX_MINOR_VERSION	0
    40 
    42 
    41 /*
    43 /*
    42  * This is the duplicate request cache for NFSv4
    44  * This is the duplicate request cache for NFSv4
    43  */
    45  */
    44 rfs4_drc_t *nfs4_drc = NULL;
    46 rfs4_drc_t *nfs4_drc = NULL;
   526 		rfs4_compound_free(rbp);
   528 		rfs4_compound_free(rbp);
   527 	}
   529 	}
   528 
   530 
   529 	return (error);
   531 	return (error);
   530 }
   532 }
       
   533 
       
   534 bool_t
       
   535 rfs4_minorvers_mismatch(struct svc_req *req, SVCXPRT *xprt, void *args)
       
   536 {
       
   537 	COMPOUND4args *argsp;
       
   538 	COMPOUND4res res_buf, *resp;
       
   539 
       
   540 	if (req->rq_vers != 4)
       
   541 		return (FALSE);
       
   542 
       
   543 	argsp = (COMPOUND4args *)args;
       
   544 
       
   545 	if (argsp->minorversion <= NFS4_MAX_MINOR_VERSION)
       
   546 		return (FALSE);
       
   547 
       
   548 	resp = &res_buf;
       
   549 
       
   550 	/*
       
   551 	 * Form a reply tag by copying over the reqeuest tag.
       
   552 	 */
       
   553 	resp->tag.utf8string_val =
       
   554 	    kmem_alloc(argsp->tag.utf8string_len, KM_SLEEP);
       
   555 	resp->tag.utf8string_len = argsp->tag.utf8string_len;
       
   556 	bcopy(argsp->tag.utf8string_val, resp->tag.utf8string_val,
       
   557 	    resp->tag.utf8string_len);
       
   558 	resp->array_len = 0;
       
   559 	resp->array = NULL;
       
   560 	resp->status = NFS4ERR_MINOR_VERS_MISMATCH;
       
   561 	if (!svc_sendreply(xprt,  xdr_COMPOUND4res_srv, (char *)resp)) {
       
   562 		DTRACE_PROBE2(nfss__e__minorvers_mismatch,
       
   563 		    SVCXPRT *, xprt, char *, resp);
       
   564 	}
       
   565 	rfs4_compound_free(resp);
       
   566 	return (TRUE);
       
   567 }