[RFC PATCH 5/6] nfsd: statfs() every known subvolume upon start

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This will trigger an automount of a subvolume and existing
file handles will continue to work.

Signed-off-by: Richard Weinberger <richard@xxxxxx>
---
 utils/nfsd/Makefile.am |  6 ++++++
 utils/nfsd/nfsd.c      | 10 ++++++++++
 2 files changed, 16 insertions(+)

diff --git a/utils/nfsd/Makefile.am b/utils/nfsd/Makefile.am
index 8acc9a04..3acc8354 100644
--- a/utils/nfsd/Makefile.am
+++ b/utils/nfsd/Makefile.am
@@ -11,6 +11,12 @@ noinst_HEADERS = nfssvc.h
 nfsd_SOURCES = nfsd.c nfssvc.c
 nfsd_LDADD = ../../support/nfs/libnfs.la $(LIBTIRPC)
 
+if CONFIG_REEXPORT
+nfsd_LDADD += ../../support/reexport/libreexport.a $(LIBSQLITE) $(LIBPTHREAD) -lrt
+endif
+
+nfsd_CPPFLAGS = -I$(top_srcdir)/support/reexport
+
 MAINTAINERCLEANFILES = Makefile.in
 
 #######################################################################
diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
index b0741718..b5175f7a 100644
--- a/utils/nfsd/nfsd.c
+++ b/utils/nfsd/nfsd.c
@@ -29,6 +29,7 @@
 #include "nfssvc.h"
 #include "xlog.h"
 #include "xcommon.h"
+#include "reexport.h"
 
 #ifndef NFSD_NPROC
 #define NFSD_NPROC 8
@@ -347,6 +348,15 @@ main(int argc, char **argv)
 		exit(1);
 	}
 
+	/*
+	 * Make sure that uncovered NFS subvolumes are present such that
+	 * existing file handles continue working.
+	 */
+	if (reexpdb_init() == 0) {
+		reexpdb_uncover_subvolumes(NULL);
+		reexpdb_destroy();
+	}
+
 	/* make sure nfsdfs is mounted if it's available */
 	nfssvc_mount_nfsdfs(progname);
 
-- 
2.31.1




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux