kern/126561: NLM (rpclockd) RPC UNLOCK failure (stalls Mac OS X
Finder, iTunes, etc?)
Richard S. Conto
Richard.Conto at gmail.com
Sat Aug 16 02:50:02 UTC 2008
>Number: 126561
>Category: kern
>Synopsis: NLM (rpclockd) RPC UNLOCK failure (stalls Mac OS X Finder, iTunes, etc?)
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sat Aug 16 02:50:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator: Richard S. Conto
>Release: 7.0
>Organization:
(un)employed at Home
>Environment:
FreeBSD toolbox.family 7.0-STABLE FreeBSD 7.0-STABLE #0: Fri Aug 15 21:06:19 EDT 2008 rsc at toolbox.family:/usr/src/sys/i386/compile/TOOLBOX i386
>Description:
Attempts to remove a lock (UNLOCK) a file mounted on a FreeBSD 7.0 server fail, with repeated messages from the NFS client such as "host:/filesystem not responding" or "nfs server host:/filesystem: lockd not responding"
If the client is Mac OS X 10.5.x, this can cause the `Finder' to hang when viewing a folder (directory) mounted on a FreeBSD 7.0 NFS server. This can also cause `iTunes' to hang if it's folder is located on a FreeBSD 7.0 NFS server.
Using "wireshark" to monitor the NLM exchange between the FreeBSD 7.0 NFS server and the client, it is clear that when the client use a NLM RPC UNLOCK call, no response is issued by the NFS server.
>How-To-Repeat:
Requirements:
FreeBSD 7.0 NFS server, "rpc_lockd_enable=YES" in /etc/rc.conf
Mac OS X 10.5 with NFS mounts specified using the "Directory Utility"
.. if possible, test the Mac OS X configuration against an "old" (prior to 8/1/2008) version of FreeBSD 7.0, then upgrade to current.
Use `Finder' to open a NFS mounted directory/folder owned by the user. NOTE: This leaves the `Finder' in a slightly unstable state, unable to "logout" or "shutdown". Use a Force-Quit to kill the finder.
>Fix:
The MINIMAL fix is a simple one-line patch. However, I have a more extensive patch that includes instrumentation to be included since the existing debugging instrumentation is incomplete.
*** nlm_prot_server.c Tue Aug 5 06:35:51 2008
--- nlm_prot_server.c.new Fri Aug 15 22:43:00 2008
***************
*** 611,616 ****
--- 611,618 ----
char dummy;
if (nlm_do_unlock(argp, &res4, rqstp, &rpc))
+ return (FALSE)
+
if (rpc) {
nlm4_unlock_res_4(&res4, &dummy, rpc, NULL, nlm_zero_tv);
CLNT_RELEASE(rpc);
Patch attached with submission follows:
Only in src/sys/nlm/: #nlm.h#
Only in src/sys/nlm/: TAGS
diff -r -c -b -w src/sys/nlm/nlm_prot_impl.c dist/src/sys/nlm/nlm_prot_impl.c
*** src/sys/nlm/nlm_prot_impl.c Fri Aug 15 12:05:11 2008
--- dist/src/sys/nlm/nlm_prot_impl.c Tue Aug 5 06:35:51 2008
***************
*** 75,94 ****
*/
#define NLM_IDLE_PERIOD 5
-
- /*
- * We can't hold onto RPC handles for too long - the async
- * call/reply protocol used by some NLM clients makes it hard
- * to tell when they change port numbers (e.g. after a
- * reboot). Note that if a client reboots while it isn't
- * holding any locks, it won't bother to notify us. We
- * expire the RPC handles after two minutes.
- */
-
- #define NLM_RPC_CREATE_HOLD_TIME 120
-
- #define NLM_RPC_TIMEOUT 25
-
/*
* Support for sysctl vfs.nlm.sysid
*/
--- 75,80 ----
***************
*** 114,120 ****
* Debug level passed in from userland. We also support a sysctl hook
* so that it can be changed on a live system.
*/
! int nlm_debug_level;
SYSCTL_INT(_debug, OID_AUTO, nlm_debug, CTLFLAG_RW, &nlm_debug_level, 0, "");
/*
--- 100,106 ----
* Debug level passed in from userland. We also support a sysctl hook
* so that it can be changed on a live system.
*/
! static int nlm_debug_level;
SYSCTL_INT(_debug, OID_AUTO, nlm_debug, CTLFLAG_RW, &nlm_debug_level, 0, "");
/*
***************
*** 122,131 ****
* value of time_uptime after which we are serving requests normally.
*/
static time_t nlm_grace_threshold;
! static unsigned int nlm_idle_timeout = NLM_IDLE_TIMEOUT;
! static unsigned int nlm_idle_period = NLM_IDLE_PERIOD;
! static unsigned int nlm_rpc_create_hold_time = NLM_RPC_CREATE_HOLD_TIME;
! static unsigned int nlm_rpc_timeout = NLM_RPC_TIMEOUT;
/*
* We check for idle hosts if time_uptime is greater than
* nlm_next_idle_check,
--- 108,114 ----
* value of time_uptime after which we are serving requests normally.
*/
static time_t nlm_grace_threshold;
!
/*
* We check for idle hosts if time_uptime is greater than
* nlm_next_idle_check,
***************
*** 147,168 ****
#endif
/*
- * SYSCTL's in alphabetic order.
- */
-
- SYSCTL_UINT(_vfs_nlm, OID_AUTO, rpc_timeout, CTLFLAG_RW, &nlm_rpc_timeout, 0, "");
- SYSCTL_UINT(_vfs_nlm, OID_AUTO, rpc_create_hold_time, CTLFLAG_RW,
- &nlm_rpc_create_hold_time, 0, "");
- SYSCTL_UINT(_vfs_nlm, OID_AUTO, next_idle_check, CTLFLAG_RD,
- &nlm_next_idle_check, 0, "NLM idle host check");
- SYSCTL_UINT(_vfs_nlm, OID_AUTO, idle_timeout, CTLFLAG_RW,
- &nlm_idle_timeout, 0, "");
- SYSCTL_UINT(_vfs_nlm, OID_AUTO, idle_period, CTLFLAG_RW, &nlm_idle_period, 0, "");
- SYSCTL_UINT(_vfs_nlm, OID_AUTO, grace_threshold, CTLFLAG_RD,
- &nlm_grace_threshold, 0, "NLM grace handling period");
-
-
- /*
* An RPC client handle that can be used to communicate with the local
* NSM.
*/
--- 130,135 ----
***************
*** 261,268 ****
static struct nlm_host_list nlm_hosts; /* (g) */
static uint32_t nlm_next_sysid = 1; /* (g) */
- static void nlm_host_get(struct nlm_host *);
-
static void nlm_host_unmonitor(struct nlm_host *);
/**********************************************************************/
--- 228,233 ----
***************
*** 370,376 ****
/*
* Use the default timeout.
*/
! timo.tv_sec = nlm_rpc_timeout;
timo.tv_usec = 0;
again:
uaddr = NULL;
--- 335,341 ----
/*
* Use the default timeout.
*/
! timo.tv_sec = 25;
timo.tv_usec = 0;
again:
uaddr = NULL;
***************
*** 429,437 ****
(xdrproc_t) xdr_u_short, &port, timo);
if (stat == RPC_SUCCESS) {
- if (nlm_debug_level >= 1)
- printf("NLM: Using RPC port %u\n", port);
-
switch (ss.ss_family) {
case AF_INET:
((struct sockaddr_in *)&ss)->sin_port =
--- 394,399 ----
***************
*** 623,632 ****
TAILQ_REMOVE(&nlm_hosts, host, nh_link);
mtx_unlock(&nlm_global_lock);
- if (nlm_debug_level >= 4)
- printf ("NLM: destroy host %s (sysid %d)\n",
- host->nh_caller_name, host->nh_sysid);
-
if (host->nh_rpc)
CLNT_RELEASE(host->nh_rpc);
mtx_destroy(&host->nh_lock);
--- 585,590 ----
***************
*** 668,674 ****
static void
nlm_host_notify(struct nlm_host *host, int newstate)
{
- unsigned int count;
struct nlm_async_lock *af;
if (newstate) {
--- 626,631 ----
***************
*** 681,687 ****
/*
* Cancel any pending async locks for this host.
*/
- count = 0;
mtx_lock(&host->nh_lock);
while ((af = TAILQ_FIRST(&host->nh_pending)) != NULL) {
/*
--- 638,643 ----
***************
*** 689,704 ****
* nh_pending and free it.
*/
nlm_cancel_async_lock(af);
- count ++;
}
mtx_unlock(&host->nh_lock);
nlm_free_finished_locks(host);
- if ((count > 0) && (nlm_debug_level >= 4)) {
- printf ("NLM: host %s (sysid %d) - %d pending locks cleared",
- host->nh_caller_name, host->nh_sysid, count);
- }
-
/*
* The host just rebooted - trash its locks.
*/
--- 645,654 ----
***************
*** 714,720 ****
&& host->nh_monstate != NLM_RECOVERING
&& lf_countlocks(NLM_SYSID_CLIENT | host->nh_sysid) > 0) {
host->nh_monstate = NLM_RECOVERING;
! nlm_host_get(host);
kthread_create(nlm_client_recovery_start, host, NULL, 0, 0,
"NFS lock recovery for %s", host->nh_caller_name);
}
--- 664,670 ----
&& host->nh_monstate != NLM_RECOVERING
&& lf_countlocks(NLM_SYSID_CLIENT | host->nh_sysid) > 0) {
host->nh_monstate = NLM_RECOVERING;
! refcount_acquire(&host->nh_refs);
kthread_create(nlm_client_recovery_start, host, NULL, 0, 0,
"NFS lock recovery for %s", host->nh_caller_name);
}
***************
*** 785,817 ****
oid = SYSCTL_ADD_NODE(&host->nh_sysctl,
SYSCTL_STATIC_CHILDREN(_vfs_nlm_sysid),
OID_AUTO, host->nh_sysid_string, CTLFLAG_RD, NULL, "");
-
SYSCTL_ADD_STRING(&host->nh_sysctl, SYSCTL_CHILDREN(oid), OID_AUTO,
"hostname", CTLFLAG_RD, host->nh_caller_name, 0, "");
-
SYSCTL_ADD_INT(&host->nh_sysctl, SYSCTL_CHILDREN(oid), OID_AUTO,
"version", CTLFLAG_RD, &host->nh_vers, 0, "");
-
SYSCTL_ADD_INT(&host->nh_sysctl, SYSCTL_CHILDREN(oid), OID_AUTO,
! "monitored", CTLFLAG_RD, &host->nh_monstate, 0, "Local monitoring state");
!
! SYSCTL_ADD_INT(&host->nh_sysctl, SYSCTL_CHILDREN(oid), OID_AUTO,
! "state", CTLFLAG_RD, &host->nh_state, 0, "Last seen state");
!
SYSCTL_ADD_PROC(&host->nh_sysctl, SYSCTL_CHILDREN(oid), OID_AUTO,
"lock_count", CTLTYPE_INT | CTLFLAG_RD, host, 0,
nlm_host_lock_count_sysctl, "I", "");
-
SYSCTL_ADD_PROC(&host->nh_sysctl, SYSCTL_CHILDREN(oid), OID_AUTO,
"client_lock_count", CTLTYPE_INT | CTLFLAG_RD, host, 0,
nlm_host_client_lock_count_sysctl, "I", "");
- SYSCTL_ADD_UINT(&host->nh_sysctl, SYSCTL_CHILDREN(oid), OID_AUTO,
- "idle_timeout", CTLFLAG_RD, &host->nh_idle_timeout, 0, "");
-
- SYSCTL_ADD_UINT(&host->nh_sysctl, SYSCTL_CHILDREN(oid), OID_AUTO,
- "create_time", CTLFLAG_RD, &host->nh_rpc_create_time, 0, "");
-
mtx_lock(&nlm_global_lock);
return (host);
--- 735,753 ----
oid = SYSCTL_ADD_NODE(&host->nh_sysctl,
SYSCTL_STATIC_CHILDREN(_vfs_nlm_sysid),
OID_AUTO, host->nh_sysid_string, CTLFLAG_RD, NULL, "");
SYSCTL_ADD_STRING(&host->nh_sysctl, SYSCTL_CHILDREN(oid), OID_AUTO,
"hostname", CTLFLAG_RD, host->nh_caller_name, 0, "");
SYSCTL_ADD_INT(&host->nh_sysctl, SYSCTL_CHILDREN(oid), OID_AUTO,
"version", CTLFLAG_RD, &host->nh_vers, 0, "");
SYSCTL_ADD_INT(&host->nh_sysctl, SYSCTL_CHILDREN(oid), OID_AUTO,
! "monitored", CTLFLAG_RD, &host->nh_monstate, 0, "");
SYSCTL_ADD_PROC(&host->nh_sysctl, SYSCTL_CHILDREN(oid), OID_AUTO,
"lock_count", CTLTYPE_INT | CTLFLAG_RD, host, 0,
nlm_host_lock_count_sysctl, "I", "");
SYSCTL_ADD_PROC(&host->nh_sysctl, SYSCTL_CHILDREN(oid), OID_AUTO,
"client_lock_count", CTLTYPE_INT | CTLFLAG_RD, host, 0,
nlm_host_client_lock_count_sysctl, "I", "");
mtx_lock(&nlm_global_lock);
return (host);
***************
*** 866,872 ****
if (time_uptime <= nlm_next_idle_check)
return;
! nlm_next_idle_check = time_uptime + nlm_idle_period;
TAILQ_FOREACH(host, &nlm_hosts, nh_link) {
if (host->nh_monstate == NLM_MONITORED
--- 802,808 ----
if (time_uptime <= nlm_next_idle_check)
return;
! nlm_next_idle_check = time_uptime + NLM_IDLE_PERIOD;
TAILQ_FOREACH(host, &nlm_hosts, nh_link) {
if (host->nh_monstate == NLM_MONITORED
***************
*** 876,882 ****
|| lf_countlocks(NLM_SYSID_CLIENT
+ host->nh_sysid)) {
host->nh_idle_timeout =
! time_uptime + nlm_idle_timeout;
mtx_lock(&nlm_global_lock);
continue;
}
--- 812,818 ----
|| lf_countlocks(NLM_SYSID_CLIENT
+ host->nh_sysid)) {
host->nh_idle_timeout =
! time_uptime + NLM_IDLE_TIMEOUT;
mtx_lock(&nlm_global_lock);
continue;
}
***************
*** 917,925 ****
return (NULL);
}
}
! nlm_host_get(host);
! host->nh_idle_timeout = time_uptime + nlm_idle_timeout;
/*
* If we have an address for the host, record it so that we
--- 853,861 ----
return (NULL);
}
}
! refcount_acquire(&host->nh_refs);
! host->nh_idle_timeout = time_uptime + NLM_IDLE_TIMEOUT;
/*
* If we have an address for the host, record it so that we
***************
*** 1015,1023 ****
memcpy(&host->nh_addr, addr, addr->sa_len);
host->nh_vers = vers;
}
! nlm_host_get(host);
! host->nh_idle_timeout = time_uptime + nlm_idle_timeout;
nlm_check_idle();
--- 951,959 ----
memcpy(&host->nh_addr, addr, addr->sa_len);
host->nh_vers = vers;
}
! refcount_acquire(&host->nh_refs);
! host->nh_idle_timeout = time_uptime + NLM_IDLE_TIMEOUT;
nlm_check_idle();
***************
*** 1037,1043 ****
TAILQ_FOREACH(host, &nlm_hosts, nh_link) {
if (host->nh_sysid == sysid) {
! nlm_host_get(host);
return (host);
}
}
--- 973,979 ----
TAILQ_FOREACH(host, &nlm_hosts, nh_link) {
if (host->nh_sysid == sysid) {
! refcount_acquire(&host->nh_refs);
return (host);
}
}
***************
*** 1045,1084 ****
return (NULL);
}
- /*
- * nlm_host_get()
- *
- * Update refcount in HOST.
- *
- * Inverse of nlm_host_release()
- */
-
- static void nlm_host_get(struct nlm_host *host)
- {
- if (nlm_debug_level >= 6)
- printf("nlm_host_get(): host %s (sysid %d)\n",
- host->nh_caller_name, host->nh_sysid);
-
- refcount_acquire(&host->nh_refs);
-
- return;
- }
-
-
- /*
- * nlm_host_release()
- *
- * Update refcount of HOST, destroy if refcount goes to 0.
- *
- * inverse of nlm_host_get()
- */
-
void nlm_host_release(struct nlm_host *host)
{
- if (nlm_debug_level >= 6)
- printf("nlm_host_release(): host %s (sysid %d)\n",
- host->nh_caller_name, host->nh_sysid);
-
if (refcount_release(&host->nh_refs)) {
/*
* Free the host
--- 981,988 ----
***************
*** 1113,1119 ****
smmonid.my_id.my_vers = NLM_SM;
smmonid.my_id.my_proc = NLM_SM_NOTIFY;
! timo.tv_sec = nlm_rpc_timeout;
timo.tv_usec = 0;
stat = CLNT_CALL(nlm_nsm, SM_UNMON,
(xdrproc_t) xdr_mon, &smmonid,
--- 1017,1023 ----
smmonid.my_id.my_vers = NLM_SM;
smmonid.my_id.my_proc = NLM_SM_NOTIFY;
! timo.tv_sec = 25;
timo.tv_usec = 0;
stat = CLNT_CALL(nlm_nsm, SM_UNMON,
(xdrproc_t) xdr_mon, &smmonid,
***************
*** 1180,1186 ****
smmon.mon_id.my_id.my_proc = NLM_SM_NOTIFY;
memcpy(smmon.priv, &host->nh_sysid, sizeof(host->nh_sysid));
! timo.tv_sec = nlm_rpc_timeout;
timo.tv_usec = 0;
stat = CLNT_CALL(nlm_nsm, SM_MON,
(xdrproc_t) xdr_mon, &smmon,
--- 1084,1090 ----
smmon.mon_id.my_id.my_proc = NLM_SM_NOTIFY;
memcpy(smmon.priv, &host->nh_sysid, sizeof(host->nh_sysid));
! timo.tv_sec = 25;
timo.tv_usec = 0;
stat = CLNT_CALL(nlm_nsm, SM_MON,
(xdrproc_t) xdr_mon, &smmon,
***************
*** 1221,1227 ****
* holding any locks, it won't bother to notify us. We
* expire the RPC handles after two minutes.
*/
! if (host->nh_rpc && time_uptime > host->nh_rpc_create_time + nlm_rpc_create_hold_time) {
client = host->nh_rpc;
host->nh_rpc = NULL;
mtx_unlock(&host->nh_lock);
--- 1125,1131 ----
* holding any locks, it won't bother to notify us. We
* expire the RPC handles after two minutes.
*/
! if (host->nh_rpc && time_uptime > host->nh_rpc_create_time + 2*60) {
client = host->nh_rpc;
host->nh_rpc = NULL;
mtx_unlock(&host->nh_lock);
***************
*** 1252,1262 ****
CLNT_ACQUIRE(client);
mtx_unlock(&host->nh_lock);
- if (nlm_debug_level >= 4) {
- printf ("NLM: caller = %s (sysid %d), client %p\n",
- host->nh_caller_name, host->nh_sysid, client);
- }
-
return (client);
}
--- 1156,1161 ----
***************
*** 1560,1566 ****
memset(&id, 0, sizeof(id));
id.my_name = "NFS NLM";
! timo.tv_sec = nlm_rpc_timeout;
timo.tv_usec = 0;
stat = CLNT_CALL(nlm_nsm, SM_UNMON_ALL,
(xdrproc_t) xdr_my_id, &id,
--- 1459,1465 ----
memset(&id, 0, sizeof(id));
id.my_name = "NFS NLM";
! timo.tv_sec = 25;
timo.tv_usec = 0;
stat = CLNT_CALL(nlm_nsm, SM_UNMON_ALL,
(xdrproc_t) xdr_my_id, &id,
***************
*** 1578,1584 ****
if (nlm_debug_level >= 1)
printf("NLM: local NSM state is %d\n", smstat.state);
-
nlm_nsm_state = smstat.state;
old_nfs_advlock = nfs_advlock_p;
--- 1477,1482 ----
***************
*** 1682,1688 ****
nlm_debug_level = uap->debug_level;
nlm_grace_threshold = time_uptime + uap->grace_period;
! nlm_next_idle_check = time_uptime + nlm_idle_period;
return nlm_server_main(uap->addr_count, uap->addrs);
}
--- 1580,1586 ----
nlm_debug_level = uap->debug_level;
nlm_grace_threshold = time_uptime + uap->grace_period;
! nlm_next_idle_check = time_uptime + NLM_IDLE_PERIOD;
return nlm_server_main(uap->addr_count, uap->addrs);
}
***************
*** 1735,1815 ****
vs->vs_mp = vfs_getvfs(&fhp->fh_fsid);
if (!vs->vs_mp) {
- printf ("NLM: file handle fsid %x:%x STALE, caller = %s (sysid %d)\n",
- fhp->fh_fsid.val[0], fhp->fh_fsid.val[1], host->nh_caller_name,
- host->nh_sysid);
return (ESTALE);
}
-
- if (nlm_debug_level >= 5) {
- printf ("NLM: file handle fsid %x:%x - vfs (name='%s', type=%d), caller = %s (sysid %d)\n",
- fhp->fh_fsid.val[0], fhp->fh_fsid.val[1],
- vs->vs_mp->mnt_vfc->vfc_name,
- vs->vs_mp->mnt_vfc->vfc_typenum,
- host->nh_caller_name, host->nh_sysid);
- }
-
vs->vs_vfslocked = VFS_LOCK_GIANT(vs->vs_mp);
error = VFS_CHECKEXP(vs->vs_mp, (struct sockaddr *)&host->nh_addr,
&exflags, &credanon);
! if (error) {
! printf ("NLM: file handle fsid %x:%x VFS_CHECKEXP() failed, error %d, "
! "caller = %s (sysid %d)\n",
! fhp->fh_fsid.val[0], fhp->fh_fsid.val[1], error,
! host->nh_caller_name, host->nh_sysid);
goto out;
- }
if (exflags & MNT_EXRDONLY || (vs->vs_mp->mnt_flag & MNT_RDONLY)) {
- printf ("NLM: file handle fsid %x:%x RDONLY, caller = %s (sysid %d)\n",
- fhp->fh_fsid.val[0], fhp->fh_fsid.val[1],
- host->nh_caller_name, host->nh_sysid);
error = EROFS;
goto out;
}
error = VFS_FHTOVP(vs->vs_mp, &fhp->fh_fid, &vs->vs_vp);
! if (error) {
! printf ("NLM: file handle fsid %x:%x VFS_FHTOVP() failed %d, caller = %s (sysid %d)\n",
! fhp->fh_fsid.val[0], fhp->fh_fsid.val[1], error,
! host->nh_caller_name, host->nh_sysid);
goto out;
- }
-
vs->vs_vnlocked = TRUE;
cred = crget();
freecred = TRUE;
if (!svc_getcred(rqstp, cred, NULL)) {
error = EINVAL;
- printf ("nlm_get_vfs_state(): file handle fsid %x:%x - svc_getcred() failed, "
- "caller %s (sysid %d)\n", fhp->fh_fsid.val[0], fhp->fh_fsid.val[1],
- host->nh_caller_name, host->nh_sysid);
goto out;
}
if (cred->cr_uid == 0 || (exflags & MNT_EXPORTANON)) {
crfree(cred);
cred = credanon;
freecred = FALSE;
- printf("nlm_get_vfs_state(): file handle fsid %x:%x - `cred' becomes anonymous, "
- "caller = %s (sysid %d)\n", fhp->fh_fsid.val[0], fhp->fh_fsid.val[1],
- host->nh_caller_name, host->nh_sysid);
}
/*
* Check cred.
*/
error = VOP_ACCESS(vs->vs_vp, VWRITE, cred, curthread);
! if (error) {
! printf("nlm_get_vfs_state(): file handle fsid %x:%x, "
! "VOP_ACCESS(..,VWRITE, {uid=%u,ruid=%u,cvuid=%u,...}, ...) "
! "failed %d, caller = %s (sysid %d)\n",
! fhp->fh_fsid.val[0], fhp->fh_fsid.val[1], cred->cr_uid,
! cred->cr_ruid, cred->cr_svuid, error, host->nh_caller_name,
! host->nh_sysid);
goto out;
- }
#if __FreeBSD_version < 800011
VOP_UNLOCK(vs->vs_vp, 0, curthread);
--- 1633,1675 ----
vs->vs_mp = vfs_getvfs(&fhp->fh_fsid);
if (!vs->vs_mp) {
return (ESTALE);
}
vs->vs_vfslocked = VFS_LOCK_GIANT(vs->vs_mp);
error = VFS_CHECKEXP(vs->vs_mp, (struct sockaddr *)&host->nh_addr,
&exflags, &credanon);
! if (error)
goto out;
if (exflags & MNT_EXRDONLY || (vs->vs_mp->mnt_flag & MNT_RDONLY)) {
error = EROFS;
goto out;
}
error = VFS_FHTOVP(vs->vs_mp, &fhp->fh_fid, &vs->vs_vp);
! if (error)
goto out;
vs->vs_vnlocked = TRUE;
cred = crget();
freecred = TRUE;
if (!svc_getcred(rqstp, cred, NULL)) {
error = EINVAL;
goto out;
}
if (cred->cr_uid == 0 || (exflags & MNT_EXPORTANON)) {
crfree(cred);
cred = credanon;
freecred = FALSE;
}
/*
* Check cred.
*/
error = VOP_ACCESS(vs->vs_vp, VWRITE, cred, curthread);
! if (error)
goto out;
#if __FreeBSD_version < 800011
VOP_UNLOCK(vs->vs_vp, 0, curthread);
***************
*** 1822,1834 ****
if (freecred)
crfree(cred);
- if (error && nlm_debug_level >= 4)
- {
- printf ("nlm_get_vfs_state(): caller = %s (sysid %d), fsid %x:%x, error=%d\n",
- host->nh_caller_name, host->nh_sysid,
- fhp->fh_fsid.val[0], fhp->fh_fsid.val[1], error);
- }
-
return (error);
}
--- 1682,1687 ----
***************
*** 1880,1886 ****
}
if (nlm_debug_level >= 3)
! printf("nlm_do_test(): caller_name = %s (sysid %d)\n",
host->nh_caller_name, host->nh_sysid);
nlm_free_finished_locks(host);
--- 1733,1739 ----
}
if (nlm_debug_level >= 3)
! printf("nlm_do_test(): caller_name = %s (sysid = %d)\n",
host->nh_caller_name, host->nh_sysid);
nlm_free_finished_locks(host);
***************
*** 1949,1960 ****
}
out:
- if ((result->stat.stat != nlm4_granted) && (nlm_debug_level >= 4)) {
- printf ("nlm_do_test(): NLM status %d, host %s (sysid %d)\n",
- result->stat.stat, host->nh_caller_name,
- host->nh_sysid);
- }
-
nlm_release_vfs_state(&vs);
if (rpcp)
*rpcp = nlm_host_get_rpc(host);
--- 1802,1807 ----
***************
*** 1983,1989 ****
}
if (nlm_debug_level >= 3)
! printf("nlm_do_lock(): caller_name = %s (sysid %d)\n",
host->nh_caller_name, host->nh_sysid);
if (monitor && host->nh_state && argp->state
--- 1830,1836 ----
}
if (nlm_debug_level >= 3)
! printf("nlm_do_lock(): caller_name = %s (sysid = %d)\n",
host->nh_caller_name, host->nh_sysid);
if (monitor && host->nh_state && argp->state
***************
*** 2138,2150 ****
}
out:
- if ((result->stat.stat != nlm4_granted) && (nlm_debug_level >= 4)) {
- printf ("nlm_do_lock(): NLM status %d, host %s (sysid %d)\n",
- result->stat.stat, host->nh_caller_name,
- host->nh_sysid);
-
- }
-
nlm_release_vfs_state(&vs);
if (rpcp)
*rpcp = nlm_host_get_rpc(host);
--- 1985,1990 ----
***************
*** 2174,2180 ****
}
if (nlm_debug_level >= 3)
! printf("nlm_do_cancel(): caller_name = %s (sysid %d)\n",
host->nh_caller_name, host->nh_sysid);
nlm_free_finished_locks(host);
--- 2014,2020 ----
}
if (nlm_debug_level >= 3)
! printf("nlm_do_cancel(): caller_name = %s (sysid = %d)\n",
host->nh_caller_name, host->nh_sysid);
nlm_free_finished_locks(host);
***************
*** 2236,2247 ****
mtx_unlock(&host->nh_lock);
out:
- if ((result->stat.stat != nlm4_granted) && (nlm_debug_level >= 4)) {
- printf ("nlm_do_cancel(): NLM status %d, host %s (sysid %d)\n",
- result->stat.stat, host->nh_caller_name,
- host->nh_sysid);
- }
-
nlm_release_vfs_state(&vs);
if (rpcp)
*rpcp = nlm_host_get_rpc(host);
--- 2076,2081 ----
***************
*** 2270,2276 ****
}
if (nlm_debug_level >= 3)
! printf("nlm_do_unlock(): caller_name = %s (sysid %d)\n",
host->nh_caller_name, host->nh_sysid);
nlm_free_finished_locks(host);
--- 2104,2110 ----
}
if (nlm_debug_level >= 3)
! printf("nlm_do_unlock(): caller_name = %s (sysid = %d)\n",
host->nh_caller_name, host->nh_sysid);
nlm_free_finished_locks(host);
***************
*** 2305,2326 ****
result->stat.stat = nlm4_granted;
out:
- if ((result->stat.stat != nlm4_granted) && (nlm_debug_level >= 4)) {
- printf ("nlm_do_unlock(): NLM status %d, host %s (sysid %d)\n",
- result->stat.stat, host->nh_caller_name,
- host->nh_sysid);
- }
-
nlm_release_vfs_state(&vs);
if (rpcp)
*rpcp = nlm_host_get_rpc(host);
-
nlm_host_release(host);
-
return (0);
}
-
int
nlm_do_granted(nlm4_testargs *argp, nlm4_res *result, struct svc_req *rqstp,
--- 2139,2151 ----
***************
*** 2339,2348 ****
return (ENOMEM);
}
- if (nlm_debug_level >= 3)
- printf("nlm_do_granted(): caller_name = %s (sysid %d)\n",
- host->nh_caller_name, host->nh_sysid);
-
nlm_copy_netobj(&result->cookie, &argp->cookie, M_RPC);
result->stat.stat = nlm4_denied;
--- 2164,2169 ----
***************
*** 2372,2392 ****
void
nlm_do_free_all(nlm4_notify *argp)
{
- unsigned int count = 0;
struct nlm_host *host, *thost;
TAILQ_FOREACH_SAFE(host, &nlm_hosts, nh_link, thost) {
! if (!strcmp(host->nh_caller_name, argp->name)) {
nlm_host_notify(host, argp->state);
- count ++;
}
}
- if ((count > 0) && (nlm_debug_level >= 3))
- printf("nlm_do_free_all(): %d hosts freed\n", count);
-
- }
-
/*
* Kernel module glue
*/
--- 2193,2206 ----
void
nlm_do_free_all(nlm4_notify *argp)
{
struct nlm_host *host, *thost;
TAILQ_FOREACH_SAFE(host, &nlm_hosts, nh_link, thost) {
! if (!strcmp(host->nh_caller_name, argp->name))
nlm_host_notify(host, argp->state);
}
}
/*
* Kernel module glue
*/
Only in src/sys/nlm/: nlm_prot_impl.c~
diff -r -c -b -w src/sys/nlm/nlm_prot_server.c dist/src/sys/nlm/nlm_prot_server.c
*** src/sys/nlm/nlm_prot_server.c Fri Aug 15 20:43:43 2008
--- dist/src/sys/nlm/nlm_prot_server.c Tue Aug 5 06:35:51 2008
***************
*** 46,53 ****
* Convert between various versions of the protocol structures.
*/
- extern int nlm_debug_level;
-
static void
nlm_convert_to_nlm4_lock(struct nlm4_lock *dst, struct nlm_lock *src)
{
--- 46,51 ----
***************
*** 236,251 ****
nlm_testres res;
CLIENT *rpc;
char dummy;
- static char func[] = "nlm_test_msg_1_svc()";
-
- if (nlm_debug_level >= 7)
- printf("%s: entered\n", func);
args4.cookie = argp->cookie;
args4.exclusive = argp->exclusive;
nlm_convert_to_nlm4_lock(&args4.alock, &argp->alock);
! if (!nlm_do_test(&args4, &res4, rqstp, &rpc)) {
res.cookie = res4.cookie;
res.stat.stat = nlm_convert_to_nlm_stats(res4.stat.stat);
if (res.stat.stat == nlm_denied)
--- 234,247 ----
nlm_testres res;
CLIENT *rpc;
char dummy;
args4.cookie = argp->cookie;
args4.exclusive = argp->exclusive;
nlm_convert_to_nlm4_lock(&args4.alock, &argp->alock);
! if (nlm_do_test(&args4, &res4, rqstp, &rpc))
! return (FALSE);
!
res.cookie = res4.cookie;
res.stat.stat = nlm_convert_to_nlm_stats(res4.stat.stat);
if (res.stat.stat == nlm_denied)
***************
*** 256,272 ****
if (rpc) {
nlm_test_res_1(&res, &dummy, rpc, NULL, nlm_zero_tv);
CLNT_RELEASE(rpc);
- if (nlm_debug_level >= 7)
- printf("%s: resp\n", func);
- }
- else if (nlm_debug_level >= 7) {
- printf("%s: drop (no client)\n", func);
- }
- }
- else if (nlm_debug_level >= 7) {
- printf("%s: drop (error)\n", func);
}
-
xdr_free((xdrproc_t) xdr_nlm_testres, &res);
return (FALSE);
--- 252,258 ----
***************
*** 280,286 ****
nlm_res res;
CLIENT *rpc;
char dummy;
- static char func[] = "nlm_lock_msg_1_svc()";
args4.cookie = argp->cookie;
args4.block = argp->block;
--- 266,271 ----
***************
*** 289,314 ****
args4.reclaim = argp->reclaim;
args4.state = argp->state;
! if (nlm_debug_level >= 7)
! printf("%s: entered\n", func);
- if (!nlm_do_lock(&args4, &res4, rqstp, TRUE, &rpc)) {
nlm_convert_to_nlm_res(&res, &res4);
if (rpc) {
nlm_lock_res_1(&res, &dummy, rpc, NULL, nlm_zero_tv);
CLNT_RELEASE(rpc);
- if (nlm_debug_level >= 7)
- printf("%s: resp\n", func);
- }
- else if (nlm_debug_level >= 7) {
- printf("%s: drop (no client)\n", func);
- }
}
- else if (nlm_debug_level >= 7) {
- printf("%s: drop (error)\n", func);
- }
-
xdr_free((xdrproc_t) xdr_nlm_res, &res);
return (FALSE);
--- 274,288 ----
args4.reclaim = argp->reclaim;
args4.state = argp->state;
! if (nlm_do_lock(&args4, &res4, rqstp, TRUE, &rpc))
! return (FALSE);
nlm_convert_to_nlm_res(&res, &res4);
if (rpc) {
nlm_lock_res_1(&res, &dummy, rpc, NULL, nlm_zero_tv);
CLNT_RELEASE(rpc);
}
xdr_free((xdrproc_t) xdr_nlm_res, &res);
return (FALSE);
***************
*** 322,354 ****
nlm_res res;
CLIENT *rpc;
char dummy;
- static char func[] = "nlm_cancel_msg_1_svc()";
args4.cookie = argp->cookie;
args4.block = argp->block;
args4.exclusive = argp->exclusive;
nlm_convert_to_nlm4_lock(&args4.alock, &argp->alock);
! if (nlm_debug_level >= 7)
! printf("%s: entered\n", func);
- if (!nlm_do_cancel(&args4, &res4, rqstp, &rpc)) {
nlm_convert_to_nlm_res(&res, &res4);
if (rpc) {
nlm_cancel_res_1(&res, &dummy, rpc, NULL, nlm_zero_tv);
CLNT_RELEASE(rpc);
- if (nlm_debug_level >= 7)
- printf("%s: resp\n", func);
}
- else if (nlm_debug_level >= 7) {
- printf("%s: drop (no client)\n", func);
- }
- }
- else if (nlm_debug_level >= 7) {
- printf("%s: drop (error)\n", func);
- }
-
xdr_free((xdrproc_t) xdr_nlm_res, &res);
return (FALSE);
--- 296,316 ----
nlm_res res;
CLIENT *rpc;
char dummy;
args4.cookie = argp->cookie;
args4.block = argp->block;
args4.exclusive = argp->exclusive;
nlm_convert_to_nlm4_lock(&args4.alock, &argp->alock);
! if (nlm_do_cancel(&args4, &res4, rqstp, &rpc))
! return (FALSE);
nlm_convert_to_nlm_res(&res, &res4);
if (rpc) {
nlm_cancel_res_1(&res, &dummy, rpc, NULL, nlm_zero_tv);
CLNT_RELEASE(rpc);
}
xdr_free((xdrproc_t) xdr_nlm_res, &res);
return (FALSE);
***************
*** 362,393 ****
nlm_res res;
CLIENT *rpc;
char dummy;
- static char func[] = "nlm_unlock_msg_1_svc()";
args4.cookie = argp->cookie;
nlm_convert_to_nlm4_lock(&args4.alock, &argp->alock);
! if (nlm_debug_level >= 7)
! printf("%s: entered\n", func);
- if (!nlm_do_unlock(&args4, &res4, rqstp, &rpc)) {
nlm_convert_to_nlm_res(&res, &res4);
if (rpc) {
nlm_unlock_res_1(&res, &dummy, rpc, NULL, nlm_zero_tv);
CLNT_RELEASE(rpc);
-
- if (nlm_debug_level >= 7)
- printf("%s: resp\n", func);
- }
- else if (nlm_debug_level >= 7) {
- printf("%s: drop (no client)\n", func);
}
- }
- else if (nlm_debug_level >= 7) {
- printf("%s: drop (error)\n", func);
- }
-
xdr_free((xdrproc_t) xdr_nlm_res, &res);
return (FALSE);
--- 324,342 ----
nlm_res res;
CLIENT *rpc;
char dummy;
args4.cookie = argp->cookie;
nlm_convert_to_nlm4_lock(&args4.alock, &argp->alock);
! if (nlm_do_unlock(&args4, &res4, rqstp, &rpc))
! return (FALSE);
nlm_convert_to_nlm_res(&res, &res4);
if (rpc) {
nlm_unlock_res_1(&res, &dummy, rpc, NULL, nlm_zero_tv);
CLNT_RELEASE(rpc);
}
xdr_free((xdrproc_t) xdr_nlm_res, &res);
return (FALSE);
***************
*** 401,433 ****
nlm_res res;
CLIENT *rpc;
char dummy;
- static char func[] = "nlm_granted_msg_1_svc()";
args4.cookie = argp->cookie;
args4.exclusive = argp->exclusive;
nlm_convert_to_nlm4_lock(&args4.alock, &argp->alock);
! if (nlm_debug_level >= 7)
! printf("%s: entered\n", func);
- if (!nlm_do_granted(&args4, &res4, rqstp, &rpc)) {
nlm_convert_to_nlm_res(&res, &res4);
if (rpc) {
nlm_granted_res_1(&res, &dummy, rpc, NULL, nlm_zero_tv);
CLNT_RELEASE(rpc);
- if (nlm_debug_level >= 7)
- printf("%s: resp\n", func);
- }
- else if (nlm_debug_level >= 7) {
- printf("%s: drop (no client)\n", func);
- }
- }
- else if (nlm_debug_level >= 7) {
- printf("%s: drop (error)\n", func);
}
-
-
xdr_free((xdrproc_t) xdr_nlm_res, &res);
return (FALSE);
--- 350,369 ----
nlm_res res;
CLIENT *rpc;
char dummy;
args4.cookie = argp->cookie;
args4.exclusive = argp->exclusive;
nlm_convert_to_nlm4_lock(&args4.alock, &argp->alock);
! if (nlm_do_granted(&args4, &res4, rqstp, &rpc))
! return (FALSE);
nlm_convert_to_nlm_res(&res, &res4);
if (rpc) {
nlm_granted_res_1(&res, &dummy, rpc, NULL, nlm_zero_tv);
CLNT_RELEASE(rpc);
}
xdr_free((xdrproc_t) xdr_nlm_res, &res);
return (FALSE);
***************
*** 637,662 ****
nlm4_res res4;
CLIENT *rpc;
char dummy;
- char func[] = "nlm4_lock_msg_4_svc()";
! if (nlm_debug_level >= 7)
! printf("%s: entered\n", func);
!
! if (!nlm_do_lock(argp, &res4, rqstp, TRUE, &rpc)) {
if (rpc) {
nlm4_lock_res_4(&res4, &dummy, rpc, NULL, nlm_zero_tv);
CLNT_RELEASE(rpc);
- if (nlm_debug_level >= 7)
- printf("%s: resp\n", func);
- }
- else if (nlm_debug_level >= 7) {
- printf("%s: drop (no client)\n", func);
- }
- }
- else if (nlm_debug_level >= 7) {
- printf("%s: drop (error)\n", func);
}
-
xdr_free((xdrproc_t) xdr_nlm4_res, &res4);
return (FALSE);
--- 573,585 ----
nlm4_res res4;
CLIENT *rpc;
char dummy;
! if (nlm_do_lock(argp, &res4, rqstp, TRUE, &rpc))
! return (FALSE);
if (rpc) {
nlm4_lock_res_4(&res4, &dummy, rpc, NULL, nlm_zero_tv);
CLNT_RELEASE(rpc);
}
xdr_free((xdrproc_t) xdr_nlm4_res, &res4);
return (FALSE);
***************
*** 668,694 ****
nlm4_res res4;
CLIENT *rpc;
char dummy;
- static char func[] = "nlm4_camcel_msg_4_svc()";
-
- if (nlm_debug_level >= 7)
- printf("%s: entered\n", func);
! if (!nlm_do_cancel(argp, &res4, rqstp, &rpc)) {
if (rpc) {
nlm4_cancel_res_4(&res4, &dummy, rpc, NULL, nlm_zero_tv);
CLNT_RELEASE(rpc);
- if (nlm_debug_level >= 7)
- printf("%s: resp\n", func);
- }
- else if (nlm_debug_level >= 7) {
- printf("%s: drop (no client)\n", func);
}
- }
- else if (nlm_debug_level >= 7) {
- printf("%s: drop (error)\n", func);
- }
-
-
xdr_free((xdrproc_t) xdr_nlm4_res, &res4);
return (FALSE);
--- 591,603 ----
nlm4_res res4;
CLIENT *rpc;
char dummy;
! if (nlm_do_cancel(argp, &res4, rqstp, &rpc))
! return (FALSE);
if (rpc) {
nlm4_cancel_res_4(&res4, &dummy, rpc, NULL, nlm_zero_tv);
CLNT_RELEASE(rpc);
}
xdr_free((xdrproc_t) xdr_nlm4_res, &res4);
return (FALSE);
***************
*** 700,726 ****
nlm4_res res4;
CLIENT *rpc;
char dummy;
- static char func[] = "nlm4_unlock_msg_4_svc()";
-
- if (nlm_debug_level >= 7)
- printf("%s: entered\n", func);
! if (!nlm_do_unlock(argp, &res4, rqstp, &rpc)) {
if (rpc) {
nlm4_unlock_res_4(&res4, &dummy, rpc, NULL, nlm_zero_tv);
CLNT_RELEASE(rpc);
-
- if (nlm_debug_level >= 7)
- printf("%s: resp\n", func);
- }
- else if (nlm_debug_level >= 7) {
- printf("%s: drop (no client)\n", func);
}
- }
- else if (nlm_debug_level >= 7) {
- printf("%s: drop (error)\n", func);
- }
-
xdr_free((xdrproc_t) xdr_nlm4_res, &res4);
return (FALSE);
--- 609,620 ----
nlm4_res res4;
CLIENT *rpc;
char dummy;
! if (nlm_do_unlock(argp, &res4, rqstp, &rpc))
if (rpc) {
nlm4_unlock_res_4(&res4, &dummy, rpc, NULL, nlm_zero_tv);
CLNT_RELEASE(rpc);
}
xdr_free((xdrproc_t) xdr_nlm4_res, &res4);
return (FALSE);
***************
*** 732,757 ****
nlm4_res res4;
CLIENT *rpc;
char dummy;
- static char func[] = "nlm4_granted_msg_4_svc()";
! if (nlm_debug_level >= 7)
! printf("%s: entered\n", func);
!
! if (!nlm_do_granted(argp, &res4, rqstp, &rpc)) {
if (rpc) {
nlm4_granted_res_4(&res4, &dummy, rpc, NULL, nlm_zero_tv);
CLNT_RELEASE(rpc);
- if (nlm_debug_level >= 7)
- printf("%s: resp\n", func);
- }
- else if (nlm_debug_level >= 7) {
- printf("%s: drop (no client)\n", func);
}
- }
- else if (nlm_debug_level >= 7) {
- printf("%s: drop (error)\n", func);
- }
-
xdr_free((xdrproc_t) xdr_nlm4_res, &res4);
return (FALSE);
--- 626,638 ----
nlm4_res res4;
CLIENT *rpc;
char dummy;
! if (nlm_do_granted(argp, &res4, rqstp, &rpc))
! return (FALSE);
if (rpc) {
nlm4_granted_res_4(&res4, &dummy, rpc, NULL, nlm_zero_tv);
CLNT_RELEASE(rpc);
}
xdr_free((xdrproc_t) xdr_nlm4_res, &res4);
return (FALSE);
Only in src/sys/nlm/: nlm_prot_server.c~
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list