[bug] ZFS zvol dev entry disappearing upon reboot

Previous thread: [PATCH] Fix in6p_leave_group() panic by misbehaving apps by Bruce Simpson on Saturday, July 18, 2009 - 9:41 am. (3 messages)

Next thread: Re: [newnfs/client] SIGINFO aborts transfer and produces `permission denied' by Anonymous on Saturday, July 18, 2009 - 11:38 am. (1 message)
From: McLone
Date: Saturday, July 18, 2009 - 10:27 am

Hell Low.

As downloading torrent files from many peers to ZFS
imposes fragmentation (and there's no way to defragment
ZFS volume - what a pity! How come now-a-days FS can
go like this?), i created zvol with UFS2 on it last time
i wanted to watch some old sci-fi. I had plans to
move sci-fi from UFS2/zvol to ZFS when it'll be complete,
but forgot it, and rebooted machine. After reboot
rtorrent said sci-fi is marked as complete, but it
can not find files. I wasn't surprised, as i haven't modified
my /etc/fstab, so i entered "mount /dev/zvol" and pressed
Tab in hope of tcsh (eek) autocomplete.
It just beeped on me.
I've done "ls /dev" and there was no directory there named zvol.
Then i've done "zfs list" and my zvol was there.
Puzzled, i've done "zfs snapshot" and then a little dance of
"zfs send | zfs recv" to a new volume. Now dev entries appeared
(both for newly created snapshot of an old zvol and for new zvol).
I rebooted, and there was no /dev/zvol again.

I looked at my uname -v output (it was HEAD/amd64 from Jul 1)
and decided to update. Updating didn't solved this problem.

Strangely, simple "zfs rename zpool/zvol zpool/newzvol"
cures this woe, but i think this is a bug.

Steps to reproduce:
zfs create -V 1g zpool/zvol
[newfs /dev/zvol/zpool/zvol]
reboot
ls /dev

Workaround:
zfs rename zpool/zvol zpool/newzvol
mount /dev/zvol/zpool/zvol /mnt
-- 
wbr,                        |\      _,,,---,,_           dog bless ya!
`                       Zzz /,`.-'`'    -.  ;-;;,_
McLone at GMail dot com    |,4-  ) )-,_. ,\ (  `'-'
  net- and *BSD admin     '---''(_/--'  `-'\_)   ...translit rawx!
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
From: Thomas Backman
Date: Sunday, July 19, 2009 - 4:05 am

Hmm, I did a quick test and was unable to reproduce. There are ALL the  
steps I took, i.e. I never mounted the fs's or anything.

[root@chaos ~]# zfs create -V 1g tank/zvol
[root@chaos ~]# zfs create -V 1g tank/zvol2 ## to test if the name  
"zvol" causes problems
[root@chaos ~]# newfs /dev/zvol/tank/zvol
/dev/zvol/tank/zvol: 1024.0MB (2097152 sectors) block size 16384,  
fragment size 2048
         using 6 cylinder groups of 183.72MB, 11758 blks, 23552 inodes.
super-block backups (for fsck -b #) at:
  160, 376416, 752672, 1128928, 1505184, 1881440
[root@chaos ~]# newfs /dev/zvol/tank/zvol2
/dev/zvol/tank/zvol2: 1024.0MB (2097152 sectors) block size 16384,  
fragment size 2048
         using 6 cylinder groups of 183.72MB, 11758 blks, 23552 inodes.
super-block backups (for fsck -b #) at:
  160, 376416, 752672, 1128928, 1505184, 1881440
[root@chaos ~]# ls -R /dev/z*
/dev/zero       /dev/zfs

/dev/zvol:
tank

/dev/zvol/tank:
zvol    zvol2
[root@chaos ~]# reboot
Connection to 192.168.1.10 closed by remote host.

----------------

[root@chaos ~]# uptime
  1:04PM  up 29 secs, 2 users, load averages: 0.87, 0.27, 0.10
[root@chaos ~]# ls -R /dev/z*
/dev/zero       /dev/zfs

/dev/zvol:
tank

/dev/zvol/tank:
zvol    zvol2


Regards,
Thomas
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
From: Thomas Backman
Date: Thursday, July 23, 2009 - 12:31 am

OK, I've found the problem we have here... Or, rather, I've found the  
*reason* (and this shows why I previously said I couldn't reproduce).  
I haven't found it in source, though.

UFS filesystems in fstab are mounted *before* the /dev/zvol directory  
is populated, at least on my system!
If I remove the entry from fstab, everything boots fine, and the  
directory exists when the boot is complete. If its IN fstab, init  
gives me a root prompt because it couldn't find /dev/zvol/x/y. Remove  
it, and again it works on the next boot.
And, as you said, renaming it while in single user creates /dev/zvol  
and thus resolves the issue for that boot and allows me to boot into  
multiuser with the ZVOL working.

Anyone with a clue in these areas know if there's an easy fix to this  
(i.e. easy enough that we could have it in 8.0)? I'm guessing /etc/ 
rc.d/zfs simply starts too late in the boot process?

Regards,
Thomas
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
From: Thomas Backman
Date: Thursday, July 23, 2009 - 1:12 am

So, my solution:
Edit /etc/rc.d/zfs, and replace "#REQUIRE: mountcritlocal" with  
"#BEFORE: mountcritlocal".

/ is mounted before any of these runs anyway, right? And / contains / 
sbin/zfs and everything it needs:
# ldd /sbin/zfs
/sbin/zfs:
         libzfs.so.2 => /lib/libzfs.so.2 (0x800656000)
         libgeom.so.5 => /lib/libgeom.so.5 (0x80078a000)
         libbsdxml.so.4 => /lib/libbsdxml.so.4 (0x80088f000)
         libsbuf.so.5 => /lib/libsbuf.so.5 (0x8009b2000)
         libm.so.5 => /lib/libm.so.5 (0x800ab4000)
         libnvpair.so.2 => /lib/libnvpair.so.2 (0x800bd3000)
         libuutil.so.2 => /lib/libuutil.so.2 (0x800cdc000)
         libutil.so.8 => /lib/libutil.so.8 (0x800de5000)
         libc.so.7 => /lib/libc.so.7 (0x800ef5000)

Works for me(tm) (with MBR, ZFS root and UFS /boot), the ZVOL mounts  
just fine and I get no errors during boot. Another way would probably  
(haven't tested) to run "zfs volinit" in mountcritlocal, but then I  
suppose there'd have to be a check for zfs_enable="YES" in there too.

Regards,
Thomas
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
From: Emil Mikulic
Date: Thursday, July 23, 2009 - 5:59 pm

I remember running into this!  I tried to solve it using the "late"
mount flag in fstab but couldn't get it working.

In the end I just stuck a bunch of manual "mount" commandlines in
/etc/rc.local.  What a cop-out.  :(

--Emil
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
From: Graham Todd
Date: Friday, July 24, 2009 - 10:53 am

Ditto. I ended up using the same approach with a script called from
rc.local - "late" didn't work for me because /dev/zvol wasn't there yet.
This was in the first release of FreeBSD that included zfs.

I believe the rc.local workaround is still in use on the system in
question (now running CURRENT).
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
Previous thread: [PATCH] Fix in6p_leave_group() panic by misbehaving apps by Bruce Simpson on Saturday, July 18, 2009 - 9:41 am. (3 messages)

Next thread: Re: [newnfs/client] SIGINFO aborts transfer and produces `permission denied' by Anonymous on Saturday, July 18, 2009 - 11:38 am. (1 message)