1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
/*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy is of the CDDL is also available via the Internet
* at http://www.illumos.org/license/CDDL.
*/
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
*/
/*
* NFS Lock Manager, client-side
* Note: depends on (links with) klmmod
*
* This file contains all the external entry points of klmops.
* Basically, this is the "glue" to the BSD nlm code.
*/
#include <sys/types.h>
#include <sys/errno.h>
#include <sys/modctl.h>
#include <sys/flock.h>
#include <nfs/lm.h>
#include <rpcsvc/nlm_prot.h>
#include "nlm_impl.h"
static struct modlmisc modlmisc = {
&mod_miscops, "lock mgr calls"
};
static struct modlinkage modlinkage = {
MODREV_1, &modlmisc, NULL
};
/*
* ****************************************************************
* module init, fini, info
*/
int
_init()
{
return (mod_install(&modlinkage));
}
int
_fini()
{
/* Don't unload. */
return (EBUSY);
}
int
_info(struct modinfo *modinfop)
{
return (mod_info(&modlinkage, modinfop));
}
/*
* ****************************************************************
* Stubs listed in modstubs.s
* These are called from fs/nfs
*/
/*
* NFSv2 lock/unlock. Called by nfs_frlock()
* Uses NLM version 1 (NLM_VERS)
*/
int
lm_frlock(struct vnode *vp, int cmd, struct flock64 *flk, int flags,
u_offset_t off, struct cred *cr, struct netobj *fh,
struct flk_callback *flcb)
{
return (nlm_frlock(vp, cmd, flk, flags, off,
cr, fh, flcb, NLM_VERS));
}
/*
* NFSv3 lock/unlock. Called by nfs3_frlock()
* Uses NLM version 4 (NLM4_VERS)
*/
int
lm4_frlock(struct vnode *vp, int cmd, struct flock64 *flk, int flags,
u_offset_t off, struct cred *cr, struct netobj *fh,
struct flk_callback *flcb)
{
int err;
err = nlm_frlock(vp, cmd, flk, flags, off,
cr, fh, flcb, NLM4_VERS);
return (err);
}
/*
* NFSv2 shrlk/unshrlk. See nfs_shrlock
* Uses NLM version 3 (NLM_VERSX)
*/
int
lm_shrlock(struct vnode *vp, int cmd,
struct shrlock *shr, int flags, struct netobj *fh)
{
return (nlm_shrlock(vp, cmd, shr, flags, fh, NLM_VERSX));
}
/*
* NFSv3 shrlk/unshrlk. See nfs3_shrlock
* Uses NLM version 4 (NLM4_VERS)
*/
int
lm4_shrlock(struct vnode *vp, int cmd,
struct shrlock *shr, int flags, struct netobj *fh)
{
return (nlm_shrlock(vp, cmd, shr, flags, fh, NLM4_VERS));
}
/*
* Helper for nfs_lockrelease.
*/
void
lm_register_lock_locally(struct vnode *vp, struct lm_sysid *ls,
struct flock64 *flk, int flags, u_offset_t offset)
{
nlm_register_lock_locally(vp, (struct nlm_host *)ls,
flk, flags, offset);
}
/*
* Old RPC service dispatch functions, no longer used.
* Here only to satisfy modstubs.s references.
*/
void
lm_nlm_dispatch(struct svc_req *req, SVCXPRT *xprt)
{
_NOTE(ARGUNUSED(req, xprt))
}
void
lm_nlm4_dispatch(struct svc_req *req, SVCXPRT *xprt)
{
_NOTE(ARGUNUSED(req, xprt))
}
/*
* Old internal functions used for reclaiming locks
* our NFS client holds after some server restarts.
* The new NLM code does this differently, so these
* are here only to satisfy modstubs.s references.
*/
void
lm_nlm_reclaim(struct vnode *vp, struct flock64 *flkp)
{
_NOTE(ARGUNUSED(vp, flkp))
}
void
lm_nlm4_reclaim(struct vnode *vp, struct flock64 *flkp)
{
_NOTE(ARGUNUSED(vp, flkp))
}
|