From nobody Sat Nov 25 02:52:55 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Scbxv0HQkz523yH; Sat, 25 Nov 2023 02:53:07 +0000 (UTC) (envelope-from rick.macklem@gmail.com) Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Scbxt1TLQz3K9l; Sat, 25 Nov 2023 02:53:06 +0000 (UTC) (envelope-from rick.macklem@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20230601 header.b="MHR2J/Vu"; spf=pass (mx1.freebsd.org: domain of rick.macklem@gmail.com designates 2607:f8b0:4864:20::102e as permitted sender) smtp.mailfrom=rick.macklem@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pj1-x102e.google.com with SMTP id 98e67ed59e1d1-2859bde1d62so536699a91.2; Fri, 24 Nov 2023 18:53:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700880785; x=1701485585; darn=freebsd.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=MKJi58AdBzxNYF1SsTgU2c3Jo9CeARVUMJpt9Jhs0pA=; b=MHR2J/VuPnz1+WIXl1W5PsHjk0nudl3hOc9Bk00suHLjrukCJD2w7lP+swNtZWpqeA 8unRKtgvfOM9d4rvGG0zwlROV235scxierMSqB3dk+tO3LOSzW3lKhnJY2TjCk/9HF/1 Ek3X4npiyq4+D/E2bbGfqFGjMqM4dLJhcvVUzASdaPJY5kNZJ5rNDiLjIH3SvKX996LP HBrfuf4YD0p+oq/vDxKEV9wNtVKqfgd5fXgyt4pjFZZzuOnNVmgz/jMRWbX6IhPG/c8a O/Iw/BjI+pzZ84n3H3H2Z0Nwrw+C2PTCXBRIoqfJVfJ/yA+HBJMhnbehsQ2lGUqqjLww lPTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700880785; x=1701485585; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MKJi58AdBzxNYF1SsTgU2c3Jo9CeARVUMJpt9Jhs0pA=; b=qpYApM62jRk7lXqAWfoclwPAer2NCHH8bGkXhypn9G2vFCxm3Fxhk+Nf/HuaYpVCuJ F23JDmvr6eQRWQE1DPZ5stQNHaQkcskgBGWen67KQjjwCC4/X4InX15V/0GmQk2loFY7 DhAPtRykFmKYlhy0BVa3pmhiOQ/fNxvKJevy8fOLkXHQpfx19VzY1/xQJ1j70PpULEla ntpLmFLCHc4TVgoRyzVY5jt6tR+IfE3+ZMUv7c2Z4SM32JdXgMIfYV0MAMVpmBFL4Kfr mP1k/uwmYLHTcdIiAZoKj20oX6P812O7TWbYM292mCNtVDdtkJyn1Pzh4N3OUJ2NgStA v+/Q== X-Gm-Message-State: AOJu0Yw60gMb2ecr6wvRzKcUxYNSS3jVMfHOFeWx0SZjph7FjiUo1Kv3 uxIFmLsiMAhsM6WERt3wdHiK8vjluACrpVJnnw== X-Google-Smtp-Source: AGHT+IF2tglO1ovGkZneTZ+cREmtqQPSCIXu1DhyxQvRxpvRNdk0Lu8UIV8KHAW72wV4qI/ZT3GdwUxD9LaiEMwOj/0= X-Received: by 2002:a17:90b:4ad1:b0:285:9860:8a8a with SMTP id mh17-20020a17090b4ad100b0028598608a8amr3262484pjb.7.1700880784625; Fri, 24 Nov 2023 18:53:04 -0800 (PST) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 References: <202311231525.3ANFPBo6039293@gitrepo.freebsd.org> <987d4593d50b9cbffb9b6443d3825499@Leidinger.net> In-Reply-To: From: Rick Macklem Date: Fri, 24 Nov 2023 18:52:55 -0800 Message-ID: Subject: Re: git: f5f277728ade - main - nfsd: Fix NFS access to .zfs/snapshot snapshots To: Mike Karels Cc: Konstantin Belousov , Alexander Leidinger , Rick Macklem , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.998]; NEURAL_HAM_LONG(-0.99)[-0.992]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20230601]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; MIME_GOOD(-0.10)[text/plain]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::102e:from]; TAGGED_FROM(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; MLMMJ_DEST(0.00)[dev-commits-src-all@freebsd.org,dev-commits-src-main@freebsd.org]; DKIM_TRACE(0.00)[gmail.com:+]; MID_RHS_MATCH_FROMTLD(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCPT_COUNT_SEVEN(0.00)[7]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_ONE(0.00)[1]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; FREEMAIL_CC(0.00)[gmail.com,leidinger.net,freebsd.org] X-Rspamd-Queue-Id: 4Scbxt1TLQz3K9l X-Spamd-Bar: --- On Fri, Nov 24, 2023 at 4:15=E2=80=AFPM Rick Macklem wrote: > > On Fri, Nov 24, 2023 at 3:35=E2=80=AFPM Rick Macklem wrote: > > > > On Fri, Nov 24, 2023 at 8:16=E2=80=AFAM Rick Macklem wrote: > > > > > > On Fri, Nov 24, 2023 at 7:58=E2=80=AFAM Rick Macklem wrote: > > > > > > > > On Fri, Nov 24, 2023 at 5:18=E2=80=AFAM Mike Karels wrote: > > > > > > > > > > CAUTION: This email originated from outside of the University of = Guelph. Do not click links or open attachments unless you recognize the sen= der and know the content is safe. If in doubt, forward suspicious emails to= IThelp@uoguelph.ca. > > > > > > > > > > > > > > > On 24 Nov 2023, at 7:02, Konstantin Belousov wrote: > > > > > > > > > > > On Fri, Nov 24, 2023 at 08:50:22AM +0100, Alexander Leidinger w= rote: > > > > > >> Am 2023-11-23 16:25, schrieb Rick Macklem: > > > > > >>> The branch main has been updated by rmacklem: > > > > > >>> > > > > > >>> URL: https://cgit.FreeBSD.org/src/commit/?id=3Df5f277728adec4= c5b3e840a1fb16bd16f8cc956d > > > > > >>> > > > > > >>> commit f5f277728adec4c5b3e840a1fb16bd16f8cc956d > > > > > >>> Author: Rick Macklem > > > > > >>> AuthorDate: 2023-11-23 15:23:33 +0000 > > > > > >>> Commit: Rick Macklem > > > > > >>> CommitDate: 2023-11-23 15:23:33 +0000 > > > > > >>> > > > > > >>> nfsd: Fix NFS access to .zfs/snapshot snapshots > > > > > >>> > > > > > >>> When a process attempts to access a snapshot under > > > > > >>> //.zfs/snapshot, the snapshot is automounted. > > > > > >>> However, without this patch, the automount does not > > > > > >>> set mnt_exjail, which results in the snapshot not being > > > > > >>> accessible over NFS. > > > > > >>> > > > > > >>> This patch defines a new function called vfs_exjail_clone= () > > > > > >>> which sets mnt_exjail from another mount point and > > > > > >>> then uses that function to set mnt_exjail in the snapshot > > > > > >>> automount. A separate patch that is currently a pull req= uest > > > > > >>> for OpenZFS, calls this function to fix the problem. > > > > > >> > > > > > >> May the same/similar fix like for ZFS be needed / useful for n= ullfs mounted > > > > > >> stuff? > > > > > >> > > > > > >> I have a ZFS dataset which is mounted via nullfs into a jail. = This > > > > > >> nullfs-mount is then exported via samba. In samba I have the s= hadow-copy > > > > > >> stuff enabled, but it doesn't work, as the jails can't access = the snapshot. > > > > > > > > > > > > Jails cannot access snapshots because, as I understand, snapsho= ts > > > > > > are mounts. Nullfs does not provide an option to recursively by= pass > > > > > > into mounts. The patch you responded to does not automatically = mounts > > > > > > snapshots on clients, it only allows them to mount if wanted. > > > > > > > > > > It works for me, with main and this change, or 13.2 without a pat= ch. > > > > > I don't know the mechanics, but it doesn't use nullfs, and the sn= apshot > > > > > does not show up as a separate filesystem with the mount command. > > > > Yes. ZFS essentially does an automount of the snapshots under .zfs/= snapshot. > > > > (As I understand it, there are non-default ZFS options that allow t= hese to be > > > > mounted manually instead.) > > > > I can now see that these automounts are 'real mounts" in the > > > > mountlist. The only reason > > > > they are not visible is that they have MNT_IGNORE set on them. > > > Oh and I forgot to mention that this automount is for some weird in > > > memory file system that does just enough so you can see the snapshots= . > > > Once you "cd ", the vnodes are associated with the ZFS > > > mount (dataset) and not this weird snapshot fs. (That is why it doesn= 't need to > > > be exported, but did need mnt_exjail to be set properly.) > > > > > > I might be able to test a nullfs over ZFS case later to-day and will > > > post if I do so. > > Yes, it is broken in a similar way. With a nullfs mount on top of a ZFS= mount > > that is exported to an NFS client, you can access the snapshots under > > .zfs/snapshot > > if the mnt_exjail checks are commented out. > > However, if the checks are done, they fail. > > > > So, yes, something similar to what ZFS will do is needed for nullfs. > > Now I have to figure out how/when it can be done. I will play with it t= o-day, > > but it probably won't get fixed until late Dec. > Oops. Now my test is not working, even when the mnt_exjail check is > commented out. > (When I NFS mount the ZFS , I can see the snapshots under > .zfs/snapshot, > but when I NFS mount the nullfs mount that is on top of the ZFS > I do not see it. > > So, I think Kostik is correct and it does not see the .zfs/snapshot autom= ount. > > I don't know how I screwed up on the first test after I disabled the > mnt_exjail check, but > it does not appear to have broken this case after all. More info. Thanks to some off-list info from Mike Karels I tried it again. It turns out that the nullfs on top of ZFS export (the nullfs mount must be exported) sorta works. When you cd .zfs/snapshot/, it works. What doesn't work is: cd .zfs/snapshot ls --> which does not show the snapshot names The snapshot names are shown for a mount of the ZFS file system. So, it seems that the Readdir has issues for a nullfs on top of ZFS export for the .zfs/snapshot directory. I will poke at it some more in late Dec., but it does not seem to be a problem related to mnt_exjail. rick > > rick > > > > > Again, sorry for the breakage, rick > > > > > > > > rick > > > > > > > > > > > Now, as for what happens when nullfs is on top of ZFS, I do not kno= w. > > > > What Kostik says about nullfs recursing into mounts suggests it wil= l not work. > > > > I will look at it, but since I am headed to Florida for a few weeks= , it may > > > > not happen until the end of the year. > > > > > > > > If someone can test this case and determine if there is no NFS clie= nt access > > > > for snapshots under .zfs after applying the patch that is an > > > > attachment in PR#275200 > > > > when nullfs is over the ZFS file system, that would be appreciated. > > > > > > > > rick > > > > > > > > > > > > > > Mike > > > > > > > > > > > You might try to set up something with autofs, no idea if it co= uld be made > > > > > > to work usefully. > > > > >