Illumos 4080 inadvertently allows `zpool clear` on readonly pools: fix this by reintroducing a check (`POOL_CHECK_READONLY`) in the `zfs_ioc_clear` registration code. Because i don't think we should be allowed to clear readonly pools. Probably.
Completely related to this, when we try to `zpool clear` a readonly pool the following failure occurs: ``` > ::status debugging crash dump vmcore.1 (64-bit) from openindiana operating system: 5.11 master-0-g8dcfe5e5a1 (i86pc) image uuid: 49f26dc4-a94a-6177-c9d4-b1ca68f101e3 panic message: assertion failed: spa_writeable(spa), file: ../../common/fs/zfs/vdev.c, line: 3110 dump content: kernel pages only > ::stack vpanic() 0xfffffffffbdfed08() vdev_state_dirty+0x100(ffffff04e130ac80) vdev_clear+0x1d8(ffffff04e19fa000, ffffff04e1309f80) vdev_clear+0xa6(ffffff04e19fa000, ffffff04e130ac80) vdev_clear+0xa6(ffffff04e19fa000, 0) zfs_ioc_clear+0x11a(ffffff04e1c50000) zfsdev_ioctl+0x50f(10e00000000, 5a21, 8042b48, 100003, ffffff04c6b7b0e8, ffffff001436ae58) cdev_ioctl+0x39(10e00000000, 5a21, 8042b48, 100003, ffffff04c6b7b0e8, ffffff001436ae58) spec_ioctl+0x60(ffffff04c44e5800, 5a21, 8042b48, 100003, ffffff04c6b7b0e8, ffffff001436ae58) fop_ioctl+0x55(ffffff04c44e5800, 5a21, 8042b48, 100003, ffffff04c6b7b0e8, ffffff001436ae58) ioctl+0x9b(3, 5a21, 8042b48) _sys_sysenter_post_swapgs+0x237() > ffffff04e130ac80::print vdev_t vdev_spa->spa_mode vdev_spa->spa_mode = 0x1 > ffffff04e130ac80::print vdev_t vdev_cant_write vdev_cant_write = 0 (0) ``` To be honest i'm not entirely convinced this fix is complete: it's not yet clear to me how we managed to have a readonly SPA with, at least, one writable VDEV. This issue cannot be reproduced on single-device and stripe pools, only mirror and raidz are affected. The writable device seems to be a non-leaf VDEV in every failure. (Copy/pasted from my comment in the ZFS on Linux pull request) Illumos issue: https://www.illumos.org/issues/8477 ZFS on Linux commit: https://github.com/zfsonlinux/zfs/commit/92e43c17188d47f47b69318e4884096dec380e36 You can view, comment on, or merge this pull request online at: https://github.com/openzfs/openzfs/pull/420 -- Commit Summary -- * 8477 Assertion failed in vdev_state_dirty(): spa_writeable(spa) -- File Changes -- M usr/src/pkg/manifests/system-test-zfstest.mf (3) M usr/src/test/zfs-tests/runfiles/delphix.run (3) M usr/src/test/zfs-tests/runfiles/omnios.run (3) M usr/src/test/zfs-tests/runfiles/openindiana.run (3) A usr/src/test/zfs-tests/tests/functional/cli_root/zpool_clear/zpool_clear_readonly.ksh (71) M usr/src/uts/common/fs/zfs/zfs_ioctl.c (2) -- Patch Links -- https://github.com/openzfs/openzfs/pull/420.patch https://github.com/openzfs/openzfs/pull/420.diff -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/openzfs/openzfs/pull/420 ------------------------------------------ openzfs-developer Archives: https://openzfs.topicbox.com/groups/developer/discussions/T3424bb2f66a5d4ba-Ma5d762ce6dccdfa89373ddc9 Powered by Topicbox: https://topicbox.com