From patchwork Thu Feb 17 13:15:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Weinberger X-Patchwork-Id: 12750036 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4CD7C433F5 for ; Thu, 17 Feb 2022 13:23:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240885AbiBQNXN (ORCPT ); Thu, 17 Feb 2022 08:23:13 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:51266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240882AbiBQNXM (ORCPT ); Thu, 17 Feb 2022 08:23:12 -0500 Received: from lithops.sigma-star.at (lithops.sigma-star.at [195.201.40.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0190BAEF12 for ; Thu, 17 Feb 2022 05:22:56 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 2125560F6B8E; Thu, 17 Feb 2022 14:16:41 +0100 (CET) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 7AdH86T1LhPA; Thu, 17 Feb 2022 14:16:40 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 7AE3860D482C; Thu, 17 Feb 2022 14:16:40 +0100 (CET) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id sDOCmXgzzmK9; Thu, 17 Feb 2022 14:16:40 +0100 (CET) Received: from blindfold.corp.sigma-star.at (213-47-184-186.cable.dynamic.surfer.at [213.47.184.186]) by lithops.sigma-star.at (Postfix) with ESMTPSA id E43C9605DEBB; Thu, 17 Feb 2022 14:16:39 +0100 (CET) From: Richard Weinberger To: linux-nfs@vger.kernel.org Cc: david@sigma-star.at, bfields@fieldses.org, luis.turcitu@appsbroker.com, david.young@appsbroker.com, david.oberhollenzer@sigma-star.at, trond.myklebust@hammerspace.com, anna.schumaker@netapp.com, chris.chilvers@appsbroker.com, Richard Weinberger Subject: [RFC PATCH 5/6] nfsd: statfs() every known subvolume upon start Date: Thu, 17 Feb 2022 14:15:30 +0100 Message-Id: <20220217131531.2890-6-richard@nod.at> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20220217131531.2890-1-richard@nod.at> References: <20220217131531.2890-1-richard@nod.at> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org This will trigger an automount of a subvolume and existing file handles will continue to work. Signed-off-by: Richard Weinberger --- 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);