openzfs / zfs

OpenZFS on Linux and FreeBSD
https://openzfs.github.io/openzfs-docs
Other
10.69k stars 1.76k forks source link

Unable to export zpool after readonly import #10585

Open eharris opened 4 years ago

eharris commented 4 years ago

System information

Type Version/Name
Distribution Name Debian
Distribution Version Buster (stable)
Linux Kernel Linux version 4.19.0-9-amd64 (debian-kernel@lists.debian.org) (gcc version 8.3.0 (Debian 8.3.0-6)) #1 SMP Debian 4.19.118-2+deb10u1 (2020-06-07)
Architecture amd64
ZFS Version 0.7.12-2+deb10u2
SPL Version 0.7.12-2+deb10u1

Describe the problem you're observing

After importing the pool as read-only using zpool import -o readonly=on raid2tank, I am subsequently unable to export/unmount the pool, zpool export raid2tank fails with cannot export 'raid2tank': pool is busy. /proc/mounts shows that all the mounts are gone, so I can only assume that something in the zfs subsystem itself is holding it open, which as far as I know should be impossible since it is readonly.

Attempts to force exporting using zpool export -f raid2tank also fails with the same error. I also tried stopping zed, and export still fails.

Describe how to reproduce the problem

Don't know yet if it's reproducible. Just trying to gather anything useful before rebooting to try to get it back into read-write mode.

Include any warning/errors/backtraces from the system logs

Nothing pertinent in system logs.

# zpool export raid2tank
cannot export 'raid2tank': pool is busy
# zpool # zpool status
  pool: raid2tank
 state: ONLINE
status: Some supported features are not enabled on the pool. The pool can
        still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
        the pool may no longer be accessible by software that does not support
        the features. See zpool-features(5) for details.
  scan: scrub canceled on Sun Jul 12 01:54:42 2020
config:

        NAME         STATE     READ WRITE CKSUM
        raid2tank    ONLINE       0     0     0
          raidz1-0   ONLINE       0     0     0
            raid2d1  ONLINE       0     0     0
            raid2d2  ONLINE       0     0     0
            raid2d3  ONLINE       0     0     0
            raid2d4  ONLINE       0     0     0

errors: No known data errors
# zfs list
NAME                    USED  AVAIL  REFER  MOUNTPOINT
raid2tank                   18.0T  2.75T   140K  none
raid2tank/audio              824G  2.75T   824G  /raid/audio
raid2tank/pictures           914G  2.75T   877G  /raid/pictures
raid2tank/raid2             11.6T  2.75T  11.6T  /raid
raid2tank/video             4.68T  2.75T  4.68T  /raid/video
# zpool list
NAME        SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
raid2tank    29T  24.8T  4.24T         -     0%    85%  1.00x  ONLINE  -
# grep /raid /proc/mounts
# zfs mount raid2tank/raid2
# grep /raid /proc/mounts
raid2tank/raid2 /raid zfs ro,noatime,xattr,noacl 0 0
# zpool export raid2tank
cannot export 'raid2tank': pool is busy
# grep /raid /proc/mounts
# zpool export -f raid2tank
cannot export 'raid2tank': pool is busy
# ps ax|grep zed
    848 ?        Ssl    0:00 /usr/sbin/zed -F
1483975 pts/27   S+     0:00 grep zed
# systemctl stop zed
# ps ax|grep zed
1484056 pts/27   S+     0:00 grep zed
# zpool export -f raid2tank
cannot export 'raid2tank': pool is busy
#
GregorKopka commented 4 years ago

Do you have zvols in the pool?

Apart from that, please see https://github.com/openzfs/zfs/issues/2878

eharris commented 4 years ago

No there are no zvols in the pool.

genbtc commented 4 years ago

try zfs unmount -a ? (for all) maybe due to the recursive nature of /raid mountpoint existing as raid2, a child, but also the parent of the siblings,(idk how to phrase that right) something weird happened.

eharris commented 4 years ago

As originally stated, all of the mounts went away after the first export attempt (before even trying export -f), so what more would be done attempting to unmount again when nothing is mounted?

stale[bot] commented 3 years ago

This issue has been automatically marked as "stale" because it has not had any activity for a while. It will be closed in 90 days if no further activity occurs. Thank you for your contributions.

GregorKopka commented 1 year ago

I just ran into this with zfs-2.1.9-1 on current mint 21.

Imported a pool on removeable media with -N as I only needed contents from a filesystem with mountpoint=legacy, then tried to mount using zfs mount filesystem mountpoint (which failed, ZFS should really transmute these mental typos to mount -t zfs filesystem mountpoint), then mounted manually (using the command the magic requested in the brackets would yield), cd'ed into a subdirectory of that mountpoint and looked for something. Then tried zpool export - without leaving the directory - and got the 'pool busy' error, understandable from the shell having a pwd inside a mounted filesystem, so I did cd ; zpool export ... and still got the error.

Though the filesystem was cleanly unmounted by that, nevertheless the pool refused to export, even with -f. Nothing mounted, a scrub ran without any errors...

Highly annoying, as I have to reboot to get rid of the pool because simply pulling the drive will surely lead to ZFS blocking on some lock at some point.

behlendorf commented 1 year ago

Reopening this. If you have a way to consistently reproduce this that would be very helpful.

stale[bot] commented 8 months ago

This issue has been automatically marked as "stale" because it has not had any activity for a while. It will be closed in 90 days if no further activity occurs. Thank you for your contributions.

GregorKopka commented 8 months ago

Bad bot.