Print this page
NEX-3758 Support for remote stale lock detection
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>


  11  * 2. Redistributions in binary form must reproduce the above copyright
  12  *    notice, this list of conditions and the following disclaimer in the
  13  *    documentation and/or other materials provided with the distribution.
  14  *
  15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  25  * SUCH DAMAGE.
  26  *
  27  * $FreeBSD$
  28  */
  29 
  30 /*
  31  * Copyright 2012 Nexenta Systems, Inc.  All rights reserved.
  32  * Copyright (c) 2012 by Delphix. All rights reserved.
  33  */
  34 
  35 /*
  36  * NFS Lock Manager (NLM) private declarations, etc.
  37  *
  38  * Source code derived from FreeBSD nlm.h
  39  */
  40 
  41 #ifndef _NLM_NLM_H_
  42 #define _NLM_NLM_H_
  43 
  44 #include <sys/cmn_err.h>
  45 #include <sys/queue.h>
  46 #include <sys/modhash.h>
  47 #include <sys/avl.h>

  48 
  49 #define RPC_MSGOUT(args...)     cmn_err(CE_NOTE, args)
  50 #define NLM_ERR(...)            cmn_err(CE_NOTE, __VA_ARGS__)
  51 #define NLM_WARN(...)           cmn_err(CE_WARN, __VA_ARGS__)
  52 
  53 #ifndef SEEK_SET
  54 #define SEEK_SET        0
  55 #endif
  56 #ifndef SEEK_CUR
  57 #define SEEK_CUR        1
  58 #endif
  59 #ifndef SEEK_END
  60 #define SEEK_END        2
  61 #endif
  62 
  63 /*
  64  * Maximum offset supported by NLM calls using the older
  65  * (32-bit) versions of the protocol.
  66  */
  67 #define MAX_UOFF32      0xffffffffULL


 512 int nlm_svc_starting(struct nlm_globals *, struct file *,
 513     const char *, struct knetconfig *);
 514 void nlm_svc_stopping(struct nlm_globals *);
 515 int nlm_svc_add_ep(struct file *, const char *, struct knetconfig *);
 516 
 517 /*
 518  * NLM suspend/resume
 519  */
 520 void nlm_cprsuspend(void);
 521 void nlm_cprresume(void);
 522 
 523 /*
 524  * NLM internal functions for initialization.
 525  */
 526 void nlm_init(void);
 527 void nlm_rpc_init(void);
 528 void nlm_rpc_cache_destroy(struct nlm_host *);
 529 void nlm_globals_register(struct nlm_globals *);
 530 void nlm_globals_unregister(struct nlm_globals *);
 531 sysid_t nlm_sysid_alloc(void);

 532 
 533 /*
 534  * Client reclamation/cancelation
 535  */
 536 void nlm_reclaim_client(struct nlm_globals *, struct nlm_host *);
 537 void nlm_client_cancel_all(struct nlm_globals *, struct nlm_host *);
 538 
 539 /* (nlm_rpc_clnt.c) */
 540 enum clnt_stat nlm_null_rpc(CLIENT *, rpcvers_t);
 541 enum clnt_stat nlm_test_rpc(nlm4_testargs *, nlm4_testres *,
 542     CLIENT *, rpcvers_t);
 543 enum clnt_stat nlm_lock_rpc(nlm4_lockargs *, nlm4_res *,
 544     CLIENT *, rpcvers_t);
 545 enum clnt_stat nlm_cancel_rpc(nlm4_cancargs *, nlm4_res *,
 546     CLIENT *, rpcvers_t);
 547 enum clnt_stat nlm_unlock_rpc(nlm4_unlockargs *, nlm4_res *,
 548     CLIENT *, rpcvers_t);
 549 enum clnt_stat nlm_share_rpc(nlm4_shareargs *, nlm4_shareres *,
 550     CLIENT *, rpcvers_t);
 551 enum clnt_stat nlm_unshare_rpc(nlm4_shareargs *, nlm4_shareres *,




  11  * 2. Redistributions in binary form must reproduce the above copyright
  12  *    notice, this list of conditions and the following disclaimer in the
  13  *    documentation and/or other materials provided with the distribution.
  14  *
  15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  25  * SUCH DAMAGE.
  26  *
  27  * $FreeBSD$
  28  */
  29 
  30 /*
  31  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  32  * Copyright (c) 2012 by Delphix. All rights reserved.
  33  */
  34 
  35 /*
  36  * NFS Lock Manager (NLM) private declarations, etc.
  37  *
  38  * Source code derived from FreeBSD nlm.h
  39  */
  40 
  41 #ifndef _NLM_NLM_H_
  42 #define _NLM_NLM_H_
  43 
  44 #include <sys/cmn_err.h>
  45 #include <sys/queue.h>
  46 #include <sys/modhash.h>
  47 #include <sys/avl.h>
  48 #include <sys/socket.h>
  49 
  50 #define RPC_MSGOUT(args...)     cmn_err(CE_NOTE, args)
  51 #define NLM_ERR(...)            cmn_err(CE_NOTE, __VA_ARGS__)
  52 #define NLM_WARN(...)           cmn_err(CE_WARN, __VA_ARGS__)
  53 
  54 #ifndef SEEK_SET
  55 #define SEEK_SET        0
  56 #endif
  57 #ifndef SEEK_CUR
  58 #define SEEK_CUR        1
  59 #endif
  60 #ifndef SEEK_END
  61 #define SEEK_END        2
  62 #endif
  63 
  64 /*
  65  * Maximum offset supported by NLM calls using the older
  66  * (32-bit) versions of the protocol.
  67  */
  68 #define MAX_UOFF32      0xffffffffULL


 513 int nlm_svc_starting(struct nlm_globals *, struct file *,
 514     const char *, struct knetconfig *);
 515 void nlm_svc_stopping(struct nlm_globals *);
 516 int nlm_svc_add_ep(struct file *, const char *, struct knetconfig *);
 517 
 518 /*
 519  * NLM suspend/resume
 520  */
 521 void nlm_cprsuspend(void);
 522 void nlm_cprresume(void);
 523 
 524 /*
 525  * NLM internal functions for initialization.
 526  */
 527 void nlm_init(void);
 528 void nlm_rpc_init(void);
 529 void nlm_rpc_cache_destroy(struct nlm_host *);
 530 void nlm_globals_register(struct nlm_globals *);
 531 void nlm_globals_unregister(struct nlm_globals *);
 532 sysid_t nlm_sysid_alloc(void);
 533 int nlm_sysid_to_host(zoneid_t, sysid_t, struct sockaddr *, const char **);
 534 
 535 /*
 536  * Client reclamation/cancelation
 537  */
 538 void nlm_reclaim_client(struct nlm_globals *, struct nlm_host *);
 539 void nlm_client_cancel_all(struct nlm_globals *, struct nlm_host *);
 540 
 541 /* (nlm_rpc_clnt.c) */
 542 enum clnt_stat nlm_null_rpc(CLIENT *, rpcvers_t);
 543 enum clnt_stat nlm_test_rpc(nlm4_testargs *, nlm4_testres *,
 544     CLIENT *, rpcvers_t);
 545 enum clnt_stat nlm_lock_rpc(nlm4_lockargs *, nlm4_res *,
 546     CLIENT *, rpcvers_t);
 547 enum clnt_stat nlm_cancel_rpc(nlm4_cancargs *, nlm4_res *,
 548     CLIENT *, rpcvers_t);
 549 enum clnt_stat nlm_unlock_rpc(nlm4_unlockargs *, nlm4_res *,
 550     CLIENT *, rpcvers_t);
 551 enum clnt_stat nlm_share_rpc(nlm4_shareargs *, nlm4_shareres *,
 552     CLIENT *, rpcvers_t);
 553 enum clnt_stat nlm_unshare_rpc(nlm4_shareargs *, nlm4_shareres *,