Skip to contentSkip to conversation

mountd clean-ups for nfs-utils 1.2.8

PATCH In review Chuck Lever 2 participants 7 messages Dec 3, 2012 – Dec 12, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover mountd clean-ups for nfs-utils 1.2.8

Hi-

Here are four clean-up patches I've had for a while, and one patch that augments junction resolution debugging messages.

---

Chuck Lever (5):
mountd: Report the absolute path used to load the junction plug-in libexport.a: xtab.c no longer needs #include xmalloc.h libexport.a: rmtab.c no longer needs #include xmalloc.h
mountd: cache.c no longer needs #include xmalloc.h
mountd: auth.c no longer needs #include xmalloc.h

 support/export/rmtab.c |    6 +++---
 support/export/xtab.c  |    2 +-
 utils/mountd/auth.c    |    3 ++-
 utils/mountd/cache.c   |    8 +++++++-
 4 files changed, 13 insertions(+), 6 deletions(-)
Signature · 1 line
Chuck Lever
#1 lore raw

PATCH 1/5 mountd: auth.c no longer needs #include xmalloc.h

---

 utils/mountd/auth.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
utils/mountd/auth.c +2 -1
index 508040a..330cab5 100644
@@ -10,10 +10,12 @@
 #include <config.h>
 #endif
 
+#include <sys/types.h>
 #include <sys/stat.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #include <errno.h>
+#include <fcntl.h>
 #include <unistd.h>
 
 #include "sockaddr.h"
@@ -21,7 +23,6 @@
 #include "nfslib.h"
 #include "exportfs.h"
 #include "mountd.h"
-#include "xmalloc.h"
 #include "v4root.h"
 
 enum auth_error
#2 lore raw

PATCH 2/5 mountd: cache.c no longer needs #include xmalloc.h

In reply to Chuck Lever

---

 utils/mountd/cache.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
utils/mountd/cache.c +0 -1
index c13f305..c264e14 100644
@@ -29,7 +29,6 @@
 #include "nfslib.h"
 #include "exportfs.h"
 #include "mountd.h"
-#include "xmalloc.h"
 #include "fsloc.h"
 #include "pseudoflavors.h"
 
#3 lore raw

PATCH 3/5 libexport.a: rmtab.c no longer needs #include xmalloc.h

In reply to Chuck Lever

---

 support/export/rmtab.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
support/export/rmtab.c +3 -3
index 31c0f50..d16b3b3 100644
@@ -1,7 +1,7 @@
 /*
- * support/export/rmntab.c
+ * support/export/rmtab.c
  *
- * Interface to the rmnt file.
+ * Interface to the rmtab file.
  *
  */
 
@@ -12,7 +12,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
-#include "xmalloc.h"
+
 #include "misc.h"
 #include "nfslib.h"
 #include "exportfs.h"
#4 lore raw

PATCH 4/5 libexport.a: xtab.c no longer needs #include xmalloc.h

In reply to Chuck Lever

---

 support/export/xtab.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
support/export/xtab.c +1 -1
index 2a43193..e953071 100644
@@ -14,7 +14,7 @@
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
-#include "xmalloc.h"
+
 #include "nfslib.h"
 #include "exportfs.h"
 #include "xio.h"
#5 lore raw

PATCH 5/5 mountd: Report the absolute path used to load the junction plug-in

In reply to Chuck Lever

As a debugging feature, report the absolute pathname of the plug-in library that mountd loads to resolve junctions.

Since mountd passes a relative path to dlopen(3), dlopen(3) must search for the right library. Displaying the absolute pathname of the object that it found verifies that mountd loaded the correct plug-in.

Note: dlinfo(3) is provided by libdl, but there doesn't seem to be a man page on Fedora 16 for dlinfo(3). Instead, see:

http://www.unix.com/man-page/all/3/dlinfo/

---

 utils/mountd/cache.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
utils/mountd/cache.c +7 -0
index c264e14..3853bb6 100644
@@ -826,6 +826,7 @@ lookup_export(char *dom, char *path, struct addrinfo *ai)
 
 #ifdef HAVE_NFS_PLUGIN_H
 #include <dlfcn.h>
+#include <link.h>
 #include <nfs-plugin.h>
 
 /*
@@ -1090,6 +1091,7 @@ static struct exportent *lookup_junction(char *dom, const char *pathname,
 		struct addrinfo *ai)
 {
 	struct exportent *exp;
+	struct link_map *map;
 	void *handle;
 
 	handle = dlopen("libnfsjunct.so", RTLD_NOW);
@@ -1097,6 +1099,11 @@ static struct exportent *lookup_junction(char *dom, const char *pathname,
 		xlog(D_GENERAL, "%s: dlopen: %s", __func__, dlerror());
 		return NULL;
 	}
+
+	if (dlinfo(handle, RTLD_DI_LINKMAP, &map) == 0)
+		xlog(D_GENERAL, "%s: loaded plug-in %s",
+			__func__, map->l_name);
+
 	(void)dlerror();	/* Clear any error */
 
 	exp = invoke_junction_ops(handle, dom, pathname, ai);
#6 lore raw
In reply to Chuck Lever
Quoted 15 lines · Chuck Lever

Hi-

Here are four clean-up patches I've had for a while, and one patch that augments junction resolution debugging messages.

---

Chuck Lever (5):
mountd: Report the absolute path used to load the junction plug-in libexport.a: xtab.c no longer needs #include xmalloc.h libexport.a: rmtab.c no longer needs #include xmalloc.h
mountd: cache.c no longer needs #include xmalloc.h
mountd: auth.c no longer needs #include xmalloc.h

Quoted 6 lines
 support/export/rmtab.c |    6 +++---
 support/export/xtab.c  |    2 +-
 utils/mountd/auth.c    |    3 ++-
 utils/mountd/cache.c   |    8 +++++++-
 4 files changed, 13 insertions(+), 6 deletions(-)

All 5 Committed....

steved.