NetBSD Problem Report #57467

From www@netbsd.org  Mon Jun 12 23:10:58 2023
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id CF4EE1A9239
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 12 Jun 2023 23:10:57 +0000 (UTC)
Message-Id: <20230612231056.D40FC1A923D@mollari.NetBSD.org>
Date: Mon, 12 Jun 2023 23:10:56 +0000 (UTC)
From: nervoso@k1.com.br
Reply-To: nervoso@k1.com.br
To: gnats-bugs@NetBSD.org
Subject: zfs cannot umount snapshots once access it via /usr/.zfs/shapshots/ ....
X-Send-Pr-Version: www-1.0

>Number:         57467
>Category:       kern
>Synopsis:       zfs cannot umount snapshots once access it via /usr/.zfs/shapshots/ ....
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jun 12 23:15:00 +0000 2023
>Last-Modified:  Mon Jun 19 21:35:01 +0000 2023
>Originator:     sergio lenzi
>Release:        10.99.4
>Organization:
k1 sistemas
>Environment:
NetBSD lenzi.lenzicasa 10.99.4 NetBSD 10.99.4 (LZT) #14: Sun Jun 11 12:23:15 -03 2023  NetBSD@devel.lenzicasa:/home/NetBSD/BUILD/10/amd64/OBJ/sys/arch/amd64/compile/GENERIC amd64
>Description:
when access a snapsht for example:
cd /usr/.zfs/snapshots/2023-06-02_23.59.00--7d.
the system accepts by mounting a zfs node into that position...
I can access all the files ... do rsync ...  etc.. 
but once I leave the directory, the mountpoint remains, and
there is NO WAY to umount it... umount /usr/.zfs/.... => operation not permitted even on root
>How-To-Repeat:
on a NetBSD 10.99.4 system running zfs...
zfs list -t snap
choose snapshot to mount
cd /path/.zfs/snapshot/......  
cp some files to /tmp or whatever
exit directory...


the snapshot remains mounted and there is no way to umount it unless reboot
>Fix:

>Audit-Trail:
From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/57467: zfs cannot umount snapshots once access it via /usr/.zfs/shapshots/ ....
Date: Tue, 13 Jun 2023 06:07:51 -0000 (UTC)

 nervoso@k1.com.br writes:

 >but once I leave the directory, the mountpoint remains, and
 >there is NO WAY to umount it... umount /usr/.zfs/.... => operation not permitted even on root

 The zfs tool doesn't umount because a snapshot is of the wrong type. This might still be true for ZFS-on-Linux.

 The regular umount (which works on Linux) fails with "Invalid argument"
 because the snapshot is mounted with a vnode that isn't marked as VV_ROOT.
 I'm not sure if that flag could easily be set for it.

From: Sergio de Almeida Lenzi <nervoso@k1.com.br>
To: gnats-bugs@netbsd.org, kern-bug-people@netbsd.org, gnats-admin@netbsd.org,
        netbsd-bugs@netbsd.org
Cc: 
Subject: Re: kern/57467: zfs cannot umount snapshots once access it via
 /usr/.zfs/shapshots/ ....
Date: Tue, 13 Jun 2023 11:42:15 -0300

 --=-AjuwFTWJtSU0PPMm2Dxz
 Content-Type: text/plain; charset="UTF-8"
 Content-Transfer-Encoding: 8bit

 Em ter, 2023-06-13 às 06:10 +0000, Michael van Elst escreveu:
 > The following reply was made to PR kern/57467; it has been noted by GNATS.
 > From: mlelstv@serpens.de (Michael van Elst)To: gnats-bugs@netbsd.org
 > Cc: Subject: Re: kern/57467: zfs cannot umount snapshots once access it via /usr/.zfs/shapshots/ ....Date: Tue, 13 Jun 2023 06:07:51 -0000 (UTC)
 >  nervoso@k1.com.br writes:  >but once I leave the directory, the mountpoint remains, and >there is NO WAY to umount it... umount /usr/.zfs/.... => operation not permitted even on root  The zfs tool doesn't umount because a snapshot is of the wrong type. This might still be true for ZFS-on-Linux.
 is there a patch for this issue???   on FreeBSD it works ok .
 >   The regular umount (which works on Linux) fails with "Invalid argument" because the snapshot is mounted with a vnode that isn't marked as VV_ROOT. I'm not sure if that flag could easily be set for it. 
 If I patch zfsmount to set the VV_ROOT  will it work?


 are there working on zfs to resolve these issues???

 Ty



 --=-AjuwFTWJtSU0PPMm2Dxz
 Content-Type: text/html; charset="utf-8"
 Content-Transfer-Encoding: quoted-printable

 <html dir=3D"ltr"><head></head><body style=3D"text-align:left; direction:lt=
 r;" bgcolor=3D"#ffffff" text=3D"#000000" link=3D"#0000ee" vlink=3D"#0000ee"=
 ><div>Em ter, 2023-06-13 =C3=A0s 06:10 +0000, Michael van Elst escreveu:</d=
 iv><blockquote type=3D"cite" style=3D"margin:0 0 0 .8ex; border-left:2px #7=
 29fcf solid;padding-left:1ex"><pre>The following reply was made to PR kern/=
 57467; it has been noted by GNATS.</pre><pre><br></pre><pre>From: </pre><a =
 href=3D"mailto:mlelstv@serpens.de"><pre>mlelstv@serpens.de</pre></a><pre> (=
 Michael van Elst)</pre><pre>To: </pre><a href=3D"mailto:gnats-bugs@netbsd.o=
 rg"><pre>gnats-bugs@netbsd.org</pre></a><pre><br></pre><pre>Cc: </pre><pre>=
 Subject: Re: kern/57467: zfs cannot umount snapshots once access it via /us=
 r/.zfs/shapshots/ ....</pre><pre>Date: Tue, 13 Jun 2023 06:07:51 -0000 (UTC=
 )</pre><pre><br></pre><pre> </pre><a href=3D"mailto:nervoso@k1.com.br"><pre=
 >nervoso@k1.com.br</pre></a><pre> writes:</pre><pre> </pre><pre> &gt;but on=
 ce I leave the directory, the mountpoint remains, and</pre><pre> &gt;there =
 is NO WAY to umount it... umount /usr/.zfs/.... =3D&gt; operation not permi=
 tted even on root</pre><pre> </pre><pre> The zfs tool doesn't umount becaus=
 e a snapshot is of the wrong type. This might still be true for ZFS-on-Linu=
 x.</pre></blockquote><div>is there a patch for this issue???   on FreeBSD i=
 t works ok .</div><blockquote type=3D"cite" style=3D"margin:0 0 0 .8ex; bor=
 der-left:2px #729fcf solid;padding-left:1ex"><pre> </pre><pre> The regular =
 umount (which works on Linux) fails with "Invalid argument"</pre><pre> beca=
 use the snapshot is mounted with a vnode that isn't marked as VV_ROOT.</pre=
 ><pre> I'm not sure if that flag could easily be set for it.</pre><pre> </p=
 re></blockquote><div>If I patch zfsmount to set the VV_ROOT  will it work?<=
 /div><div><br></div><div><br></div><div>are there working on zfs to resolve=
  these issues???</div><div><br></div><div>Ty</div><div><br></div></body></h=
 tml>

 --=-AjuwFTWJtSU0PPMm2Dxz--

From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/57467: zfs cannot umount snapshots once access it via /usr/.zfs/shapshots/ ....
Date: Wed, 14 Jun 2023 15:11:20 -0000 (UTC)

 nervoso@k1.com.br (Sergio de Almeida Lenzi) writes:

 >>   The regular umount (which works on Linux) fails with "Invalid argument" because the snapshot is mounted with a vnode that isn't marked as VV_ROOT. I'm not sure if that flag could easily be set for it. 

 >If I patch zfsmount to set the VV_ROOT  will it work?

 vnodes are part of the kernel. I don't know if that will work or if this
 wreaks havoc...

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/57467: zfs cannot umount snapshots once access it via
 /usr/.zfs/shapshots/ ....
Date: Fri, 16 Jun 2023 03:53:04 +0000

 On Wed, Jun 14, 2023 at 03:15:02PM +0000, Michael van Elst wrote:
  >  >If I patch zfsmount to set the VV_ROOT  will it work?
  >  
  >  vnodes are part of the kernel. I don't know if that will work or if this
  >  wreaks havoc...

 Could go either way.

 Without VV_ROOT, what happens with getcwd and/or looking up .. from
 the top? Seems likely to be bust.

 -- 
 David A. Holland
 dholland@netbsd.org

From: "J. Hannken-Illjes" <hannken@mailbox.org>
To: NetBSD GNATS <gnats-bugs@netbsd.org>
Cc: 
Subject: Re: kern/57467: zfs cannot umount snapshots once access it via
 /usr/.zfs/shapshots/ ....
Date: Fri, 16 Jun 2023 09:53:53 +0200

 > On 16. Jun 2023, at 05:55, David Holland <dholland-bugs@netbsd.org> wrote:
 > 
 > The following reply was made to PR kern/57467; it has been noted by GNATS.
 > 
 > From: David Holland <dholland-bugs@netbsd.org>
 > To: gnats-bugs@netbsd.org
 > Cc: 
 > Subject: Re: kern/57467: zfs cannot umount snapshots once access it via
 > /usr/.zfs/shapshots/ ....
 > Date: Fri, 16 Jun 2023 03:53:04 +0000
 > 
 > On Wed, Jun 14, 2023 at 03:15:02PM +0000, Michael van Elst wrote:
 >>> If I patch zfsmount to set the VV_ROOT  will it work?
 >> 
 >> vnodes are part of the kernel. I don't know if that will work or if this
 >> wreaks havoc...
 > 
 > Could go either way.
 > 
 > Without VV_ROOT, what happens with getcwd and/or looking up .. from
 > the top? Seems likely to be bust.

 ZFS tries to hide this mount as much as possible.  When NFS exporting
 a ZFS file system the control directory AND the snapshots here are
 on the same export.

 See zfs_vnops.c, lines 2071 and 3105 for ".." and getcwd support.

 What is the benefit of unmounting snapshots from the snapshot control
 directory?  They will remount on the next lookup anyway.

 --
 J. Hannken-Illjes - hannken@mailbox.org

From: Sergio de Almeida Lenzi <nervoso@k1.com.br>
To: gnats-bugs@netbsd.org, kern-bug-people@netbsd.org, gnats-admin@netbsd.org,
        netbsd-bugs@netbsd.org
Cc: 
Subject: Re: kern/57467: zfs cannot umount snapshots once access it via
 /usr/.zfs/shapshots/ ....
Date: Mon, 19 Jun 2023 18:34:16 -0300

 --=-WwcHOQLlyv247kaIWdFa
 Content-Type: text/plain; charset="UTF-8"
 Content-Transfer-Encoding: 8bit

 Em sex, 2023-06-16 às 07:55 +0000, J. Hannken-Illjes escreveu:
 > The following reply was made to PR kern/57467; it has been noted by GNATS.
 > From: "J. Hannken-Illjes" <hannken@mailbox.org>To: NetBSD GNATS <gnats-bugs@netbsd.org>Cc: Subject: Re: kern/57467: zfs cannot umount snapshots once access it via /usr/.zfs/shapshots/ ....Date: Fri, 16 Jun 2023 09:53:53 +0200
 >  > On 16. Jun 2023, at 05:55, David Holland <dholland-bugs@netbsd.org> wrote: >  > The following reply was made to PR kern/57467; it has been noted by GNATS. >  > From: David Holland <dholland-bugs@netbsd.org> > To: gnats-bugs@netbsd.org
 >  > Cc:  > Subject: Re: kern/57467: zfs cannot umount snapshots once access it via > /usr/.zfs/shapshots/ .... > Date: Fri, 16 Jun 2023 03:53:04 +0000 >  > On Wed, Jun 14, 2023 at 03:15:02PM +0000, Michael van Elst wrote: >>> If I patch zfsmount to set the VV_ROOT  will it work? >>  >> vnodes are part of the kernel. I don't know if that will work or if this >> wreaks havoc... >  > Could go either way. >  > Without VV_ROOT, what happens with getcwd and/or looking up .. from > the top? Seems likely to be bust.  ZFS tries to hide this mount as much as possible.  When NFS exporting a ZFS file system the control directory AND the snapshots here are on the same export.  See zfs_vnops.c, lines 2071 and 3105 for ".." and getcwd support.  What is the benefit of unmounting snapshots from the snapshot control directory?  They will remount on the next lookup anyway.  -- J. Hannken-Illjes - hannken@mailbox.org
 >  
 I was just thinking in zfs make the same behavior as in FreeBSD... that it does not show the mountpoints on snapshots,
 but I do now now if FreeBSD keep them mounted, just do not show.

 besides... if I leave the snapshot directory... and come back later... it remounts the snapshot again... 
 We have lots NetBSD system running on ZFS that does not reboots for months  in crytical mission as fileservers 
 exporting smb  on top of zfs. for 32 tb on 4 16TB drives.. the users sometimes "misses"  files and they have a "smbshare" named "backup", that
 walks over the snapshot tree...  when they do that, after some time, there are a great number of mount points... 
 I was just wondering if the open files, would exsauted and the server would lock or reboot...
 we also use the zfs sync=disabled.. and always with a 2 mirror drives on every zpool...

 --=-WwcHOQLlyv247kaIWdFa
 Content-Type: text/html; charset="utf-8"
 Content-Transfer-Encoding: quoted-printable

 <html dir=3D"ltr"><head></head><body style=3D"text-align:left; direction:lt=
 r;" bgcolor=3D"#ffffff" text=3D"#000000" link=3D"#0000ee" vlink=3D"#0000ee"=
 ><div>Em sex, 2023-06-16 =C3=A0s 07:55 +0000, J. Hannken-Illjes escreveu:</=
 div><blockquote type=3D"cite" style=3D"margin:0 0 0 .8ex; border-left:2px #=
 729fcf solid;padding-left:1ex"><pre>The following reply was made to PR kern=
 /57467; it has been noted by GNATS.</pre><pre><br></pre><pre>From: "J. Hann=
 ken-Illjes" &lt;</pre><a href=3D"mailto:hannken@mailbox.org"><pre>hannken@m=
 ailbox.org</pre></a><pre>&gt;</pre><pre>To: NetBSD GNATS &lt;</pre><a href=
 =3D"mailto:gnats-bugs@netbsd.org"><pre>gnats-bugs@netbsd.org</pre></a><pre>=
 &gt;</pre><pre>Cc: </pre><pre>Subject: Re: kern/57467: zfs cannot umount sn=
 apshots once access it via</pre><pre> /usr/.zfs/shapshots/ ....</pre><pre>D=
 ate: Fri, 16 Jun 2023 09:53:53 +0200</pre><pre><br></pre><pre> &gt; On 16. =
 Jun 2023, at 05:55, David Holland &lt;</pre><a href=3D"mailto:dholland-bugs=
 @netbsd.org"><pre>dholland-bugs@netbsd.org</pre></a><pre>&gt; wrote:</pre><=
 pre> &gt; </pre><pre> &gt; The following reply was made to PR kern/57467; i=
 t has been noted by GNATS.</pre><pre> &gt; </pre><pre> &gt; From: David Hol=
 land &lt;</pre><a href=3D"mailto:dholland-bugs@netbsd.org"><pre>dholland-bu=
 gs@netbsd.org</pre></a><pre>&gt;</pre><pre> &gt; To: </pre><a href=3D"mailt=
 o:gnats-bugs@netbsd.org"><pre>gnats-bugs@netbsd.org</pre></a><pre><br></pre=
 ><pre> &gt; Cc: </pre><pre> &gt; Subject: Re: kern/57467: zfs cannot umount=
  snapshots once access it via</pre><pre> &gt; /usr/.zfs/shapshots/ ....</pr=
 e><pre> &gt; Date: Fri, 16 Jun 2023 03:53:04 +0000</pre><pre> &gt; </pre><p=
 re> &gt; On Wed, Jun 14, 2023 at 03:15:02PM +0000, Michael van Elst wrote:<=
 /pre><pre> &gt;&gt;&gt; If I patch zfsmount to set the VV_ROOT  will it wor=
 k?</pre><pre> &gt;&gt; </pre><pre> &gt;&gt; vnodes are part of the kernel. =
 I don't know if that will work or if this</pre><pre> &gt;&gt; wreaks havoc.=
 ..</pre><pre> &gt; </pre><pre> &gt; Could go either way.</pre><pre> &gt; </=
 pre><pre> &gt; Without VV_ROOT, what happens with getcwd and/or looking up =
 .. from</pre><pre> &gt; the top? Seems likely to be bust.</pre><pre> </pre>=
 <pre> ZFS tries to hide this mount as much as possible.  When NFS exporting=
 </pre><pre> a ZFS file system the control directory AND the snapshots here =
 are</pre><pre> on the same export.</pre><pre> </pre><pre> See zfs_vnops.c, =
 lines 2071 and 3105 for ".." and getcwd support.</pre><pre> </pre><pre> Wha=
 t is the benefit of unmounting snapshots from the snapshot control</pre><pr=
 e> directory?  They will remount on the next lookup anyway.</pre><pre> </pr=
 e><pre> --</pre><pre> J. Hannken-Illjes - </pre><a href=3D"mailto:hannken@m=
 ailbox.org"><pre>hannken@mailbox.org</pre></a><pre><br></pre><pre> </pre></=
 blockquote><div>I was just thinking in zfs make the same behavior as in Fre=
 eBSD... that it does not show the mountpoints on snapshots,</div><div>but I=
  do now now if FreeBSD keep them mounted, just do not show.</div><div><br><=
 /div><div>besides... if I leave the snapshot directory... and come back lat=
 er... it remounts the snapshot again... </div><div>We have lots NetBSD syst=
 em running on ZFS that does not reboots for months  in crytical mission as =
 fileservers </div><div>exporting smb  on top of zfs. for 32 tb on 4 16TB dr=
 ives.. the users sometimes "misses"  files and they have a "smbshare" named=
  "backup", that</div><div>walks over the snapshot tree...  when they do tha=
 t, after some time, there are a great number of mount points... </div><div>=
 I was just wondering if the open files, would exsauted and the server would=
  lock or reboot...</div><div>we also use the zfs sync=3Ddisabled.. and alwa=
 ys with a 2 mirror drives on every zpool...</div><div><br></div></body></ht=
 ml>

 --=-WwcHOQLlyv247kaIWdFa--

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.