summaryrefslogtreecommitdiffstats
path: root/utils/mountd/mountd.c
diff options
context:
space:
mode:
authorBen Myers <bpm@sgi.com>2009-04-03 15:13:10 -0400
committerSteve Dickson <steved@redhat.com>2009-04-03 15:13:10 -0400
commitf0ed8401e854e1cbd23b2fb5dca5e88dec2df7c4 (patch)
treee525bec15e10a3c984dbc6b26b075a7433e0d417 /utils/mountd/mountd.c
parentc56152202a3000c69b87f9cb90f40166f1f21275 (diff)
downloadnfs-utils-f0ed8401e854e1cbd23b2fb5dca5e88dec2df7c4.tar.gz
nfs-utils-f0ed8401e854e1cbd23b2fb5dca5e88dec2df7c4.tar.xz
nfs-utils-f0ed8401e854e1cbd23b2fb5dca5e88dec2df7c4.zip
Mountd should use separate lockfiles
Mountd keeps file descriptors used for locks separate from those used for io and seems to assume that the lock will only be released on close of the file descriptor that was used with fcntl. Actually the lock is released when any file descriptor for that file is closed. When setexportent() is called after xflock() he closes and reopens the io file descriptor and defeats the lock. This patch fixes that by using a separate file for locking, cleaning them up when finished. Signed-off-by: Ben Myers <bpm@sgi.com> Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils/mountd/mountd.c')
-rw-r--r--utils/mountd/mountd.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c
index 8084359..25d292b 100644
--- a/utils/mountd/mountd.c
+++ b/utils/mountd/mountd.c
@@ -88,6 +88,14 @@ unregister_services (void)
pmap_unset (MOUNTPROG, MOUNTVERS_NFSV3);
}
+static void
+cleanup_lockfiles (void)
+{
+ unlink(_PATH_XTABLCK);
+ unlink(_PATH_ETABLCK);
+ unlink(_PATH_RMTABLCK);
+}
+
/* Wait for all worker child processes to exit and reap them */
static void
wait_for_workers (void)
@@ -154,6 +162,7 @@ fork_workers(void)
/* in parent */
wait_for_workers();
unregister_services();
+ cleanup_lockfiles();
xlog(L_NOTICE, "mountd: no more workers, exiting\n");
exit(0);
}
@@ -170,6 +179,7 @@ killer (int sig)
kill(0, SIGTERM);
wait_for_workers();
}
+ cleanup_lockfiles();
xlog (L_FATAL, "Caught signal %d, un-registering and exiting.", sig);
}