Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp212221iob; Mon, 2 May 2022 17:21:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDwnMjhBo36Bb4DtFyfcvfUJ55+4fWYJ7MghB6pQWrqjGsCdQ2f+qjBaoGHKUdt+v7u815 X-Received: by 2002:a17:90b:e14:b0:1d9:5122:be75 with SMTP id ge20-20020a17090b0e1400b001d95122be75mr1887896pjb.178.1651537318562; Mon, 02 May 2022 17:21:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651537318; cv=none; d=google.com; s=arc-20160816; b=Q/cjWCqLirXdxBxPDMNy9hx6OOLLnk4g6l9fMOUsuYHz8fSaqznbMgfzY9aKvC722k nwfSXPaGmqRZL7nUgZSvRXpt3upKNwaUotOICRTacQWwWVYebzMeig+VSuHCf4oy1xG0 gx6kxMXZRyEPlu2oM+toXMYBnidg1OMF/mGp9xtRUHAsdC1NI6XkcklUG9MMLQoKXZiI 7nj+e0F3AUA3ZE3axb70Lwc7R+/y4DIWVb3V0rvXGB8RJNQlHtCaPC71CrFSvHqLmGWf tMls3a/hX+WqvKbQD12D08X3qwaBYOvXNDDb7+WB7rYHKo+nSUWmXkmXrmNwjsk+DsA5 hFUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=S7QmiFciy335Eqo8oRLc2Vh1ivUZNrXo0EzfUzoR4Rc=; b=TfR25Wm7KecMEZ3HS9707hiqq5pCZDHWcs+Z3W4R11ODaj5KM6RBhulUU4jIaKjtVy 1ywV9jAm+8vksKMv+m4NQ0Kq/4aCwhmXmudTdleEJ2I2R8Qet+y83JIUbVCuVYI2dfZO fc5QY2nPRafcZ+COHcWWEYDee1yUAoG5UpnPRj+TfUb/Z2R7+IKFBkzglgHa5yuzS1oV OYKFv8s4M8OFnhpT1abE/oPGeiFT3gqnaQz+s5ExoPVcaETtQ0te/Suthdjcc7s25/kI Lf8marBN4EcEarBsTWzifjZjhj0rLnHrSUzX9/LQ8CdUsKJG6UmwzcGqB6VBOVJrov+R Be+g== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-nfs-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id k22-20020a056a00135600b0050d7d504fadsi16699694pfu.302.2022.05.02.17.21.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 17:21:58 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-nfs-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-nfs-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2DEB93B55B; Mon, 2 May 2022 17:18:33 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383909AbiEBIzM (ORCPT + 99 others); Mon, 2 May 2022 04:55:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383910AbiEBIzL (ORCPT ); Mon, 2 May 2022 04:55:11 -0400 Received: from lithops.sigma-star.at (lithops.sigma-star.at [195.201.40.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35BA613F7A for ; Mon, 2 May 2022 01:51:39 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id C8358607198A; Mon, 2 May 2022 10:51:31 +0200 (CEST) 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 JeVAsQQhzYR9; Mon, 2 May 2022 10:51:31 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 1AEB36081105; Mon, 2 May 2022 10:51:31 +0200 (CEST) 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 qXckNiyBi4Ji; Mon, 2 May 2022 10:51:30 +0200 (CEST) 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 00C946081103; Mon, 2 May 2022 10:51:29 +0200 (CEST) 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, steved@redhat.com, chris.chilvers@appsbroker.com, Richard Weinberger Subject: [PATCH 5/5] reexport: Make state database location configurable Date: Mon, 2 May 2022 10:50:45 +0200 Message-Id: <20220502085045.13038-6-richard@nod.at> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20220502085045.13038-1-richard@nod.at> References: <20220502085045.13038-1-richard@nod.at> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org 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 --- 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=3D20049 # [svcgssd] # principal=3D + +[reexport] +# sqlitedb=3D 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 =20 #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() !=3D 0) return -1; =20 - ret =3D sqlite3_open_v2(REEXPDB_DBFILE, &db, SQLITE_OPEN_READWRITE | SQ= LITE_OPEN_CREATE | SQLITE_OPEN_FULLMUTEX, NULL); + ret =3D sqlite3_open_v2(conf_get_str_with_def("reexport", "sqlitedb", R= EEXPDB_DBFILE), + &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_F= ULLMUTEX, + NULL); if (ret !=3D SQLITE_OK) { xlog(L_ERROR, "Unable to open reexport database: %s", sqlite3_errstr(r= et)); 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=3D is recognized. =20 +.TP +.B reexport +Only +.B sqlitedb=3D +is recognized, path to the state database. + .SH FILES .TP 10n .I /etc/nfs.conf --=20 2.31.1