Skip to contentSkip to conversation

NFS basic junction support for nfs-utils

PATCH In review Chuck Lever 3 participants 9 messages Jan 29, 2018 – Feb 7, 2018

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

v4 cover NFS basic junction support for nfs-utils

Still UNTESTED.

A while back I announced the deprecation of fedfs-utils. There were a handful of components in fedfs-utils that we decided to keep. One of those keepers was the "nfsref" command. (The other was autofs support for /nfs4, which I hope Ian Kent is making progress on ;-)

This series introduces "nfsref" to nfs-utils, minus the overhead of the LDAP / FedFS machinery, and it builds support for NFS basic junctions into mountd, replacing the need to install a plug-in DLL from fedfs-utils.

I didn't apply a lot of brain cells to this port, so it's perhaps a little larger than it needs to be. Still, it achieves a completely LDAP-free implementation that resides 100% in nfs-utils. I'm interested in comments about the approach before I do more testing and refinement.

./configure --enable-junction --enable-caps

is needed before building.

Changes since v3:
Broke up the first patch because it was apparently too large to be reflected through vger.kernel.org.

Changes since v2:
None.

Changes since RFC (v1):
Patch 2/3 in the original series added the libnfsjunct.so DLL to nfs-utils. Series v2 instead replaces 2/3 with a patch that puts support for junctions into mountd without the need for a DLL.

---

Chuck Lever (5):
Add headers to support libjunction
Add infrastructure for libjunction
Add LDAP-free version of libjunction to nfs-utils
mountd: Solder in support for NFS basic junctions Add LDAP-free 'nfsref' command

 aclocal/libxml2.m4                   |   15 
 configure.ac                         |   17 
 support/Makefile.am                  |    4 
 support/include/Makefile.am          |    2 
 support/include/fedfs_admin.h        |  342 +++++++
 support/include/junction.h           |  125 +++
 support/junction/Makefile.am         |   34 +
 support/junction/display.c           |  159 +++
 support/junction/export-cache.c      |  118 +++
 support/junction/junction-internal.h |  121 +++
 support/junction/junction.c          |  494 +++++++++++
 support/junction/locations.c         |  131 +++
 support/junction/nfs.c               | 1564 ++++++++++++++++++++++++++++++++++
 support/junction/path.c              |  345 ++++++++
 support/junction/xml.c               |  401 +++++++++
 utils/Makefile.am                    |    4 
 utils/mountd/Makefile.am             |    8 
 utils/mountd/cache.c                 |  189 ++--
 utils/nfsref/Makefile.am             |   39 +
 utils/nfsref/add.c                   |  271 ++++++
 utils/nfsref/lookup.c                |  211 +++++
 utils/nfsref/nfsref.c                |  188 ++++
 utils/nfsref/nfsref.h                |   47 +
 utils/nfsref/nfsref.man              |  180 ++++
 utils/nfsref/remove.c                |  145 +++
 25 files changed, 5050 insertions(+), 104 deletions(-)
 create mode 100644 aclocal/libxml2.m4
 create mode 100644 support/include/fedfs_admin.h
 create mode 100644 support/include/junction.h
 create mode 100644 support/junction/Makefile.am
 create mode 100644 support/junction/display.c
 create mode 100644 support/junction/export-cache.c
 create mode 100644 support/junction/junction-internal.h
 create mode 100644 support/junction/junction.c
 create mode 100644 support/junction/locations.c
 create mode 100644 support/junction/nfs.c
 create mode 100644 support/junction/path.c
 create mode 100644 support/junction/xml.c
 create mode 100644 utils/nfsref/Makefile.am
 create mode 100644 utils/nfsref/add.c
 create mode 100644 utils/nfsref/lookup.c
 create mode 100644 utils/nfsref/nfsref.c
 create mode 100644 utils/nfsref/nfsref.h
 create mode 100644 utils/nfsref/nfsref.man
 create mode 100644 utils/nfsref/remove.c

--
Chuck Lever

#1 lore raw

PATCH v4 1/5 Add headers to support libjunction

libjunction contains support for reading or updating a junction that resides on an NFS server. It is used by mountd to read junction information from an exported filesystem, and by the nfsref command line tool. These will be introduced in subsequent patches.

The source code for libjunction used to be maintained in fedfs-utils, but fedfs-utils is being retired. Although interest in FedFS junctions has waned, NFS basic junctions are still appealing enough that we've decided we want to continue supporting them. Therefore this patch moves the non-LDAP parts of libjunction into nfs-utils, to enable nfs-utils to also support the user-visible pieces of NFS basic junctions.

---
 support/include/Makefile.am   |    2 
 support/include/fedfs_admin.h |  342 +++++++++++++++++++++++++++++++++++++++++
 support/include/junction.h    |  125 +++++++++++++++
 3 files changed, 469 insertions(+)
 create mode 100644 support/include/fedfs_admin.h
 create mode 100644 support/include/junction.h
support/include/Makefile.am +2 -0
index 5c80c8b..11cb162 100644
@@ -5,7 +5,9 @@ SUBDIRS = nfs rpcsvc sys
 noinst_HEADERS = \
 	cld.h \
 	exportfs.h \
+	fedfs_admin.h \
 	ha-callout.h \
+	junction.h \
 	misc.h \
 	nfs_mntent.h \
 	nfs_paths.h \
support/include/fedfs_admin.h new file +342 -0

342 lines not on this page · raw message

support/include/junction.h new file +125 -0

125 lines not on this page · raw message

#2 lore raw

PATCH v4 2/5 Add infrastructure for libjunction

In reply to Chuck Lever

The source code for libjunction used to be maintained in fedfs-utils, but fedfs-utils is being retired. Although interest in FedFS junctions has waned, NFS basic junctions are still appealing enough that we've decided we want to continue supporting them. Therefore this patch moves the non-LDAP parts of libjunction into nfs-utils, to enable nfs-utils to also support the user-visible pieces of NFS basic junctions.

I've added yet another configure command line option to control whether libjunction is built. It defaults to "disabled" for the moment. Reasons you might want to leave it disabled:

- Your distribution still provides fedfs-utils, which already has a working libjunction which is installed separately

- Your distribution does not provide libxml2, which is required to support libjunction

When it's disabled, nfs-utils builds just like it did before this patch, and there's no new dependency on libxml2.

---
 aclocal/libxml2.m4                   |   15 ++++
 configure.ac                         |   11 +++
 support/Makefile.am                  |    4 +
 support/junction/Makefile.am         |   30 ++++++++
 support/junction/junction-internal.h |  121 ++++++++++++++++++++++++++++++++++
 5 files changed, 181 insertions(+)
 create mode 100644 aclocal/libxml2.m4
 create mode 100644 support/junction/Makefile.am
 create mode 100644 support/junction/junction-internal.h
aclocal/libxml2.m4 new file +15 -0
new file mode 100644
index 0000000..5c399b2
@@ -0,0 +1,15 @@
+dnl Checks for libxml2.so
+AC_DEFUN([AC_LIBXML2], [
+
+  if test "$enable_junction" = yes; then
+
+    dnl look for the library; do not add to LIBS if found
+    AC_CHECK_LIB([xml2], [xmlParseFile], [LIBXML2=-lxml2],
+                 [AC_MSG_ERROR([libxml2 not found.])])
+    AC_SUBST(LIBXML2)
+
+    dnl XXX should also check for presence of xml headers
+
+  fi
+
+])dnl
configure.ac +11 -0
index 672dd40..8e7f036 100644
@@ -180,6 +180,13 @@ else
 	enable_libmount=no
 fi
 
+AC_ARG_ENABLE(junction,
+	[AC_HELP_STRING([--enable-junction],
+			[enable support for NFS junctions @<:@default=no@:>@])],
+	enable_junction=$enableval,
+	enable_junction=no)
+AM_CONDITIONAL(CONFIG_JUNCTION, [test "$enable_junction" = "yes" ])
+
 AC_ARG_ENABLE(tirpc,
 	[AC_HELP_STRING([--disable-tirpc],
 			[disable use of TI-RPC library @<:@default=no@:>@])],
@@ -244,6 +251,9 @@ AC_LIBTIRPC
 dnl Check for -lcap
 AC_LIBCAP
 
+dnl Check for -lxml2
+AC_LIBXML2
+
 # Check whether user wants TCP wrappers support
 AC_TCP_WRAPPERS
 
@@ -572,6 +582,7 @@ AC_CONFIG_FILES([
 	support/include/sys/fs/Makefile
 	support/include/sys/Makefile
 	support/include/Makefile
+	support/junction/Makefile
 	support/misc/Makefile
 	support/nfs/Makefile
 	support/nsm/Makefile
support/Makefile.am +4 -0
index 8365d3b..c962d4d 100644
@@ -6,6 +6,10 @@ if CONFIG_NFSV4
 OPTDIRS += nfsidmap
 endif
 
+if CONFIG_JUNCTION
+OPTDIRS += junction
+endif
+
 SUBDIRS = export include misc nfs nsm $(OPTDIRS)
 
 MAINTAINERCLEANFILES = Makefile.in
support/junction/Makefile.am new file +30 -0
new file mode 100644
index 0000000..0d43b0a
@@ -0,0 +1,30 @@
+##
+## @file support/junction/Makefile.am
+## @brief Process this file with automake to produce src/libjunction/Makefile.in
+##
+
+##
+## Copyright 2010, 2018 Oracle.  All rights reserved.
+##
+## This file is part of nfs-utils.
+##
+## nfs-utils is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License version 2.0 as
+## published by the Free Software Foundation.
+##
+## nfs-utils is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License version 2.0 for more details.
+##
+## You should have received a copy of the GNU General Public License
+## version 2.0 along with nfs-utils.  If not, see:
+##
+##      http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
+##
+
+noinst_HEADERS		= junction-internal.h
+
+MAINTAINERCLEANFILES	= Makefile.in
+
+AM_CPPFLAGS		= -I. -I../include -I/usr/include/libxml2
support/junction/junction-internal.h new file +121 -0

121 lines not on this page · raw message

#3 lore raw

PATCH v4 3/5 Add LDAP-free version of libjunction to nfs-utils

In reply to Chuck Lever

A "junction" is a physical filesystem object that contains an NFS referral. On Linux, a junction is a directory with special mode bits that has an extended attribute containing referral location information, represented as XML.

A junction can contain either a list of target locations, or it can contain the location of an LDAP directory entry where the actual referral information is maintained. The former is called an "NFS basic junction", the latter is a "FedFS junction".

libjunction contains support for reading or updating a junction that resides on an NFS server.

---
 support/junction/Makefile.am    |    4 
 support/junction/display.c      |  159 ++++
 support/junction/export-cache.c |  118 +++
 support/junction/junction.c     |  494 ++++++++++++
 support/junction/locations.c    |  131 +++
 support/junction/nfs.c          | 1564 +++++++++++++++++++++++++++++++++++++++
 support/junction/path.c         |  345 +++++++++
 support/junction/xml.c          |  401 ++++++++++
 8 files changed, 3216 insertions(+)
 create mode 100644 support/junction/display.c
 create mode 100644 support/junction/export-cache.c
 create mode 100644 support/junction/junction.c
 create mode 100644 support/junction/locations.c
 create mode 100644 support/junction/nfs.c
 create mode 100644 support/junction/path.c
 create mode 100644 support/junction/xml.c
support/junction/Makefile.am +4 -0
index 0d43b0a..97e7426 100644
@@ -25,6 +25,10 @@
 
 noinst_HEADERS		= junction-internal.h
 
+noinst_LTLIBRARIES	= libjunction.la
+libjunction_la_SOURCES	= display.c export-cache.c junction.c \
+			  locations.c nfs.c path.c xml.c
+
 MAINTAINERCLEANFILES	= Makefile.in
 
 AM_CPPFLAGS		= -I. -I../include -I/usr/include/libxml2
support/junction/display.c new file +159 -0

159 lines not on this page · raw message

support/junction/export-cache.c new file +118 -0

118 lines not on this page · raw message

support/junction/junction.c new file +494 -0

494 lines not on this page · raw message

support/junction/locations.c new file +131 -0

131 lines not on this page · raw message

support/junction/nfs.c new file +1564 -0

1,564 lines not on this page · raw message

support/junction/path.c new file +345 -0

345 lines not on this page · raw message

support/junction/xml.c new file +401 -0

179 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#4 lore raw

PATCH v4 4/5 mountd: Solder in support for NFS basic junctions

In reply to Chuck Lever

This patch does two things:

1. Reverts ab74900ff59e ("mountd: Support junction management plug-ins")

2. Re-implements support for NFS basic junctions directly in mountd

So no more support for FedFS junctions, and no more need to have a dynamically load component installed from another package.

The downside is that mountd has to be linked with libxml2 to get this support. Thus to make the use of libxml2 optional, built-in support for junctions is enabled only when --enable-junction is specified on the command line.

---
 configure.ac             |    5 -
 utils/mountd/Makefile.am |    8 ++
 utils/mountd/cache.c     |  189 ++++++++++++++++++++++------------------------
 3 files changed, 98 insertions(+), 104 deletions(-)
configure.ac +1 -4
index 8e7f036..d2e48a5 100644
@@ -308,8 +308,6 @@ AC_CHECK_FUNC([getservbyname], ,
 
 AC_CHECK_LIB([crypt], [crypt], [LIBCRYPT="-lcrypt"])
 
-AC_CHECK_LIB([dl], [dlclose], [LIBDL="-ldl"])
-
 if test "$enable_nfsv4" = yes; then
   dnl check for libevent libraries and headers
   AC_LIBEVENT
@@ -372,7 +370,6 @@ AC_SUBST(LIBSOCKET)
 AC_SUBST(LIBCRYPT)
 AC_SUBST(LIBBSD)
 AC_SUBST(LIBBLKID)
-AC_SUBST(LIBDL)
 
 if test "$enable_libmount" = yes; then
    AC_CHECK_LIB(mount, mnt_context_do_mount, [LIBMOUNT="-lmount"], AC_MSG_ERROR([libmount needed]))
@@ -466,7 +463,7 @@ AC_CHECK_HEADERS([arpa/inet.h fcntl.h libintl.h limits.h \
                  stdlib.h string.h sys/file.h sys/ioctl.h sys/mount.h \
                  sys/param.h sys/socket.h sys/time.h sys/vfs.h \
                  syslog.h unistd.h com_err.h et/com_err.h \
-                 ifaddrs.h nfs-plugin.h libio.h])
+                 ifaddrs.h libio.h])
 
 dnl *************************************************************
 dnl Checks for typedefs, structures, and compiler characteristics
utils/mountd/Makefile.am +7 -1
index 153a90a..73eeb3f 100644
@@ -1,5 +1,10 @@
 ## Process this file with automake to produce Makefile.in
 
+OPTLIBS		=
+if CONFIG_JUNCTION
+OPTLIBS		+= ../../support/junction/libjunction.la $(LIBXML2)
+endif
+
 man8_MANS	= mountd.man
 EXTRA_DIST	= $(man8_MANS)
 
@@ -13,7 +18,8 @@ mountd_SOURCES = mountd.c mount_dispatch.c auth.c rmtab.c cache.c \
 mountd_LDADD = ../../support/export/libexport.a \
 	       ../../support/nfs/libnfs.la \
 	       ../../support/misc/libmisc.a \
-	       $(LIBBSD) $(LIBWRAP) $(LIBNSL) $(LIBBLKID) $(LIBDL) $(LIBTIRPC)
+	       $(OPTLIBS) \
+	       $(LIBBSD) $(LIBWRAP) $(LIBNSL) $(LIBBLKID) $(LIBTIRPC)
 mountd_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS) \
 		  -I$(top_builddir)/support/include \
 		  -I$(top_srcdir)/support/export
utils/mountd/cache.c +90 -99

255 lines not on this page · raw message

#5 lore raw

PATCH v4 5/5 Add LDAP-free 'nfsref' command

In reply to Chuck Lever

The 'nfsref' command administers junctions. On an NFS server, it can create new junctions, remove existing junctions, or display the contents of junctions.

A man page with more details is included.

---
 configure.ac             |    1 
 utils/Makefile.am        |    4 +
 utils/nfsref/Makefile.am |   39 +++++++
 utils/nfsref/add.c       |  271 ++++++++++++++++++++++++++++++++++++++++++++++
 utils/nfsref/lookup.c    |  211 ++++++++++++++++++++++++++++++++++++
 utils/nfsref/nfsref.c    |  188 ++++++++++++++++++++++++++++++++
 utils/nfsref/nfsref.h    |   47 ++++++++
 utils/nfsref/nfsref.man  |  180 +++++++++++++++++++++++++++++++
 utils/nfsref/remove.c    |  145 +++++++++++++++++++++++++
 9 files changed, 1086 insertions(+)
 create mode 100644 utils/nfsref/Makefile.am
 create mode 100644 utils/nfsref/add.c
 create mode 100644 utils/nfsref/lookup.c
 create mode 100644 utils/nfsref/nfsref.c
 create mode 100644 utils/nfsref/nfsref.h
 create mode 100644 utils/nfsref/nfsref.man
 create mode 100644 utils/nfsref/remove.c
configure.ac +1 -0
index d2e48a5..fba9064 100644
@@ -601,6 +601,7 @@ AC_CONFIG_FILES([
 	utils/mount/Makefile
 	utils/mountd/Makefile
 	utils/nfsd/Makefile
+	utils/nfsref/Makefile
 	utils/nfsstat/Makefile
 	utils/nfsidmap/Makefile
 	utils/showmount/Makefile
utils/Makefile.am +4 -0
index c75a5a0..d361aea 100644
@@ -23,6 +23,10 @@ if CONFIG_NFSDCLTRACK
 OPTDIRS += nfsdcltrack
 endif
 
+if CONFIG_JUNCTION
+OPTDIRS += nfsref
+endif
+
 SUBDIRS = \
 	exportfs \
 	mountd \
utils/nfsref/Makefile.am new file +39 -0
new file mode 100644
index 0000000..2b2bb53
@@ -0,0 +1,39 @@
+##
+## @file utils/nfsref/Makefile.am
+## @brief Process this file with automake to produce utils/nfsref/Makefile.in
+##
+
+##
+## Copyright 2011, 2018 Oracle.  All rights reserved.
+##
+## This file is part of nfs-utils.
+##
+## nfs-utils is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License version 2.0 as
+## published by the Free Software Foundation.
+##
+## nfs-utils is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License version 2.0 for more details.
+##
+## You should have received a copy of the GNU General Public License
+## version 2.0 along with nfs-utils.  If not, see:
+##
+##	http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
+##
+
+noinst_HEADERS		= nfsref.h
+
+sbin_PROGRAMS		= nfsref
+nfsref_SOURCES		= add.c lookup.c nfsref.c remove.c
+LDADD			= $(LIBXML2) $(LIBCAP) \
+			  ../../support/nfs/libnfs.la \
+			  ../../support/junction/libjunction.la
+
+man8_MANS		= nfsref.man
+
+MAINTAINERCLEANFILES	= Makefile.in
+
+AM_CPPFLAGS		= -I. -I../../support/include
+##AM_LDFLAGS		= -Wl,--as-needed
utils/nfsref/add.c new file +271 -0

271 lines not on this page · raw message

utils/nfsref/lookup.c new file +211 -0

211 lines not on this page · raw message

utils/nfsref/nfsref.c new file +188 -0

188 lines not on this page · raw message

utils/nfsref/nfsref.h new file +47 -0

47 lines not on this page · raw message

utils/nfsref/nfsref.man new file +180 -0

180 lines not on this page · raw message

utils/nfsref/remove.c new file +145 -0

145 lines not on this page · raw message

#6 lore raw
In reply to Chuck Lever
Quoted 12 lines · Chuck Lever

Still UNTESTED.

A while back I announced the deprecation of fedfs-utils. There were a handful of components in fedfs-utils that we decided to keep. One of those keepers was the "nfsref" command. (The other was autofs support for /nfs4, which I hope Ian Kent is making progress on ;-)

This series introduces "nfsref" to nfs-utils, minus the overhead of the LDAP / FedFS machinery, and it builds support for NFS basic junctions into mountd, replacing the need to install a plug-in DLL from fedfs-utils.

Quoted 5 lines

I didn't apply a lot of brain cells to this port, so it's perhaps a little larger than it needs to be. Still, it achieves a completely LDAP-free implementation that resides 100% in nfs-utils. I'm interested in comments about the approach before I do more testing and refinement.

It looks sensible to me, though I must confess that I haven't given much thought to the use of junctions, and have never tried working with them.

If I understand correctly, you can already do junctions by putting archane magic in /etc/exports, and possibly performing
mount --bind /foo /foo
With the patch to mountd, you can put the archane magic in an xattr on the directory, and skip the --bind mount.
Then "nfsref" is a funky tool which adds/lists/removes the archane magic in a human-readable fashion.

That sounds like a generally sensible idea. There seems to be rather more code than I would expect for that functionality, but you've already admitted that, so no surprise there.

I was rather surprised to see an rpcgen generated file without the .x. I think I understand why that is, and that is one place that you will probably remove a lot of unnecessary content, including the comment about rpcgen.

So: +1

Thanks,
NeilBrown

Quoted 82 lines

./configure --enable-junction --enable-caps

is needed before building.

Changes since v3:
Broke up the first patch because it was apparently too large to be reflected through vger.kernel.org.

Changes since v2:
None.

Changes since RFC (v1):
Patch 2/3 in the original series added the libnfsjunct.so DLL to nfs-utils. Series v2 instead replaces 2/3 with a patch that puts support for junctions into mountd without the need for a DLL.

---

Chuck Lever (5):
Add headers to support libjunction
Add infrastructure for libjunction
Add LDAP-free version of libjunction to nfs-utils
mountd: Solder in support for NFS basic junctions Add LDAP-free 'nfsref' command

 aclocal/libxml2.m4                   |   15 
 configure.ac                         |   17 
 support/Makefile.am                  |    4 
 support/include/Makefile.am          |    2 
 support/include/fedfs_admin.h        |  342 +++++++
 support/include/junction.h           |  125 +++
 support/junction/Makefile.am         |   34 +
 support/junction/display.c           |  159 +++
 support/junction/export-cache.c      |  118 +++
 support/junction/junction-internal.h |  121 +++
 support/junction/junction.c          |  494 +++++++++++
 support/junction/locations.c         |  131 +++
 support/junction/nfs.c               | 1564 ++++++++++++++++++++++++++++++++++
 support/junction/path.c              |  345 ++++++++
 support/junction/xml.c               |  401 +++++++++
 utils/Makefile.am                    |    4 
 utils/mountd/Makefile.am             |    8 
 utils/mountd/cache.c                 |  189 ++--
 utils/nfsref/Makefile.am             |   39 +
 utils/nfsref/add.c                   |  271 ++++++
 utils/nfsref/lookup.c                |  211 +++++
 utils/nfsref/nfsref.c                |  188 ++++
 utils/nfsref/nfsref.h                |   47 +
 utils/nfsref/nfsref.man              |  180 ++++
 utils/nfsref/remove.c                |  145 +++
 25 files changed, 5050 insertions(+), 104 deletions(-)
 create mode 100644 aclocal/libxml2.m4
 create mode 100644 support/include/fedfs_admin.h
 create mode 100644 support/include/junction.h
 create mode 100644 support/junction/Makefile.am
 create mode 100644 support/junction/display.c
 create mode 100644 support/junction/export-cache.c
 create mode 100644 support/junction/junction-internal.h
 create mode 100644 support/junction/junction.c
 create mode 100644 support/junction/locations.c
 create mode 100644 support/junction/nfs.c
 create mode 100644 support/junction/path.c
 create mode 100644 support/junction/xml.c
 create mode 100644 utils/nfsref/Makefile.am
 create mode 100644 utils/nfsref/add.c
 create mode 100644 utils/nfsref/lookup.c
 create mode 100644 utils/nfsref/nfsref.c
 create mode 100644 utils/nfsref/nfsref.h
 create mode 100644 utils/nfsref/nfsref.man
 create mode 100644 utils/nfsref/remove.c

--
Chuck Lever
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw
Quoted 23 lines · NeilBrown

=20
On Mon, Jan 29 2018, Chuck Lever wrote:
=20

Quoted 9 lines

Still UNTESTED.
=20
A while back I announced the deprecation of fedfs-utils. There were a handful of components in fedfs-utils that we decided to keep. One of those keepers was the "nfsref" command. (The other was autofs support for /nfs4, which I hope Ian Kent is making progress on ;-) =20
This series introduces "nfsref" to nfs-utils, minus the overhead of the LDAP / FedFS machinery, and it builds support for NFS basic

Quoted 8 lines

junctions into mountd, replacing the need to install a plug-in DLL from fedfs-utils.
=20
I didn't apply a lot of brain cells to this port, so it's perhaps a little larger than it needs to be. Still, it achieves a completely LDAP-free implementation that resides 100% in nfs-utils. I'm interested in comments about the approach before I do more testing and refinement.

Quoted 2 lines

=20
It looks sensible to me, though I must confess that I haven't given =

much

Quoted 1 line

thought to the use of junctions, and have never tried working with =

them.

Quoted 7 lines

=20
If I understand correctly, you can already do junctions by putting archane magic in /etc/exports, and possibly performing
mount --bind /foo /foo
With the patch to mountd, you can put the archane magic in an xattr on the directory, and skip the --bind mount.
Then "nfsref" is a funky tool which adds/lists/removes the archane =

magic

Quoted 3 lines

in a human-readable fashion.
=20
That sounds like a generally sensible idea.

Yes, we would like to make the Linux server's implementation of NFSv4 referrals a little less "black magic," and a little more "sane administrative interface."

Quoted 2 lines

There seems to be rather
more code than I would expect for that functionality, but you've =

already

Quoted 1 line

admitted that, so no surprise there.

This code had to support at least two types of junctions: NFS basic, and FedFS. That's why the junction extended attributes contain XML. Though we're not carrying support for FedFS junctions forward, parsing that XML appears to be the bulkiest part of this port.

Quoted 4 lines

I was rather surprised to see an rpcgen generated file without the .x. I think I understand why that is, and that is one place that you will probably remove a lot of unnecessary content, including the comment about rpcgen.

Thinking about it, the fedfs_admin.h file is probably needed only for its definitions of the FEDFS_ERR status codes, which are used throughout the internal APIs in libjunction. We're certainly not including an implementation of the FedFS ADMIN protocol.

As a first step I could copy just those to the other new header file, and that could allow me to get rid of fedfs_admin.h all together.

Quoted 1 line

So: +1

Thanks, Neil!

Quoted 48 lines

=20
Thanks,
NeilBrown
=20
=20

Quoted 43 lines

=20
./configure --enable-junction --enable-caps
=20
is needed before building.
=20
=20
Changes since v3:
Broke up the first patch because it was apparently too large to be reflected through vger.kernel.org.
=20
=20
Changes since v2:
None.
=20
=20
Changes since RFC (v1):
Patch 2/3 in the original series added the libnfsjunct.so DLL to nfs-utils. Series v2 instead replaces 2/3 with a patch that puts support for junctions into mountd without the need for a DLL. =20
---
=20
Chuck Lever (5):
Add headers to support libjunction
Add infrastructure for libjunction
Add LDAP-free version of libjunction to nfs-utils
mountd: Solder in support for NFS basic junctions Add LDAP-free 'nfsref' command
=20
=20

aclocal/libxml2.m4                   |   15=20
configure.ac                         |   17=20
support/Makefile.am                  |    4=20
support/include/Makefile.am          |    2=20
support/include/fedfs_admin.h        |  342 +++++++
support/include/junction.h           |  125 +++
support/junction/Makefile.am         |   34 +
support/junction/display.c           |  159 +++
support/junction/export-cache.c      |  118 +++
support/junction/junction-internal.h |  121 +++
support/junction/junction.c          |  494 +++++++++++
support/junction/locations.c         |  131 +++
support/junction/nfs.c               | 1564 =

++++++++++++++++++++++++++++++++++

Quoted 29 lines
Quoted 29 lines
support/junction/path.c              |  345 ++++++++
support/junction/xml.c               |  401 +++++++++
utils/Makefile.am                    |    4=20
utils/mountd/Makefile.am             |    8=20
utils/mountd/cache.c                 |  189 ++--
utils/nfsref/Makefile.am             |   39 +
utils/nfsref/add.c                   |  271 ++++++
utils/nfsref/lookup.c                |  211 +++++
utils/nfsref/nfsref.c                |  188 ++++
utils/nfsref/nfsref.h                |   47 +
utils/nfsref/nfsref.man              |  180 ++++
utils/nfsref/remove.c                |  145 +++
25 files changed, 5050 insertions(+), 104 deletions(-)

create mode 100644 aclocal/libxml2.m4
create mode 100644 support/include/fedfs_admin.h create mode 100644 support/include/junction.h create mode 100644 support/junction/Makefile.am create mode 100644 support/junction/display.c create mode 100644 support/junction/export-cache.c create mode 100644 support/junction/junction-internal.h create mode 100644 support/junction/junction.c create mode 100644 support/junction/locations.c create mode 100644 support/junction/nfs.c create mode 100644 support/junction/path.c create mode 100644 support/junction/xml.c create mode 100644 utils/nfsref/Makefile.am create mode 100644 utils/nfsref/add.c
create mode 100644 utils/nfsref/lookup.c create mode 100644 utils/nfsref/nfsref.c

Quoted 8 lines
Quoted 8 lines

create mode 100644 utils/nfsref/nfsref.h
create mode 100644 utils/nfsref/nfsref.man
create mode 100644 utils/nfsref/remove.c
=20
--
Chuck Lever
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" =

in

Quoted 2 lines
Quoted 2 lines

the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
Chuck Lever

#8 lore raw
In reply to Chuck Lever
Quoted 18 lines · Chuck Lever

Still UNTESTED.

A while back I announced the deprecation of fedfs-utils. There were a handful of components in fedfs-utils that we decided to keep. One of those keepers was the "nfsref" command. (The other was autofs support for /nfs4, which I hope Ian Kent is making progress on ;-)

This series introduces "nfsref" to nfs-utils, minus the overhead of the LDAP / FedFS machinery, and it builds support for NFS basic junctions into mountd, replacing the need to install a plug-in DLL from fedfs-utils.

I didn't apply a lot of brain cells to this port, so it's perhaps a little larger than it needs to be. Still, it achieves a completely LDAP-free implementation that resides 100% in nfs-utils. I'm interested in comments about the approach before I do more testing and refinement.

Quoted 3 lines

./configure --enable-junction --enable-caps

is needed before building.

The series was committed... thanks!

steved.

Quoted 79 lines

Changes since v3:
Broke up the first patch because it was apparently too large to be reflected through vger.kernel.org.

Changes since v2:
None.

Changes since RFC (v1):
Patch 2/3 in the original series added the libnfsjunct.so DLL to nfs-utils. Series v2 instead replaces 2/3 with a patch that puts support for junctions into mountd without the need for a DLL.

---

Chuck Lever (5):
Add headers to support libjunction
Add infrastructure for libjunction
Add LDAP-free version of libjunction to nfs-utils
mountd: Solder in support for NFS basic junctions Add LDAP-free 'nfsref' command

 aclocal/libxml2.m4                   |   15 
 configure.ac                         |   17 
 support/Makefile.am                  |    4 
 support/include/Makefile.am          |    2 
 support/include/fedfs_admin.h        |  342 +++++++
 support/include/junction.h           |  125 +++
 support/junction/Makefile.am         |   34 +
 support/junction/display.c           |  159 +++
 support/junction/export-cache.c      |  118 +++
 support/junction/junction-internal.h |  121 +++
 support/junction/junction.c          |  494 +++++++++++
 support/junction/locations.c         |  131 +++
 support/junction/nfs.c               | 1564 ++++++++++++++++++++++++++++++++++
 support/junction/path.c              |  345 ++++++++
 support/junction/xml.c               |  401 +++++++++
 utils/Makefile.am                    |    4 
 utils/mountd/Makefile.am             |    8 
 utils/mountd/cache.c                 |  189 ++--
 utils/nfsref/Makefile.am             |   39 +
 utils/nfsref/add.c                   |  271 ++++++
 utils/nfsref/lookup.c                |  211 +++++
 utils/nfsref/nfsref.c                |  188 ++++
 utils/nfsref/nfsref.h                |   47 +
 utils/nfsref/nfsref.man              |  180 ++++
 utils/nfsref/remove.c                |  145 +++
 25 files changed, 5050 insertions(+), 104 deletions(-)
 create mode 100644 aclocal/libxml2.m4
 create mode 100644 support/include/fedfs_admin.h
 create mode 100644 support/include/junction.h
 create mode 100644 support/junction/Makefile.am
 create mode 100644 support/junction/display.c
 create mode 100644 support/junction/export-cache.c
 create mode 100644 support/junction/junction-internal.h
 create mode 100644 support/junction/junction.c
 create mode 100644 support/junction/locations.c
 create mode 100644 support/junction/nfs.c
 create mode 100644 support/junction/path.c
 create mode 100644 support/junction/xml.c
 create mode 100644 utils/nfsref/Makefile.am
 create mode 100644 utils/nfsref/add.c
 create mode 100644 utils/nfsref/lookup.c
 create mode 100644 utils/nfsref/nfsref.c
 create mode 100644 utils/nfsref/nfsref.h
 create mode 100644 utils/nfsref/nfsref.man
 create mode 100644 utils/nfsref/remove.c

--
Chuck Lever
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html