All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
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,
	steved@redhat.com, chris.chilvers@appsbroker.com,
	Richard Weinberger <richard@nod.at>
Subject: [PATCH 5/5] reexport: Make state database location configurable
Date: Mon,  2 May 2022 10:50:45 +0200	[thread overview]
Message-ID: <20220502085045.13038-6-richard@nod.at> (raw)
In-Reply-To: <20220502085045.13038-1-richard@nod.at>

With the database location configurable it is possible to
place the sqlite database on a shared filesystem.
That way the reexport state can be shared among multiple
re-exporting NFS servers.

Be careful with shared filesystems, SQLite assumes that file locking
works on such filesystems. Not all filesystems implement this
correctly.

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 nfs.conf                    | 3 +++
 support/reexport/reexport.c | 5 ++++-
 systemd/nfs.conf.man        | 6 ++++++
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/nfs.conf b/nfs.conf
index 8c714ff7..f19c346a 100644
--- a/nfs.conf
+++ b/nfs.conf
@@ -96,3 +96,6 @@ rdma-port=20049
 #
 [svcgssd]
 # principal=
+
+[reexport]
+# sqlitedb=
diff --git a/support/reexport/reexport.c b/support/reexport/reexport.c
index 51e49834..61574fc5 100644
--- a/support/reexport/reexport.c
+++ b/support/reexport/reexport.c
@@ -12,6 +12,7 @@
 #include <unistd.h>
 
 #include "nfsd_path.h"
+#include "conffile.h"
 #include "nfslib.h"
 #include "reexport.h"
 #include "xcommon.h"
@@ -55,7 +56,9 @@ int reexpdb_init(void)
 	if (prng_init() != 0)
 		return -1;
 
-	ret = sqlite3_open_v2(REEXPDB_DBFILE, &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_FULLMUTEX, NULL);
+	ret = sqlite3_open_v2(conf_get_str_with_def("reexport", "sqlitedb", REEXPDB_DBFILE),
+			      &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_FULLMUTEX,
+			      NULL);
 	if (ret != SQLITE_OK) {
 		xlog(L_ERROR, "Unable to open reexport database: %s", sqlite3_errstr(ret));
 		return -1;
diff --git a/systemd/nfs.conf.man b/systemd/nfs.conf.man
index 4436a38a..afd2b3f8 100644
--- a/systemd/nfs.conf.man
+++ b/systemd/nfs.conf.man
@@ -295,6 +295,12 @@ Only
 .B debug=
 is recognized.
 
+.TP
+.B reexport
+Only
+.B sqlitedb=
+is recognized, path to the state database.
+
 .SH FILES
 .TP 10n
 .I /etc/nfs.conf
-- 
2.31.1


  parent reply	other threads:[~2022-05-02  8:51 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-02  8:50 [PATCH 0/5] nfs-utils: Improving NFS re-exports Richard Weinberger
2022-05-02  8:50 ` [PATCH 1/5] Implement reexport helper library Richard Weinberger
2022-05-10 13:32   ` Steve Dickson
2022-05-10 13:48     ` Chuck Lever III
2022-05-10 13:59       ` Richard Weinberger
2022-05-10 14:04       ` Steve Dickson
2022-05-10 14:17         ` Chuck Lever III
2022-05-10 20:08           ` Steve Dickson
2022-05-10 20:32             ` Richard Weinberger
2022-05-10 20:37             ` Chuck Lever III
2022-05-02  8:50 ` [PATCH 2/5] exports: Implement new export option reexport= Richard Weinberger
2022-05-10 14:32   ` Steve Dickson
2022-05-10 16:06     ` Richard Weinberger
2022-05-10 19:26       ` Steve Dickson
2022-05-02  8:50 ` [PATCH 3/5] export: Implement logic behind reexport= Richard Weinberger
2022-05-02  8:50 ` [PATCH 4/5] export: Avoid fsid= conflicts Richard Weinberger
2022-05-02  8:50 ` Richard Weinberger [this message]
2022-05-02 16:17 ` [PATCH 0/5] nfs-utils: Improving NFS re-exports J. Bruce Fields
2022-05-02 22:46   ` Steve Dickson
2022-05-03  0:00     ` Chuck Lever III
2022-05-23  7:53   ` Richard Weinberger
2022-05-23 14:25     ` Chuck Lever III
2022-05-23 14:29     ` bfields
2022-05-23 14:31     ` bfields

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220502085045.13038-6-richard@nod.at \
    --to=richard@nod.at \
    --cc=anna.schumaker@netapp.com \
    --cc=bfields@fieldses.org \
    --cc=chris.chilvers@appsbroker.com \
    --cc=david.oberhollenzer@sigma-star.at \
    --cc=david.young@appsbroker.com \
    --cc=david@sigma-star.at \
    --cc=linux-nfs@vger.kernel.org \
    --cc=luis.turcitu@appsbroker.com \
    --cc=steved@redhat.com \
    --cc=trond.myklebust@hammerspace.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.