Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various ZED fixes #6858

Merged

Conversation

loli10K
Copy link
Contributor

@loli10K loli10K commented Nov 12, 2017

Description

  • Teach ZED to handle spares using configured ashift ("auto_spare_ashift.ksh")
  • Add new test case to verify ZED can handle multiple faults ("auto_spare_multiple.ksh")
  • Fix zed_stop() in "libtest.shlib"

TODO:

  • Use libtpool in ZED (originally used in the Illumos/FMA code)
  • Fix "auto_spare_002_pos.ksh" on the Ubuntu builders
  • Fix ZED crashing on startup (race condition in libzfs when used in multi-threaded context)

Motivation and Context

If the zpool "ashift" property is set then ZED should use its value when kicking in a hotspare; with this change 512e disks can be used as spares for VDEVs that were created with ashift=9, even if ZFS
natively detects them as 4K block devices.

#2562 (comment)

Consider a ZFS mirror of "old" 512b devices (i'm using file vdevs just for testing):

root@linux:~# zpool status
  pool: testpool
 state: ONLINE
  scan: none requested
config:

	NAME            STATE     READ WRITE CKSUM
	testpool        ONLINE       0     0     0
	  mirror-0      ONLINE       0     0     0
	    /var/tmp/1  ONLINE       0     0     0
	    /var/tmp/2  ONLINE       0     0     0

errors: No known data errors
root@linux:~# zdb -C | grep ashift
            ashift: 9

When one of the "old" disks start failing we want to keep the storage redundant, so we add a "new" 512e spare disk to the pool (scsi_debug device):

root@linux:~# zpool status
  pool: testpool
 state: ONLINE
  scan: none requested
config:

	NAME            STATE     READ WRITE CKSUM
	testpool        ONLINE       0     0     0
	  mirror-0      ONLINE       0     0     0
	    /var/tmp/1  ONLINE       0     0     0
	    /var/tmp/2  ONLINE       0     0     0
	spares
	  sda           AVAIL   

errors: No known data errors
root@linux:~# 

Now one of the disk start failing: ZED detects this but is unable to kick in the hot spare. From strace -f -e trace=ioctl zed -Ffv:

Diagnosis Engine: error event 'ereport.fs.zfs.io'
[pid  1915] ioctl(5, 0x5a81, 0x7fff48ee7e30) = -1 ENOMEM (Cannot allocate memory)
[pid  1915] ioctl(5, 0x5a81, 0x7fff48ee7e30) = 0
Diagnosis Engine: error event 'ereport.fs.zfs.io'
[pid  1915] ioctl(5, 0x5a81, 0x7fff48ee7e30) = -1 ENOMEM (Cannot allocate memory)
[pid  1915] ioctl(5, 0x5a81, 0x7fff48ee7e30) = 0
Diagnosis Engine: error event 'ereport.fs.zfs.io'
[pid  1915] ioctl(5, 0x5a81, 0x7fff48ee7e30) = -1 ENOMEM (Cannot allocate memory)
[pid  1915] ioctl(5, 0x5a81, 0x7fff48ee7e30) = 0
Diagnosis Engine: error event 'ereport.fs.zfs.io'
[pid  1915] ioctl(5, 0x5a81Process 2671 attached
Diagnosis Engine: timer fired (0x7fc35801cc90)
Diagnosis Engine: solving fault 'fault.fs.zfs.vdev.io'

zed_fault_event:
	uuid: b70bd35e-6f5b-4f7b-a452-3d54f87a6cf6
	class: fault.fs.zfs.vdev.io
	code: ZFS-8000-FD
	certainty: 100
	scheme: zfs
	pool: 3817828698539407965
	vdev: 9204350677508924462 

Retire Agent: zfs_retire_recv: 'list.suspect'
 <unfinished ...>
[pid  1917] ioctl(5, 0x5a04, 0x7fc3663bc720) = -1 EEXIST (File exists)
[pid  1917] ioctl(5, 0x5a05, 0x7fc3663bc6e0) = 0
[pid  1917] ioctl(5, 0x5a27, 0x7fc3663bc6e0) = 0
Retire Agent: matched vdev 9204350677508924462
[pid  1917] ioctl(5, 0x5a0d <unfinished ...>
[pid  1915] <... ioctl resumed> , 0x7fff48ee7e30) = 0
Diagnosis Engine: case solved (b70bd35e-6f5b-4f7b-a452-3d54f87a6cf6)
Diagnosis Engine: removing timer (0x7fc35801cc90)
[pid  2671] +++ exited with 0 +++
[pid  1915] ioctl(5, 0x5a81, 0x7fff48ee7e30) = 0
[pid  1915] ioctl(5, 0x5a81, 0x7fff48ee7e30) = 0
[pid  1915] ioctl(5, 0x5a81, 0x7fff48ee7e30) = 0
[pid  1915] ioctl(5, 0x5a81, 0x7fff48ee7e30) = 0
[pid  1915] ioctl(5, 0x5a81, 0x7fff48ee7e30) = 0
[pid  1915] ioctl(5, 0x5a81, 0x7fff48ee7e30) = 0
[pid  1915] ioctl(5, 0x5a81, 0x7fff48ee7e30) = 0
[pid  1917] <... ioctl resumed> , 0x7fc3663bc7c0) = 0
[pid  1915] ioctl(5, 0x5a81Retire Agent: zpool_vdev_fault: vdev 9204350677508924462 on 'testpool'
, 0x7fff48ee7e30) = 0
Retire Agent: zpool_vdev_replace '/var/tmp/1' with spare 'sda1'
[pid  1917] ioctl(5, 0x5a0e <unfinished ...>
[pid  1915] ioctl(5, 0x5a81, 0x7fff48ee7e30) = 0
[pid  1915] ioctl(5, 0x5a81 <unfinished ...>
[pid  1917] <... ioctl resumed> , 0x7fc3663bc750) = -1 EDOM (Numerical argument out of domain)
Diagnosis Engine: resource event 'resource.fs.zfs.statechange'
Retire Agent: zfs_retire_recv: 'resource.fs.zfs.statechange'

The pool remains without redundancy, because we attempted to replace the failing device with a disk providing a different sector size:

Retire Agent: zpool_vdev_replace '/var/tmp/1' with spare 'sda1'
[pid  1917] ioctl(5, 0x5a0e <unfinished ...>
[pid  1915] ioctl(5, 0x5a81, 0x7fff48ee7e30) = 0
[pid  1915] ioctl(5, 0x5a81 <unfinished ...>
[pid  1917] <... ioctl resumed> , 0x7fc3663bc750) = -1 EDOM (Numerical argument out of domain)

We need to provide a custom ashift value to replace the disk:

root@linux:~# zpool status
  pool: testpool
 state: DEGRADED
status: One or more devices are faulted in response to persistent errors.
	Sufficient replicas exist for the pool to continue functioning in a
	degraded state.
action: Replace the faulted device, or use 'zpool clear' to mark the device
	repaired.
  scan: scrub repaired 0B in 0h0m with 0 errors on Sun Nov 12 19:30:20 2017
config:

	NAME            STATE     READ WRITE CKSUM
	testpool        DEGRADED     0     0     0
	  mirror-0      DEGRADED     0     0     0
	    /var/tmp/1  FAULTED      5   257     0  too many errors
	    /var/tmp/2  ONLINE       0     0     0
	spares
	  sda           AVAIL   

errors: No known data errors
root@linux:~# zpool remove testpool sda
root@linux:~# zpool replace testpool /var/tmp/1 sda
cannot replace /var/tmp/1 with sda: new device has a different optimal sector size; use the option '-o ashift=N' to override the optimal size
root@linux:~# zpool replace testpool /var/tmp/1 sda -o ashift=9
root@linux:~# zpool status
  pool: testpool
 state: ONLINE
  scan: resilvered 84K in 0h0m with 0 errors on Sun Nov 12 19:34:21 2017
config:

	NAME            STATE     READ WRITE CKSUM
	testpool        ONLINE       0     0     0
	  mirror-0      ONLINE       0     0     0
	    sda         ONLINE       0     0     0
	    /var/tmp/2  ONLINE       0     0     0

errors: No known data errors
root@linux:~# 

How Has This Been Tested?

Test added to the ZTS. Full disclosure, the test panics my test builder:

/usr/share/zfs/test-runner/bin/test-runner.py  -c /usr/share/zfs/runfiles/issue-2562.run -T functional -i /usr/share/zfs/zfs-tests -I 1
Test: /usr/share/zfs/zfs-tests/tests/functional/fault/setup (run as root) [00:03] [PASS]
Test: /usr/share/zfs/zfs-tests/tests/functional/fault/auto_online_001_pos (run as root) [00:27] [PASS]
Test: /usr/share/zfs/zfs-tests/tests/functional/fault/auto_replace_001_pos (run as root) [00:25] [PASS]
Test: /usr/share/zfs/zfs-tests/tests/functional/fault/auto_spare_001_pos (run as root) [02:05] [PASS]
Test: /usr/share/zfs/zfs-tests/tests/functional/fault/auto_spare_002_pos (run as root) [01:12] [PASS]
[  319.563452] BUG: unable to handle kernel paging request at ffffffffa0905000
[  319.564723] IP: [<ffffffffa0000f34>] scsi_device_put+0x14/0x60 [scsi_mod]
[  319.566016] PGD 1816067 PUD 1817063 PMD cfead067 PTE 0
[  319.566137] Oops: 0000 [#1] SMP 
[  319.566137] Modules linked in: scsi_debug sd_mod crc_t10dif crct10dif_generic dm_mod loop nfsd auth_rpcgss oid_registry nfs_acl nfs lockd fscache sunrpc zfs(PO) zunicode(PO) crc32_pclmul aesni_intel zcommon(PO) aes_x86_64 lrw gf128mul glue_helper ablk_helper cryptd ppdev znvpair(PO) pcspkr zavl(PO) psmouse icp(PO) serio_raw spl(O) evdev parport_pc joydev parport i2c_piix4 processor pvpanic virtio_console i2c_core thermal_sys virtio_balloon button autofs4 ext4 crc16 mbcache jbd2 hid_generic usbhid hid sg sr_mod cdrom ata_generic virtio_scsi virtio_blk virtio_net crct10dif_pclmul crct10dif_common crc32c_intel floppy ata_piix ahci libahci xhci_hcd usbcore usb_common virtio_pci virtio_ring virtio libata scsi_mod [last unloaded: scsi_debug]
[  319.566137] CPU: 0 PID: 20555 Comm: systemd-udevd Tainted: P           O  3.16.0-4-amd64 #1 Debian 3.16.43-2+deb8u5
[  319.566137] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
[  319.566137] task: ffff8800c6b923d0 ti: ffff8800d2088000 task.ti: ffff8800d2088000
[  319.566137] RIP: 0010:[<ffffffffa0000f34>]  [<ffffffffa0000f34>] scsi_device_put+0x14/0x60 [scsi_mod]
[  319.566137] RSP: 0018:ffff8800d208be68  EFLAGS: 00010292
[  319.566137] RAX: ffffffffa0905000 RBX: ffff8800c778a000 RCX: ffff880147542600
[  319.566137] RDX: 000000000000003e RSI: 0000000000000000 RDI: ffff8801515f1800
[  319.566137] RBP: ffff8801515f1800 R08: ffff8800c74e74e8 R09: ffff8800c74e7cf8
[  319.566137] R10: ffff8800c7581710 R11: 0000000000000000 R12: ffff8800c778a400
[  319.566137] R13: ffff8800dad61398 R14: 000000000002005d R15: 0000000000000000
[  319.566137] FS:  00007f95cd873880(0000) GS:ffff880158400000(0000) knlGS:0000000000000000
[  319.566137] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  319.566137] CR2: ffffffffa0905000 CR3: 00000000c77fb000 CR4: 00000000000006f0
[  319.566137] Stack:
[  319.566137]  ffff8800c778a000 ffff8801515f1800 ffffffffa08ef7cb ffff8800dad61380
[  319.566137]  0000000000000010 ffffffff811e021d ffff8800c7581700 0000000000000010
[  319.566137]  ffff8800d963d2f8 ffff880150835960 ffff8800db92ce58 ffff8800d963d2f8
[  319.566137] Call Trace:
[  319.566137]  [<ffffffffa08ef7cb>] ? scsi_disk_put+0x2b/0x40 [sd_mod]
[  319.566137]  [<ffffffff811e021d>] ? __blkdev_put+0x15d/0x1a0
[  319.566137]  [<ffffffff811e0c71>] ? blkdev_close+0x21/0x30
[  319.566137]  [<ffffffff811ac86a>] ? __fput+0xca/0x1d0
[  319.566137]  [<ffffffff8108679c>] ? task_work_run+0x8c/0xb0
[  319.566137]  [<ffffffff81013ef9>] ? do_notify_resume+0x69/0xa0
[  319.566137]  [<ffffffff8151a74a>] ? int_signal+0x12/0x17
[  319.566137] Code: 5b 5d 41 5c 41 5d 41 5e 41 5f c3 66 66 66 2e 0f 1f 84 00 00 00 00 00 e8 fb b9 51 e1 55 48 89 fd 53 48 8b 07 48 8b 80 c0 00 00 00 <48> 8b 18 48 85 db 74 0d 48 89 df e8 3c 79 0d e1 48 85 c0 75 17 
[  319.566137] RIP  [<ffffffffa0000f34>] scsi_device_put+0x14/0x60 [scsi_mod]
[  319.566137]  RSP <ffff8800d208be68>
[  319.566137] CR2: ffffffffa0905000
[  319.566137] ---[ end trace 8e14e9438119b8bd ]---

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (a change to man pages or other documentation)

Checklist:

  • My code follows the ZFS on Linux code style requirements.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • All commit messages are properly formatted and contain Signed-off-by.
  • Change has been approved by a ZFS on Linux member.

@loli10K loli10K added the Status: Work in Progress Not yet ready for general review label Nov 12, 2017
@loli10K loli10K changed the title [WIP] Teach ZED to handle spares with configured ashift [WIP] ZED should handle spares using configured ashift Nov 13, 2017
@loli10K loli10K force-pushed the issue-2562-issuecomment-343725217 branch from 0290a22 to f7a56d1 Compare November 13, 2017 06:18
outputdir = /var/tmp/test_results

[tests/functional/fault]
tests = ['auto_online_001_pos', 'auto_replace_001_pos', 'auto_spare_001_pos',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should try setting TEST_ZFSTESTS_ITERS in the TEST file to a reasonable value and set TEST_ZFSTESTS_TAGS to fault in this case. It should simplify your testing quite a bit and help you avoid making a separate run file for testing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's a bit awkward using a custom runfile in this case, but i want to run those fault tests just once to verify i don't break anything when i update functions shared by that group (that is, before i drop the custom runfile) and instead "stress" the new test i'm adding: it's also easier to read the log from my browser if the output is always coming from the same "new" test.

One thing i would like to be able to do from the TEST file is to disable the codecov builder/bot while the PR is still work in progress.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may be able to come up with something soon.

Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is exactly the fix I've wanted to get to for a while now.

I'm not sure how to explain the crash you observed locally but it wouldn't surprise me if it was something specific to the scsi_debug module. It doesn't look like the automated testing hit this specified issue.

On a related note, we also wanted to add another auto_spare test case which verifies that in the face of multiple failures multiple spares are kicked in. This should work with the code as it stands today.

@loli10K loli10K force-pushed the issue-2562-issuecomment-343725217 branch 2 times, most recently from 2d3d72a to 713eede Compare November 14, 2017 22:21
log_must modprobe -r scsi_debug
fi
load_scsi_debug $(($SPA_MINDEVSIZE/1024/1024+32)) $SDHOSTS $SDTGTS $SDLUNS '512e'
SPARE_DEVICE=$(get_debug_device)
Copy link
Contributor

@dinatale2 dinatale2 Nov 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You’re creating a ‘512e’ scsi device here, but you never reload the ‘scsi_debug’ module to recreate the ‘512b’ device. You can’t depend on test ordering or that other tests don’t just assume that they should re-setup ‘scsi_debug’.

Since we need different device types, would it be worth considering having each test in this test group perform a ‘load_scsi_debug’ call to set up an appropriate scsi device? It might simplify the test group overall.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dinatale2 sorry for the late reply, i've been unable to work on this due to an unexpected workload.

Loading the scsi_debug driver in each test group sounds good to me; i'm also trying to update the other test case to exercise ZED with multiple, parallel faults. I'm going to push something once my local builder is able to run these changes, hopefully before next monday.

OT: does it make sense to split this into two separate commits ("update ZED to handle ashift" + "new spare test case with multiple faults")? I don't mind the extra (minimal) step required if it's going to help keep the git history more readable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@loli10K I'm OK with this either as a single commit or as two. All I ask if that you open a new PR for the multiple fault test case if you do decide to split it. It makes it easier for me to merge.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then let's merge this in a single commit, it seems easier for everyone.

On a more related note, moving the 'load_scsi_debug' call into the individual scripts that need it enabled some tests that were previously skipped (scsi_debug was missing, and triggering a log_unsupported in the setup script): now 'auto_spare_002_pos' seems to be failing on a couple of Ubuntu builders (Ubuntu 17.04 x86_64 / Ubuntu 16.04 x86_64).

From http://build.zfsonlinux.org/builders/Ubuntu%2016.04%20x86_64%20%28TEST%29/builds/1486/steps/shell_8/logs/log:

13:24:38.47 NOTE: Performing local cleanup via log_onexit (cleanup)
13:24:38.48   pool: testpool
13:24:38.48  state: ONLINE
13:24:38.48 status: One or more devices has experienced an unrecoverable error.  An
13:24:38.48 	attempt was made to correct the error.  Applications are unaffected.
13:24:38.48 action: Determine if the device needs to be replaced, and clear the errors
13:24:38.48 	using 'zpool clear' or replace the device with 'zpool replace'.
13:24:38.48    see: http://zfsonlinux.org/msg/ZFS-8000-9P
13:24:38.48   scan: none requested
13:24:38.48 config:
13:24:38.48 
13:24:38.48 	NAME             STATE     READ WRITE CKSUM
13:24:38.48 	testpool         ONLINE       0     0     0
13:24:38.48 	  mirror-0       ONLINE       0     0     0
13:24:38.48 	    /mnt/file-1  ONLINE       0     0   142
13:24:38.48 	    /mnt/file-2  ONLINE       0     0     0
13:24:38.48 	    /mnt/file-3  ONLINE       0     0     0
13:24:38.48 	    /mnt/file-4  ONLINE       0     0     0
13:24:38.48 	spares
13:24:38.48 	  /mnt/spare-1   AVAIL   
13:24:38.48 
13:24:38.48 errors: No known data errors

For some reason ZED doesn't kick in the hot spare. I've been trying to reproduce this for the past few hours on a local builder (Ubuntu 16.04 x86_64) without luck, the test is always a PASS here.

@loli10K loli10K force-pushed the issue-2562-issuecomment-343725217 branch 11 times, most recently from c28b5cf to 3688d37 Compare November 20, 2017 22:15
@dinatale2
Copy link
Contributor

dinatale2 commented Nov 21, 2017

On a more related note, moving the 'load_scsi_debug' call into the individual scripts that need it enabled some tests that were previously skipped (scsi_debug was missing, and triggering a log_unsupported in the setup script): now 'auto_spare_002_pos' seems to be failing on a couple of Ubuntu builders (Ubuntu 17.04 x86_64 / Ubuntu 16.04 x86_64).

I think you want the test group to be skipped properly if scsi_debug is not supported. Am I correct?

If that's the case, you could introduce a new function similar to the following:

function have_scsi_debug()
{
    modprobe -n scsi_debug
    if (($? != 0)); then
        log_unsupported "Platform does not have scsi_debug module"
    fi
}

You can then call that within setup and if scsi_debug is not supported, then the entire test group will be skipped. You can also call have_scsi_debug from within load_scsi_debug so the logic remains consistent.

Hopefully I understood you correctly, if not let me know.

@loli10K loli10K force-pushed the issue-2562-issuecomment-343725217 branch from 3688d37 to 4bb3689 Compare November 21, 2017 18:03
@loli10K
Copy link
Contributor Author

loli10K commented Nov 21, 2017

@dinatale2 sorry for not being clear, what i meant to say is this "new" failures ("auto_spare_002_pos") don't seem to be caused by this PR and we're only seeing them now because my changes are enabling tests that were previously skipped. I think it makes sense to keep them enabled and running, since they don't really need 'scsi_debug' loaded to run.

EDIT: nevermind, we now have a new failure, somehow ZED is still running when expected to be stopped ("ZED already running" in setup.ksh, Ubuntu builders); this is different from the other issue i was seeing (device with many CKSUM not getting faulted by ZED) which could be caused by ZED not running during those tests.

@loli10K loli10K force-pushed the issue-2562-issuecomment-343725217 branch 2 times, most recently from 7a449ee to 3a28e80 Compare November 22, 2017 06:34
if [[ -f ${ZEDLET_DIR}/zed.pid ]]; then
zedpid=$(cat ${ZEDLET_DIR}/zed.pid)
kill $zedpid
wait $zedpid
rm -f ${ZEDLET_DIR}/zed.pid
fi

log_note "ZED stopped"
ps -C zed
return 0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something isn't quite right here (http://build.zfsonlinux.org/builders/Ubuntu%2017.04%20x86_64%20%28TEST%29/builds/1583/steps/shell_8/logs/log):

Test: /usr/share/zfs/zfs-tests/tests/functional/fault/cleanup (run as root) [00:00] [PASS]
06:52:31.22 SUCCESS: zpool create -f foopool27889 loop0 loop1 loop2
06:52:31.39 SUCCESS: zpool destroy -f foopool27889
06:52:31.39 NOTE: Stopping ZED
06:52:31.40   PID TTY          TIME CMD
06:52:31.40  8743 ?        00:00:01 zed
06:52:31.41 NOTE: ZED stopped
06:52:31.42   PID TTY          TIME CMD
06:52:31.42  8743 ?        00:00:01 zed
06:52:31.42 28187 ?        00:00:00 zed
06:52:31.43 SUCCESS: rm -f /var/tmp/zed/zed.rc
06:52:31.43 SUCCESS: rm -f /var/tmp/zed/zed-functions.sh
06:52:31.44 SUCCESS: rm -f /var/tmp/zed/all-syslog.sh
06:52:31.45 SUCCESS: rm -f /var/tmp/zed/all-debug.sh
06:52:31.45 SUCCESS: rm -f /var/tmp/zed/state
06:52:31.46 SUCCESS: rm -f /var/tmp/zed/zed.log
06:52:31.47 SUCCESS: rm -f /var/tmp/zed/zed.debug.log
06:52:31.47 SUCCESS: rm -f /etc/zfs/vdev_id.conf
06:52:31.48 SUCCESS: rm -f /var/tmp/zed/vdev_id.conf
Test: /usr/share/zfs/zfs-tests/tests/functional/fault/setup (run as root) [00:00] [FAIL]
06:52:31.62 SUCCESS: mkdir /var/tmp/zed
06:52:31.63 SUCCESS: touch /var/tmp/zed/vdev_id.conf
06:52:31.63 SUCCESS: ln -s /var/tmp/zed/vdev_id.conf /etc/zfs/vdev_id.conf
06:52:31.64 SUCCESS: cp /etc/zfs/zed.d/zed.rc /var/tmp/zed
06:52:31.65 SUCCESS: cp /etc/zfs/zed.d/zed-functions.sh /var/tmp/zed
06:52:31.65 SUCCESS: sed -i /\#ZED_DEBUG_LOG=.*/d /var/tmp/zed/zed.rc
06:52:31.66 SUCCESS: umask 0022
06:52:31.67 SUCCESS: cp /usr/lib/x86_64-linux-gnu/zfs/zed.d/all-syslog.sh /var/tmp/zed
06:52:31.67 SUCCESS: cp /usr/lib/x86_64-linux-gnu/zfs/zed.d/all-debug.sh /var/tmp/zed
06:52:31.68 SUCCESS: umask 0000
06:52:31.68 NOTE: Starting ZED
06:52:31.69   PID TTY          TIME CMD
06:52:31.69  8743 ?        00:00:01 zed
06:52:31.69 28281 ?        00:00:00 zed
06:52:31.70 ZED already running
06:52:31.70 NOTE: Performing test-fail callback (/usr/share/zfs/zfs-tests/callbacks/zfs_dbgmsg.ksh)

@loli10K loli10K force-pushed the issue-2562-issuecomment-343725217 branch 2 times, most recently from 3793eed to b3f1924 Compare November 23, 2017 21:53
wait $zedpid
while ps -p $zedpid > /dev/null; do
sleep 1
done
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait (shell-builtin) doesn't seem to work when zed_start() and zed_stop() are run in different processes (setup.ksh and cleanup.ksh respectively): this resulted in several failures running fault tests with TEST_ZFSTESTS_ITERS="10".

@loli10K loli10K force-pushed the issue-2562-issuecomment-343725217 branch 2 times, most recently from b49d8e9 to ab66cf3 Compare November 25, 2017 19:54
@loli10K
Copy link
Contributor Author

loli10K commented Dec 5, 2017

@behlendorf we are de-referencing an invalid pointer in "libzfs.so.2.0.0", which is killing ZED. It's zfs_slm_init() running zfs_enum_pools() in a separate thread, so there's probably some kind of synchronization issue, but unfortunately the other threads don't seem to be related to its murder:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  zpool_iter (hdl=0x6f1550, func=func@entry=0x40cc50 <zfs_unavail_pool>, data=data@entry=0x616ae0 <g_pool_list>) at libzfs_config.c:413
413			if (zpool_skip_pool(cn->cn_name))
[Current thread is 1 (Thread 0x7f61c741c700 (LWP 805))]
(gdb) thr app all bt

Thread 4 (Thread 0x7f61c6c1b700 (LWP 806)):
#0  __lll_lock_wait_private () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:95
#1  0x00007f61c848cc76 in __tz_convert (timer=0x7f61c8795ac0 <tzset_lock>, timer@entry=0x7f61c6c18158, use_localtime=use_localtime@entry=1, tp=tp@entry=0x7f61c87984a0 <_tmbuf>) at tzset.c:616
#2  0x00007f61c848a941 in __GI_localtime (t=t@entry=0x7f61c6c18158) at localtime.c:39
#3  0x0000000000409ae7 in _zed_log_aux (priority=priority@entry=6, fmt=fmt@entry=0x41057e "%s: %s", vargs=vargs@entry=0x7f61c6c189c0) at zed_log.c:225
#4  0x0000000000409d39 in _zed_log_aux (vargs=0x7f61c6c189c0, fmt=0x41057e "%s: %s", priority=6) at zed_log.c:247
#5  zed_log_msg (priority=priority@entry=6, fmt=fmt@entry=0x41057e "%s: %s") at zed_log.c:248
#6  0x000000000040dfc6 in fmd_hdl_debug (hdl=hdl@entry=0x616b40 <zfs_diagnosis_module>, format=format@entry=0x4126fa "case opened (%s)") at agents/fmd_api.c:212
#7  0x000000000040e3b3 in fmd_case_open (hdl=hdl@entry=0x616b40 <zfs_diagnosis_module>, data=data@entry=0x0) at agents/fmd_api.c:287
#8  0x000000000040b3ed in zfs_fm_recv (hdl=0x616b40 <zfs_diagnosis_module>, ep=0x7f61c6c18e30, nvl=0x6ea590, class=<optimized out>) at agents/zfs_diagnosis.c:634
#9  0x000000000040efca in fmd_module_recv (hdl=0x616b40 <zfs_diagnosis_module>, nvl=nvl@entry=0x6ea590, class=class@entry=0x6ea4e0 "ereport.fs.zfs.io") at agents/fmd_api.c:755
#10 0x000000000040a5a4 in zfs_agent_dispatch (nvl=0x6ea590, subclass=0x6ea520 "", class=0x6ea4e0 "ereport.fs.zfs.io") at agents/zfs_agents.c:212
#11 zfs_agent_consumer_thread (arg=<optimized out>) at agents/zfs_agents.c:273
#12 0x00007f61c87a06ba in start_thread (arg=0x7f61c6c1b700) at pthread_create.c:333
#13 0x00007f61c84d63dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 3 (Thread 0x7f61c964e7c0 (LWP 738)):
#0  0x00007f61c87a9c1d in nanosleep () at ../sysdeps/unix/syscall-template.S:84
#1  0x00000000004092de in _zed_exec_fork_child (eid=eid@entry=188080, class=class@entry=0x6ed2c8 "ereport.fs.zfs.io", dir=dir@entry=0x6e9110 "/etc/zfs/zed.d", prog=prog@entry=0x6f13f0 "all-syslog.sh", 
    env=env@entry=0x6f2b60, zfd=zfd@entry=8) at zed_exec.c:147
#2  0x0000000000409654 in zed_exec_process (eid=188080, class=0x6ed2c8 "ereport.fs.zfs.io", subclass=subclass@entry=0x6ed2d7 "io", dir=0x6e9110 "/etc/zfs/zed.d", zedlets=0x6e9150, envs=envs@entry=0x6ef390, 
    zfd=8) at zed_exec.c:226
#3  0x0000000000408fcc in zed_event_service (zcp=zcp@entry=0x6e9070) at zed_event.c:918
#4  0x0000000000404db8 in main (argc=<optimized out>, argv=<optimized out>) at zed.c:274

Thread 2 (Thread 0x7f61c641a700 (LWP 808)):
#0  0x00007f61c87a994d in recvmsg () at ../sysdeps/unix/syscall-template.S:84
#1  0x00007f61c966186c in udev_monitor_receive_device () from /lib/x86_64-linux-gnu/libudev.so.1
#2  0x00000000004069d1 in zed_udev_monitor (arg=0x6ea060) at zed_disk_event.c:178
#3  0x00007f61c87a06ba in start_thread (arg=0x7f61c641a700) at pthread_create.c:333
#4  0x00007f61c84d63dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 1 (Thread 0x7f61c741c700 (LWP 805)):
#0  zpool_iter (hdl=0x6f1550, func=func@entry=0x40cc50 <zfs_unavail_pool>, data=data@entry=0x616ae0 <g_pool_list>) at libzfs_config.c:413
#1  0x000000000040bfda in zfs_enum_pools (arg=<optimized out>) at agents/zfs_mod.c:840
#2  0x00007f61c87a06ba in start_thread (arg=0x7f61c741c700) at pthread_create.c:333
#3  0x00007f61c84d63dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
(gdb) thr 1
[Switching to thread 1 (Thread 0x7f61c741c700 (LWP 805))]
#0  zpool_iter (hdl=0x6f1550, func=func@entry=0x40cc50 <zfs_unavail_pool>, data=data@entry=0x616ae0 <g_pool_list>) at libzfs_config.c:413
413			if (zpool_skip_pool(cn->cn_name))
(gdb) p cn
$1 = (config_node_t *) 0x20
(gdb) 

I may have found the smoking gun in another core (crash is in "libc.so"); we have two different threads iterating over libzfs_handle_t->libzfs_ns_avl which seems to be "reloaded" (namespace_reload()) in zpool_iter() without any kind of locking:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  strlen () at ../sysdeps/x86_64/strlen.S:106
106	../sysdeps/x86_64/strlen.S: No such file or directory.
[Current thread is 1 (Thread 0x7f86d244e700 (LWP 7596))]
(gdb) thr app all bt

Thread 4 (Thread 0x7f86d1c4d700 (LWP 7597)):
#0  0x00007f86d34fdf07 in ioctl () at ../sysdeps/unix/syscall-template.S:84
#1  0x00007f86d3e09457 in zpool_refresh_stats (zhp=zhp@entry=0x7f86c80023e0, missing=missing@entry=0x7f86d1c4ac54) at libzfs_config.c:287
#2  0x00007f86d3e1fca6 in zpool_open_silent (hdl=hdl@entry=0x1754550, pool=0x7f86c8000a90 "testpool", ret=ret@entry=0x7f86d1c4ac90) at libzfs_pool.c:1084
#3  0x00007f86d3e09866 in zpool_iter (hdl=0x1754550, func=func@entry=0x40ad10 <zpool_find_load_time>, data=data@entry=0x7f86d1c4ad30) at libzfs_config.c:416
#4  0x000000000040b2e3 in zfs_fm_recv (hdl=0x616b40 <zfs_diagnosis_module>, ep=0x7f86d1c4ae30, nvl=0x1753a80, class=0x17539d0 "ereport.fs.zfs.io") at agents/zfs_diagnosis.c:586
#5  0x000000000040efca in fmd_module_recv (hdl=0x616b40 <zfs_diagnosis_module>, nvl=nvl@entry=0x1753a80, class=class@entry=0x17539d0 "ereport.fs.zfs.io") at agents/fmd_api.c:755
#6  0x000000000040a5a4 in zfs_agent_dispatch (nvl=0x1753a80, subclass=0x1753a10 "", class=0x17539d0 "ereport.fs.zfs.io") at agents/zfs_agents.c:212
#7  zfs_agent_consumer_thread (arg=<optimized out>) at agents/zfs_agents.c:273
#8  0x00007f86d37d26ba in start_thread (arg=0x7f86d1c4d700) at pthread_create.c:333
#9  0x00007f86d35083dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 3 (Thread 0x7f86d144c700 (LWP 7598)):
#0  0x00007f86d37db94d in recvmsg () at ../sysdeps/unix/syscall-template.S:84
#1  0x00007f86d469386c in udev_monitor_receive_device () from /lib/x86_64-linux-gnu/libudev.so.1
#2  0x00000000004069d1 in zed_udev_monitor (arg=0x174d060) at zed_disk_event.c:178
#3  0x00007f86d37d26ba in start_thread (arg=0x7f86d144c700) at pthread_create.c:333
#4  0x00007f86d35083dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 2 (Thread 0x7f86d46807c0 (LWP 7536)):
#0  avl_find (tree=tree@entry=0x1757e60, value=value@entry=0x17594c0, where=where@entry=0x0) at ../../module/avl/avl.c:263
#1  0x000000000040a24d in zed_strings_add (zsp=zsp@entry=0x1757e60, key=key@entry=0x7ffcd79456c0 "ZEVENT_POOL_STATE_STR", s=s@entry=0x7ffcd79466c0 "ZEVENT_POOL_STATE_STR=ACTIVE") at zed_strings.c:183
#2  0x0000000000407611 in _zed_event_add_var (eid=eid@entry=163565, zsp=zsp@entry=0x1757e60, prefix=prefix@entry=0x4106e8 "ZEVENT_", name=<optimized out>, fmt=0x410796 "%s") at zed_event.c:283
#3  0x0000000000408a81 in _zed_event_add_nvpair (nvp=0x1757570, zsp=0x1757e60, eid=163565) at zed_event.c:606
#4  zed_event_service (zcp=zcp@entry=0x174c070) at zed_event.c:903
#5  0x0000000000404db8 in main (argc=<optimized out>, argv=<optimized out>) at zed.c:274

Thread 1 (Thread 0x7f86d244e700 (LWP 7596)):
#0  strlen () at ../sysdeps/x86_64/strlen.S:106
#1  0x00007f86d3e09636 in zpool_skip_pool (poolname=0x0) at libzfs_config.c:353
#2  0x00007f86d3e09854 in zpool_iter (hdl=0x1754550, func=func@entry=0x40cc50 <zfs_unavail_pool>, data=data@entry=0x616ae0 <g_pool_list>) at libzfs_config.c:413
#3  0x000000000040bfda in zfs_enum_pools (arg=<optimized out>) at agents/zfs_mod.c:840
#4  0x00007f86d37d26ba in start_thread (arg=0x7f86d244e700) at pthread_create.c:333
#5  0x00007f86d35083dd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
(gdb) thr 4
[Switching to thread 4 (Thread 0x7f86d1c4d700 (LWP 7597))]
#0  0x00007f86d34fdf07 in ioctl () at ../sysdeps/unix/syscall-template.S:84
84	../sysdeps/unix/syscall-template.S: No such file or directory.
(gdb) fra 3
#3  0x00007f86d3e09866 in zpool_iter (hdl=0x1754550, func=func@entry=0x40ad10 <zpool_find_load_time>, data=data@entry=0x7f86d1c4ad30) at libzfs_config.c:416
416			if (zpool_open_silent(hdl, cn->cn_name, &zhp) != 0) {
(gdb) p hdl
$1 = (libzfs_handle_t *) 0x1754550
(gdb) p cn
$2 = (config_node_t *) 0x7f86c8000a60
(gdb) p cn->cn_name 
$3 = 0x7f86c8000a90 "testpool"
(gdb) thr 1
[Switching to thread 1 (Thread 0x7f86d244e700 (LWP 7596))]
#0  strlen () at ../sysdeps/x86_64/strlen.S:106
106	../sysdeps/x86_64/strlen.S: No such file or directory.
(gdb) fra 2
#2  0x00007f86d3e09854 in zpool_iter (hdl=0x1754550, func=func@entry=0x40cc50 <zfs_unavail_pool>, data=data@entry=0x616ae0 <g_pool_list>) at libzfs_config.c:413
413			if (zpool_skip_pool(cn->cn_name))
(gdb) p hdl
$4 = (libzfs_handle_t *) 0x1754550
(gdb) p cn
$5 = (config_node_t *) 0x7f86d448dcb0
(gdb) p cn->cn_name 
$6 = 0x0
(gdb) 

IIRC libzfs is not thread-safe. I've tried reproducing the crash with the following patch applied but this seems to "avoid" the issue, which confirms my theory:

diff --git a/lib/libzfs/libzfs_config.c b/lib/libzfs/libzfs_config.c
index 67379d0..2285369 100644
--- a/lib/libzfs/libzfs_config.c
+++ b/lib/libzfs/libzfs_config.c
@@ -49,6 +49,7 @@
 #include <libuutil.h>
 
 #include "libzfs_impl.h"
+#include "libuutil_impl.h"
 
 typedef struct config_node {
        char            *cn_name;
@@ -401,6 +402,8 @@ zpool_iter(libzfs_handle_t *hdl, zpool_iter_f func, void *data)
        if (!hdl->libzfs_pool_iter && namespace_reload(hdl) != 0)
                return (-1);
 
+       (void ) pthread_mutex_lock(&hdl->libzfs_ns_avl->ua_pool->uap_lock);
+
        hdl->libzfs_pool_iter++;
        for (cn = uu_avl_first(hdl->libzfs_ns_avl); cn != NULL;
            cn = uu_avl_next(hdl->libzfs_ns_avl, cn)) {
@@ -423,6 +426,8 @@ zpool_iter(libzfs_handle_t *hdl, zpool_iter_f func, void *data)
        }
        hdl->libzfs_pool_iter--;
 
+       (void ) pthread_mutex_unlock(&hdl->libzfs_ns_avl->ua_pool->uap_lock);
+
        return (0);
 }

This is in no way a valid "fix": a better solution is probably to avoid using libzfs in a multi-thread context, maybe just running zfs_enum_pools() synchronously.

To reproduce the crash i'm running these in 3 different shells:

#
# 1. generate many zevents
#
cat > zinject-io.sh <<EOF
#!/bin/bash

zinject -c all
zpool destroy -f testpool
for i in {1..4}; do
   fallocate -l 64m /var/tmp/file-$i
done
fallocate -l 64m /var/tmp/spare-1
zpool create -f testpool mirror /var/tmp/file-{1,2,3,4} spare /var/tmp/spare-1

zfs create -o primarycache=none testpool/fs
zfs set recordsize=16k testpool/fs
dd if=/dev/urandom of=/testpool/fs/file bs=1M count=1

for i in {1..4}; do
   zinject -c all
   zpool clear testpool
   zinject -d /var/tmp/file-$i -e io -f 100 -T read testpool
   cp /testpool/fs/file /dev/null
   zpool status
done

EOF
while :; do bash zinject-io.sh ; done


#
# 2. change the namespace a lot
#
truncate -s 64m /var/tmp/file-dev1
zpool create zedcrash -f /var/tmp/file-dev1
while :; do zpool export zedcrash ; zpool import -d /var/tmp zedcrash; done



#
# 3. generate a lot of ZED startups
#
while :; do timeout 1 zed -Ffv; done

Finally, this is taking a lot more than i had expected and is starting to aggregate a lot of changes unrelated to the initial PR: sorry about that.

Also, apologies for the wall of text.

@loli10K loli10K force-pushed the issue-2562-issuecomment-343725217 branch 2 times, most recently from 84cda9b to 6757314 Compare December 5, 2017 21:19
@behlendorf
Copy link
Contributor

behlendorf commented Dec 5, 2017

IIRC libzfs is not thread-safe.

Right, it's not. So the caller needs to implement the needed locking. What you could do is either.

  1. Adopt the Illumos solution and allocate a unique libzfs context for each agent, or
  2. Add locking in the ZED to safely allow a shared context.

Option 1) would be my preference since it's nice and simple, but there may be some reason why this isn't workable which I'm not seeing.

Finally, this is taking a lot more than i had expected and is starting to aggregate a lot of changes unrelated to the initial PR: sorry about that.

No problem, I'm glad to see these issues addressed. But speaking of changes unrelated to the original PR while you're here you could also convert the ZED over to using the tpool library. This is used by Illumos in the original FMA code (see zfs_enum_pools()) but wasn't ported to ZoL when the ZED work was initially done. It is available now, so this would be an opportunity to re-sync the code in this regard.

@loli10K loli10K changed the title [WIP] ZED should handle spares using configured ashift [WIP] Various ZED fixes Dec 6, 2017
@loli10K loli10K force-pushed the issue-2562-issuecomment-343725217 branch 4 times, most recently from 1a53bc4 to a435665 Compare December 6, 2017 22:33
@@ -559,15 +556,13 @@ zfs_iter_pool(zpool_handle_t *zhp, void *data)
for (pool = list_head(&g_pool_list); pool != NULL;
pool = list_next(&g_pool_list, pool)) {

if (pool->uap_enable_tid != 0)
continue; /* entry already processed */
if (strcmp(zpool_get_name(zhp),
zpool_get_name(pool->uap_zhp)))
continue;
if (zfs_toplevel_state(zhp) >= VDEV_STATE_DEGRADED) {
/* send to a background thread; keep on list */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The entry can be removed from the list here the same as in the upstream code.

@openzfs openzfs deleted a comment from codecov bot Dec 7, 2017
@openzfs openzfs deleted a comment from codecov bot Dec 7, 2017
@openzfs openzfs deleted a comment from codecov bot Dec 7, 2017
@loli10K loli10K force-pushed the issue-2562-issuecomment-343725217 branch from a435665 to 743a526 Compare December 7, 2017 07:28
 * Teach ZED to handle spares usingi the configured ashift: if the zpool
   'ashift' property is set then ZED should use its value when kicking
   in a hotspare; with this change 512e disks can be used as spares
   for VDEVs that were created with ashift=9, even if ZFS natively
   detects them as 4K block devices.

 * Introduce an additional auto_spare test case which verifies that in
   the face of multiple device failures an appropiate number of spares
   are kicked in.

 * Fix zed_stop() in "libtest.shlib" which did not correctly wait the
   target pid.

 * Fix ZED crashing on startup caused by a race condition in libzfs
   when used in multi-threaded context.

 * Convert ZED over to using the tpool library which is already present
   in the Illumos FMA code.

Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
@loli10K loli10K force-pushed the issue-2562-issuecomment-343725217 branch from 743a526 to fd9b69b Compare December 7, 2017 11:29
@openzfs openzfs deleted a comment from codecov bot Dec 7, 2017
Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for tackling this cleanup.

@@ -83,6 +82,7 @@
#include <sys/sunddi.h>
#include <sys/sysevent/eventdefs.h>
#include <sys/sysevent/dev.h>
#include <thread_pool.h>
#include <pthread.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny nit, you can probably now drop the pthread.h include since the code now no longer directly uses pthreads (only through the thread pool library)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropping the #include <pthread.h> doesn't seem to result in any build error (it's included in thread_pool.h anyway), but since we are using pthread_create() to spawn zfs_enum_pools() it seems clearer to explicitly include the header file:

C symbol: pthread_create

  File                  Function            Line
0 zfs_agents.c          zfs_agent_init       311 if (pthread_create(&g_agents_tid, NULL, zfs_agent_consumer_thread,
1 zfs_mod.c             zfs_slm_init         861 if (pthread_create(&g_zfs_tid, NULL, zfs_enum_pools, NULL) != 0) {
2 zed_disk_event.c      zed_disk_event_init  374 if (pthread_create(&g_mon_tid, NULL, zed_udev_monitor, g_mon) != 0) {
3 thread_pool.c         create_worker        236 error = pthread_create(&thread, &tpool->tp_attr, tpool_worker, tpool);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy to leave it then.

@behlendorf
Copy link
Contributor

@loli10K when you're happy with this go ahead and remove the WIP label.

@openzfs openzfs deleted a comment from codecov bot Dec 8, 2017
@loli10K
Copy link
Contributor Author

loli10K commented Dec 8, 2017

@behlendorf i'm bulding this locally right now, i'll try to remove the #include <pthread.h> and remove the WIP label in a couple of minues.

@loli10K loli10K removed the Status: Work in Progress Not yet ready for general review label Dec 8, 2017
@loli10K loli10K changed the title [WIP] Various ZED fixes Various ZED fixes Dec 8, 2017
@behlendorf behlendorf merged commit 4e9b156 into openzfs:master Dec 9, 2017
@behlendorf
Copy link
Contributor

@loli10K merged, thanks!

@loli10K loli10K deleted the issue-2562-issuecomment-343725217 branch December 9, 2017 08:37
Nasf-Fan pushed a commit to Nasf-Fan/zfs that referenced this pull request Jan 29, 2018
* Teach ZED to handle spares usingi the configured ashift: if the zpool
   'ashift' property is set then ZED should use its value when kicking
   in a hotspare; with this change 512e disks can be used as spares
   for VDEVs that were created with ashift=9, even if ZFS natively
   detects them as 4K block devices.

 * Introduce an additional auto_spare test case which verifies that in
   the face of multiple device failures an appropiate number of spares
   are kicked in.

 * Fix zed_stop() in "libtest.shlib" which did not correctly wait the
   target pid.

 * Fix ZED crashing on startup caused by a race condition in libzfs
   when used in multi-threaded context.

 * Convert ZED over to using the tpool library which is already present
   in the Illumos FMA code.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Closes openzfs#2562
Closes openzfs#6858
Nasf-Fan pushed a commit to Nasf-Fan/zfs that referenced this pull request Feb 13, 2018
* Teach ZED to handle spares usingi the configured ashift: if the zpool
   'ashift' property is set then ZED should use its value when kicking
   in a hotspare; with this change 512e disks can be used as spares
   for VDEVs that were created with ashift=9, even if ZFS natively
   detects them as 4K block devices.

 * Introduce an additional auto_spare test case which verifies that in
   the face of multiple device failures an appropiate number of spares
   are kicked in.

 * Fix zed_stop() in "libtest.shlib" which did not correctly wait the
   target pid.

 * Fix ZED crashing on startup caused by a race condition in libzfs
   when used in multi-threaded context.

 * Convert ZED over to using the tpool library which is already present
   in the Illumos FMA code.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Closes openzfs#2562
Closes openzfs#6858
@loli10K loli10K restored the issue-2562-issuecomment-343725217 branch November 1, 2018 15:40
FransUrbo pushed a commit to FransUrbo/zfs that referenced this pull request Apr 28, 2019
* Teach ZED to handle spares usingi the configured ashift: if the zpool
   'ashift' property is set then ZED should use its value when kicking
   in a hotspare; with this change 512e disks can be used as spares
   for VDEVs that were created with ashift=9, even if ZFS natively
   detects them as 4K block devices.

 * Introduce an additional auto_spare test case which verifies that in
   the face of multiple device failures an appropiate number of spares
   are kicked in.

 * Fix zed_stop() in "libtest.shlib" which did not correctly wait the
   target pid.

 * Fix ZED crashing on startup caused by a race condition in libzfs
   when used in multi-threaded context.

 * Convert ZED over to using the tpool library which is already present
   in the Illumos FMA code.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Closes openzfs#2562 
Closes openzfs#6858
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants