Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5842958rwl; Tue, 4 Apr 2023 04:38:27 -0700 (PDT) X-Google-Smtp-Source: AKy350YapS3JApmDY4vIOOwIe+L0f9mZnyGd7YSu78ONY03wWoX0AA8/BwP2onCNebYl7NPM9OLp X-Received: by 2002:a17:902:f545:b0:1a1:a996:feb3 with SMTP id h5-20020a170902f54500b001a1a996feb3mr3244175plf.26.1680608306920; Tue, 04 Apr 2023 04:38:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680608306; cv=none; d=google.com; s=arc-20160816; b=NYLQOdYfeIrWiLZlLn34nMlWBiR9s9ECy9ykcyUJJeRW5hIiIvJrQHSRCGz31NXqLE ej/V5bcqMkVmaPaSyDLQCBu9s145tvdQG562xOea9ZIHoR6tYNiIjpzOQM/TvRXDIPQi 2A9jeM9AYzbcS0+O9rN7Aj+LrPMrW0JOd5KapcJbCLqLIDb7BHa1CrOYX1zoQIo9Uw2X 8btJ8W+aQr8bq+QqPmOv7JPCn0j8CnTlK6QJx8GCYFXogBJsdQ0W4pRY5JmrhFOkxZUs HCPID//sFklb2hrg+BeMewF2vc6y/A0Io0OtaUhIzbscLTTyqJ8X23BRoSVKte+YsXfi UzvA== 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 :message-id:date:subject:cc:to:from; bh=Ml3T4njIYkW9kHakTMkjc8l+ZsytXO/pMyercbAK55k=; b=ZRjsCw/DvLm6nKb9w03/zM308tTe85CSi3LoBnQeGRc84VVKyAOKO2cg95eCngt8lS 5t0Rv0UeM/WH+8biuLuq1ptP6PZaEsT40Mf2YJai7unN0kGz5Py7TK/D1eGrnQA5zJCo 1DxLtSmXf3kWRV6++HaV7mNet2fzlog2WhPUlBWNY4w4T3vImslCto61YFp3aEMfXVJZ e/H5eGwHUgrb46jCG41x2QT0CL9Xo/XJQtSQtdxcIosB4Lm4Hr3K0OXzBDrhk9j5vVgY lrySZR5XqKmhJmhvQbxWRSrQL0QbN128DN5Ab0syzNzN4G5wGAehbDUrSn4GgK2zo6Ox CqKg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u8-20020a170903124800b0019e89155c50si10763322plh.352.2023.04.04.04.38.12; Tue, 04 Apr 2023 04:38:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231441AbjDDLNV (ORCPT + 99 others); Tue, 4 Apr 2023 07:13:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231440AbjDDLNU (ORCPT ); Tue, 4 Apr 2023 07:13:20 -0400 Received: from lithops.sigma-star.at (lithops.sigma-star.at [195.201.40.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75B8A19B9 for ; Tue, 4 Apr 2023 04:13:17 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 769FA6431C4A; Tue, 4 Apr 2023 13:13:14 +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 iP7u0Jsz3Rhw; Tue, 4 Apr 2023 13:13:13 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id AE8336418F2B; Tue, 4 Apr 2023 13:13:13 +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 Z2Zk-Ba01Mhq; Tue, 4 Apr 2023 13:13:13 +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 385DF63CC186; Tue, 4 Apr 2023 13:13:13 +0200 (CEST) From: Richard Weinberger To: linux-nfs@vger.kernel.org Cc: david@sigma-star.at, david.oberhollenzer@sigma-star.at, luis.turcitu@appsbroker.com, david.young@appsbroker.com, trond.myklebust@hammerspace.com, anna.schumaker@netapp.com, steved@redhat.com, chris.chilvers@appsbroker.com, Richard Weinberger Subject: [PATCH 0/2 v2 RESEND] nfs-utils: Improving NFS re-export wrt. crossmnt Date: Tue, 4 Apr 2023 13:13:06 +0200 Message-Id: <20230404111308.23465-1-richard@nod.at> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,T_SPF_PERMERROR autolearn=unavailable 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 [Resending this series because I got to git add two header files.] After a longer hiatus I'm sending the next iteration of my re-export improvement patch series. While the kernel side is upstream since v6.2, the nfs-utils parts are still missing. This patch series aims to solve this. The core idea is adding new export option, reeport=3D Using reexport=3D it is possible to mark an export entry in the exports file explicitly as NFS re-export and select a strategy on how unique identifiers should be provided. This makes the crossmnt feature work in the re-export case. Currently two strategies are supported, "auto-fsidnum" and "predefined-fsidnum". In my earlier series a sqlite database was mandatory to keep track of generated fsids. This series follows a different approach, instead of directly using sqlite in all nfs-utils components (linking libsqlite), a new deamon manages the database, fsidd. fsidd offers a simple (but stupid?) text based interface over a unix doma= in socket which can be queried by mountd, exportfs, etc. for fsidnums. The main idea behind fsidd is allowing users to implement their own fsidd which keeps global state across load balancers. I'm still not happy with fsidd, there is room for improvement but first I'd like to know whether you like or hate this approach. A typical export entry on a re-exporting server looks like: /nfs *(rw,no_root_squash,no_subtree_check,crossmnt,reexport=3Dauto-f= sidnum) reexport=3Dauto-fsidnum will automatically assign an fsid=3D to /nfs and = all uncovered subvolumes. Changes since v1, https://lore.kernel.org/linux-nfs/20220502085045.13038-= 1-richard@nod.at/ - Factor out Sqlite and put it into a daemon - Add fsidd - Basically re-implemented the patch series - Lot's of fixes (e.g. nfs v4 root export) Richard Weinberger (2): export: Add reexport=3D option Implement fsidd configure.ac | 1 + support/Makefile.am | 2 +- support/export/Makefile.am | 2 + support/export/cache.c | 74 ++++++- support/export/export.c | 27 ++- support/include/nfslib.h | 1 + support/nfs/Makefile.am | 1 + support/nfs/exports.c | 62 ++++++ support/reexport/Makefile.am | 18 ++ support/reexport/backend_sqlite.c | 267 +++++++++++++++++++++++ support/reexport/fsidd.c | 198 +++++++++++++++++ support/reexport/reexport.c | 327 ++++++++++++++++++++++++++++ support/reexport/reexport.h | 18 ++ support/reexport/reexport_backend.h | 47 ++++ systemd/Makefile.am | 2 + systemd/fsidd.service | 9 + utils/exportd/Makefile.am | 6 +- utils/exportd/exportd.c | 5 + utils/exportfs/Makefile.am | 3 + utils/exportfs/exportfs.c | 11 + utils/exportfs/exports.man | 31 +++ utils/mount/Makefile.am | 3 +- utils/mountd/Makefile.am | 2 + 23 files changed, 1106 insertions(+), 11 deletions(-) create mode 100644 support/reexport/Makefile.am create mode 100644 support/reexport/backend_sqlite.c create mode 100644 support/reexport/fsidd.c create mode 100644 support/reexport/reexport.c create mode 100644 support/reexport/reexport.h create mode 100644 support/reexport/reexport_backend.h create mode 100644 systemd/fsidd.service --=20 2.31.1