mirror_zfs/module
George Amanakis a09aeb9fc4 Fix ASSERT logic in l2arc_evict()
In case of cache device removal it is possible that at the end of
l2arc_evict() we have l2ad_hand = l2ad_evict. This can lead to the
following panic in case of a debug build:

VERIFY3(dev->l2ad_hand < dev->l2ad_evict) failed (321920512 < 321920512)
Call Trace:
 dump_stack+0x66/0x90
 spl_panic+0xef/0x117 [spl]
 l2arc_remove_vdev+0x11d/0x290 [zfs]
 spa_load_l2cache+0x275/0x5b0 [zfs]
 spa_vdev_remove+0x4a5/0x6e0 [zfs]
 zfs_ioc_vdev_remove+0x59/0xa0 [zfs]
 zfsdev_ioctl_common+0x5b3/0x630 [zfs]
 zfsdev_ioctl+0x53/0xe0 [zfs]
 do_vfs_ioctl+0x42e/0x6b0
 ksys_ioctl+0x5e/0x90
 do_syscall_64+0x5b/0x1a0
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

In case of cache device removal it also possible that l2ad_hand +
distance > l2ad_end since we do not iterate l2arc_evict() and l2ad_hand
is not reset. This has no functional consequence however as the cache
device is about to be removed.

Fix this by omitting the ASSERT in case of device removal.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: George Amanakis <gamanakis@gmail.com>
Closes #11205
2020-11-17 12:19:46 -08:00
..
avl Links in Source Files 2020-09-03 16:17:18 -07:00
icp ICP: gcm: Allocate hash subkey table separately 2020-10-30 16:06:09 -07:00
lua Use known license string for zlua 2020-10-30 16:03:37 -07:00
nvpair Links in Source Files 2020-09-03 16:17:18 -07:00
os Linux: Fix ZFS_ENTER/ZFS_EXIT/ZFS_VERFY_ZP usage 2020-11-14 10:51:27 -08:00
spl Cleanup linux module kbuild files 2020-06-10 09:24:15 -07:00
unicode Throw const on some strings 2020-10-16 12:55:56 -07:00
zcommon Update references to nonexistent man pages in code 2020-10-30 16:04:41 -07:00
zfs Fix ASSERT logic in l2arc_evict() 2020-11-17 12:19:46 -08:00
zstd Optimize locking checks in mempool allocator 2020-11-03 09:51:10 -08:00
.gitignore Cleanup linux module kbuild files 2020-06-10 09:24:15 -07:00
Kbuild.in Add zstd support to zfs 2020-08-20 10:30:06 -07:00
Makefile.bsd Makefile.bsd: remove directory that no longer exists 2020-10-30 15:57:46 -07:00
Makefile.in Fix Linux modules uninstall 2020-10-16 13:01:14 -07:00