Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Feb 2019 17:12:33 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 235863] file loss when adding faulty entry in a jail's /etc/fstab.foo after removing jail
Message-ID:  <bug-235863-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D235863

            Bug ID: 235863
           Summary: file loss when adding faulty entry in a jail's
                    /etc/fstab.foo after removing jail
           Product: Base System
           Version: 11.2-RELEASE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: unixmig68@gmail.com

FreeBSD 11.2-RELEASE, *based on mfsbsd,
*not* tested on *vanilla* FreeBSD 11.2-RELEASE*.

Files are lost when the following steps are made:
Start a jail foo, edit its /etc/fstab.foo,
adding a nullfs-rw  mount that is not valid (e.g. non-existent mountpoint),
jail -r jail foo
When you remove the jail,
you get an error because of the wrong entry.
The main mountpoint of the jail is now still mounted.
When  you manually umount this remaining main mountpoint,
all nullfs-rw mount files are lost.

Expected result: files would not be lost
Actual result: files are lost

Example:
# cat /etc/fstab.maygo
/usr/jail/basejail                       /usr/jail/foo              nullfs =
 ro
/zroot/j/foo.d/foo.homedir       /usr/jail/foo/usr/home     nullfs  rw
/zroot/j/foo.d/foo.var           /usr/jail/foo/var          nullfs  rw
/zroot/j/foo.d/foo.tmp           /usr/jail/foo/tmp          nullfs  rw
/zroot/j/foo.d/foo.etc           /usr/jail/foo/etc          nullfs  rw
/zroot/j/foo.d/foo.root          /usr/jail/foo/root         nullfs  rw

# ---------------------------
# cat /etc/jail.conf
# Common configs for all jails
  mount.fstab =3D "/etc/fstab.${name}";
  exec.start =3D "/bin/sh /etc/rc";
  exec.stop =3D "/bin/sh /etc/rc.shutdown";
  exec.consolelog =3D "/var/log/jail_${name}_console.log";
  host.hostname =3D "${name}";
  allow.mount;
  devfs_ruleset =3D "4";
  mount.devfs;
  allow.set_hostname =3D 0;
  path  =3D "/usr/jail/${name}";

foo {
  ip4.addr =3D 10.2.2.4 ;
  interface =3D vtnet0;
  allow.sysvipc =3D 1;
  allow.raw_sockets =3D 1;
  persist;
}

# -----------------------------
# jls
   JID  IP Address      Hostname                      Path
# jail -c foo
foo: created
# find /zroot/j/foo.d | wc
     100     100    3971
# jls
   JID  IP Address      Hostname                      Path
    46  10.2.2.4        foo                         /usr/jail/foo
# echo "/zroot/j/foo.d/foo.root          /usr/jail/foo/NONEXISTENTDIR=20=20=
=20=20=20=20=20=20
nullfs  rw" >> /etc/fstab.foo
# tail -3 /etc/fstab.foo
/zroot/j/foo.d/foo.root          /usr/jail/foo/root         nullfs  rw

/zroot/j/foo.d/foo.root          /usr/jail/foo/NONEXISTENTDIR         nullf=
s=20
rw
# jail -r foo
foo: removed
jail: foo: mount.fstab: /usr/jail/foo/NONEXISTENTDIR: No such file or direc=
tory
# mount | grep foo
zroot/j/foo.d on /zroot/j/foo.d (zfs, local, noatime, nfsv4acls)
# umount /zroot/j/foo.d
# echo $?
0
# find /zroot/j/foo.d | wc
       1       1      17
# zfs list | grep foo
zroot/j/foo.d     34.0M  8.50G  34.0M  /zroot/j/foo.d
# zfs get mountpoint zroot/j/foo.d
NAME             PROPERTY    VALUE             SOURCE
zroot/j/foo.d  mountpoint  /zroot/j/foo.d  inherited from zroot
# mount zroot/j/foo.d /zroot/j/foo.d
mount: zroot/j/foo.d: No such file or directory

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-235863-227>