summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2005-10-27 18:35:19 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2005-10-27 18:35:19 +0000
commit020ec29a79d1359f5e14653b59cdff8515c2909e (patch)
tree76c7b96d8f047aee4969a362cee14aaef11ae0ae
parent5dd20217a6ff554ee743741e4c412b9daa143709 (diff)
Notes
-rw-r--r--sys/kern/kern_exit.c9
-rw-r--r--sys/nfsclient/nfs_lock.c16
-rw-r--r--sys/nfsclient/nlminfo.h2
-rw-r--r--sys/sys/lockf.h4
4 files changed, 24 insertions, 7 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c
index 9878546df9d0..2a113c12b500 100644
--- a/sys/kern/kern_exit.c
+++ b/sys/kern/kern_exit.c
@@ -81,6 +81,9 @@ __FBSDID("$FreeBSD$");
/* Required to be non-static for SysVR4 emulator */
MALLOC_DEFINE(M_ZOMBIE, "zombie", "zombie proc status");
+/* Hook for NFS teardown procedure. */
+void (*nlminfo_release_p)(struct proc *p);
+
/*
* exit --
* Death of process.
@@ -231,6 +234,12 @@ retry:
funsetownlst(&p->p_sigiolst);
/*
+ * If this process has an nlminfo data area (for lockd), release it
+ */
+ if (nlminfo_release_p != NULL && p->p_nlminfo != NULL)
+ (*nlminfo_release_p)(p);
+
+ /*
* Close open files and release open-file table.
* This may block!
*/
diff --git a/sys/nfsclient/nfs_lock.c b/sys/nfsclient/nfs_lock.c
index e23fd7aae86a..ec021e9d7445 100644
--- a/sys/nfsclient/nfs_lock.c
+++ b/sys/nfsclient/nfs_lock.c
@@ -62,9 +62,13 @@ __FBSDID("$FreeBSD$");
#include <nfsclient/nfs_lock.h>
#include <nfsclient/nlminfo.h>
+extern void (*nlminfo_release_p)(struct proc *p);
+
MALLOC_DEFINE(M_NFSLOCK, "NFS lock", "NFS lock request");
+MALLOC_DEFINE(M_NLMINFO, "nlminfo", "NFS lock process structure");
static int nfslockdans(struct thread *td, struct lockd_ans *ansp);
+static void nlminfo_release(struct proc *p);
/*
* --------------------------------------------------------------------
* A miniature device driver which the userland uses to talk to us.
@@ -194,6 +198,7 @@ nfslock_modevent(module_t mod __unused, int type, void *data __unused)
printf("nfslock: pseudo-device\n");
mtx_init(&nfslock_mtx, "nfslock", NULL, MTX_DEF);
TAILQ_INIT(&nfslock_list);
+ nlminfo_release_p = nlminfo_release;
nfslock_dev = make_dev(&nfslock_cdevsw, 0,
UID_ROOT, GID_KMEM, 0600, _PATH_NFSLCKDEV);
return (0);
@@ -259,7 +264,7 @@ nfs_dolock(struct vop_advlock_args *ap)
*/
if (p->p_nlminfo == NULL) {
MALLOC(p->p_nlminfo, struct nlminfo *,
- sizeof(struct nlminfo), M_LOCKF, M_WAITOK | M_ZERO);
+ sizeof(struct nlminfo), M_NLMINFO, M_WAITOK | M_ZERO);
p->p_nlminfo->pid_start = p->p_stats->p_start;
timevaladd(&p->p_nlminfo->pid_start, &boottime);
}
@@ -381,3 +386,12 @@ nfslockdans(struct thread *td, struct lockd_ans *ansp)
return (0);
}
+/*
+ * Free nlminfo attached to process.
+ */
+void
+nlminfo_release(struct proc *p)
+{
+ free(p->p_nlminfo, M_NLMINFO);
+ p->p_nlminfo = NULL;
+}
diff --git a/sys/nfsclient/nlminfo.h b/sys/nfsclient/nlminfo.h
index 3dc55b4e9a72..7d3e0ff0be9e 100644
--- a/sys/nfsclient/nlminfo.h
+++ b/sys/nfsclient/nlminfo.h
@@ -40,5 +40,3 @@ struct nlminfo {
int getlk_pid;
struct timeval pid_start; /* process starting time */
};
-
-extern void nlminfo_release(struct proc *p);
diff --git a/sys/sys/lockf.h b/sys/sys/lockf.h
index cee02da6dca4..27bb84f3381f 100644
--- a/sys/sys/lockf.h
+++ b/sys/sys/lockf.h
@@ -40,10 +40,6 @@
struct vop_advlock_args;
-#ifdef MALLOC_DECLARE
-MALLOC_DECLARE(M_LOCKF);
-#endif
-
/*
* The lockf structure is a kernel structure which contains the information
* associated with a byte range lock. The lockf structures are linked into