Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Nov 2023 21:07:45 -0800
From:      Rick Macklem <rick.macklem@gmail.com>
To:        Mike Karels <mike@karels.net>
Cc:        Konstantin Belousov <kostikbel@gmail.com>, Alexander Leidinger <Alexander@leidinger.net>,  Rick Macklem <rmacklem@freebsd.org>, src-committers@freebsd.org,  dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org
Subject:   Re: git: f5f277728ade - main - nfsd: Fix NFS access to .zfs/snapshot snapshots
Message-ID:  <CAM5tNy6r6hvP0basw5SMGE%2B5yBe=JUw7312e%2B_6V2vFXojUSfw@mail.gmail.com>
In-Reply-To: <CAM5tNy6bG%2Bii3HVW2PVj__AdZ8GGbH0L6H7h456kpt4pYn54Lw@mail.gmail.com>
References:  <202311231525.3ANFPBo6039293@gitrepo.freebsd.org> <987d4593d50b9cbffb9b6443d3825499@Leidinger.net> <ZWCe8k_lxWSpDA1L@kib.kiev.ua> <F4EB20B7-5AB8-4448-84BB-462BC7C37398@karels.net> <CAM5tNy5zLnDwxWuJ_u87k-c6WPwwp=MNjvDVto0=A9mwpyWc=g@mail.gmail.com> <CAM5tNy47MLeWdPEhV9LgVH84KB7Gmwpqmzxb62OET52Pn7pWJA@mail.gmail.com> <CAM5tNy5%2BKgsHo4Q7Eth1pU5M1SJzWcnRK%2BRGvHipyf_rHHQJGA@mail.gmail.com> <CAM5tNy6huM-LQmqhX1%2B=LFrwGy1cq37YqtwZVyc8jL88P0i3QQ@mail.gmail.com> <CAM5tNy6bG%2Bii3HVW2PVj__AdZ8GGbH0L6H7h456kpt4pYn54Lw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Just to summarize...
Mike Karels has done a simple test that works, so I don't
know why my tests have misbehaved.

I will do some more tests in a few weeks.

If you encounter problems accessing snapshots under .zfs/snapshot
over NFS when you have added the patch in PR#275200, please post.

rick

On Fri, Nov 24, 2023 at 6:52=E2=80=AFPM Rick Macklem <rick.macklem@gmail.co=
m> wrote:
>
> On Fri, Nov 24, 2023 at 4:15=E2=80=AFPM Rick Macklem <rick.macklem@gmail.=
com> wrote:
> >
> > On Fri, Nov 24, 2023 at 3:35=E2=80=AFPM Rick Macklem <rick.macklem@gmai=
l.com> wrote:
> > >
> > > On Fri, Nov 24, 2023 at 8:16=E2=80=AFAM Rick Macklem <rick.macklem@gm=
ail.com> wrote:
> > > >
> > > > On Fri, Nov 24, 2023 at 7:58=E2=80=AFAM Rick Macklem <rick.macklem@=
gmail.com> wrote:
> > > > >
> > > > > On Fri, Nov 24, 2023 at 5:18=E2=80=AFAM Mike Karels <mike@karels.=
net> wrote:
> > > > > >
> > > > > > CAUTION: This email originated from outside of the University o=
f Guelph. Do not click links or open attachments unless you recognize the s=
ender 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=
 wrote:
> > > > > > >> 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=3Df5f277728ade=
c4c5b3e840a1fb16bd16f8cc956d
> > > > > > >>>
> > > > > > >>> commit f5f277728adec4c5b3e840a1fb16bd16f8cc956d
> > > > > > >>> Author:     Rick Macklem <rmacklem@FreeBSD.org>
> > > > > > >>> AuthorDate: 2023-11-23 15:23:33 +0000
> > > > > > >>> Commit:     Rick Macklem <rmacklem@FreeBSD.org>
> > > > > > >>> 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
> > > > > > >>>     /<dataset>/.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_clo=
ne()
> > > > > > >>>     which sets mnt_exjail from another mount point and
> > > > > > >>>     then uses that function to set mnt_exjail in the snapsh=
ot
> > > > > > >>>     automount.  A separate patch that is currently a pull r=
equest
> > > > > > >>>     for OpenZFS, calls this function to fix the problem.
> > > > > > >>
> > > > > > >> May the same/similar fix like for ZFS be needed / useful for=
 nullfs 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=
 shadow-copy
> > > > > > >> stuff enabled, but it doesn't work, as the jails can't acces=
s the snapshot.
> > > > > > >
> > > > > > > Jails cannot access snapshots because, as I understand, snaps=
hots
> > > > > > > are mounts. Nullfs does not provide an option to recursively =
bypass
> > > > > > > into mounts. The patch you responded to does not automaticall=
y 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 p=
atch.
> > > > > > I don't know the mechanics, but it doesn't use nullfs, and the =
snapshot
> > > > > > does not show up as a separate filesystem with the mount comman=
d.
> > > > > Yes. ZFS essentially does an automount of the snapshots under .zf=
s/snapshot.
> > > > > (As I understand it, there are non-default ZFS options that allow=
 these 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 snapsho=
ts.
> > > > Once you "cd <some-snapshot>", the vnodes are associated with the Z=
FS
> > > > mount (dataset) and not this weird snapshot fs. (That is why it doe=
sn'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 wil=
l
> > > > post if I do so.
> > > Yes, it is broken in a similar way. With a nullfs mount on top of a Z=
FS 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=
 to-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 <dataset>, I can see the snapshots under
> > .zfs/snapshot,
> > but when I NFS mount the nullfs mount that is on top of the ZFS
> > <dataset> I do not see it.
> >
> > So, I think Kostik is correct and it does not see the .zfs/snapshot aut=
omount.
> >
> > 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/<snapshot-name>, 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 k=
now.
> > > > > What Kostik says about nullfs recursing into mounts suggests it w=
ill not work.
> > > > > I will look at it, but since I am headed to Florida for a few wee=
ks, it may
> > > > > not happen until the end of the year.
> > > > >
> > > > > If someone can test this case and determine if there is no NFS cl=
ient 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 appreciate=
d.
> > > > >
> > > > > rick
> > > > >
> > > > > >
> > > > > >                 Mike
> > > > > >
> > > > > > > You might try to set up something with autofs, no idea if it =
could be made
> > > > > > > to work usefully.
> > > > > >



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAM5tNy6r6hvP0basw5SMGE%2B5yBe=JUw7312e%2B_6V2vFXojUSfw>