Brian Behlendorf
97d4986214
Fix /etc/hostid on root pool deadlock
...
Accidentally introduced by dc04a8c which now takes the SCL_VDEV lock
as a reader in zfs_blkptr_verify(). A deadlock can occur if the
/etc/hostid file resides on a dataset in the same pool. This is
because reading the /etc/hostid file may occur while the caller is
holding the SCL_VDEV lock as a writer. For example, to perform a
`zpool attach` as shown in the abbreviated stack below.
To resolve the issue we cache the system's hostid when initializing
the spa_t, or when modifying the multihost property. The cached
value is then relied upon for subsequent accesses.
Call Trace:
spa_config_enter+0x1e8/0x350 [zfs]
zfs_blkptr_verify+0x33c/0x4f0 [zfs] <--- trying read lock
zio_read+0x6c/0x140 [zfs]
...
vfs_read+0xfc/0x1e0
kernel_read+0x50/0x90
...
spa_get_hostid+0x1c/0x38 [zfs]
spa_config_generate+0x1a0/0x610 [zfs]
vdev_label_init+0xa0/0xc80 [zfs]
vdev_create+0x98/0xe0 [zfs]
spa_vdev_attach+0x14c/0xb40 [zfs] <--- grabbed write lock
Reviewed-by: loli10K <ezomori.nozomu@gmail.com >
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov >
Closes #9256
Closes #9285
2019-09-25 11:27:51 -07:00
..
2018-08-02 11:59:24 -07:00
2018-11-08 16:47:24 -08:00
2019-09-25 11:27:50 -07:00
2018-02-20 11:19:42 -08:00
2019-03-29 09:13:20 -07:00
2018-09-26 10:29:26 -07:00
2018-06-06 09:35:59 -07:00
2018-09-26 10:29:26 -07:00
2018-09-26 10:29:26 -07:00
2010-09-08 12:38:56 -07:00
2017-10-05 19:28:00 -07:00
2017-07-07 11:28:01 -07:00
2010-09-08 12:38:56 -07:00
2018-04-14 12:16:17 -07:00
2014-08-06 14:48:41 -07:00
2016-01-08 15:08:19 -08:00
2018-06-06 09:35:59 -07:00
2019-02-12 10:41:15 -08:00
2018-09-26 10:29:26 -07:00
2018-02-26 14:20:12 -08:00
2019-05-07 15:18:44 -07:00
2018-09-05 18:33:36 -07:00
2019-05-07 15:18:44 -07:00
2018-10-09 14:05:13 -07:00
2017-08-14 10:36:48 -07:00
2018-09-26 10:29:26 -07:00
2016-08-30 14:26:55 -07:00
2019-05-07 15:18:44 -07:00
2019-09-25 11:27:51 -07:00
2019-09-25 11:27:48 -07:00
2019-09-25 11:27:48 -07:00
2019-03-13 11:00:43 -07:00
2018-04-14 12:16:17 -07:00
2018-04-14 12:16:17 -07:00
2018-02-08 15:28:18 -08:00
2018-10-01 10:40:11 -07:00
2019-02-12 10:41:15 -08:00
2016-01-12 10:53:12 -08:00
2018-04-14 12:16:17 -07:00
2018-06-26 10:07:42 -07:00
2013-11-04 11:17:48 -08:00
2016-10-03 14:51:15 -07:00
2017-01-03 11:31:18 -06:00
2017-12-07 10:28:50 -08:00
2017-10-11 16:54:48 -04:00
2019-03-29 09:13:20 -07:00
2019-03-29 09:13:20 -07:00
2019-09-25 11:27:47 -07:00
2019-03-21 12:47:57 -07:00
2016-04-05 18:55:59 -07:00
2019-09-25 11:27:48 -07:00
2018-05-29 16:00:33 -07:00
2018-07-30 11:30:03 -07:00
2018-10-03 15:30:55 -07:00
2019-09-25 11:27:49 -07:00
2016-06-07 09:16:52 -07:00
2019-01-25 09:51:24 -08:00
2018-10-09 10:05:48 -07:00
2018-09-26 10:29:26 -07:00
2018-09-26 10:29:26 -07:00
2018-02-13 14:54:54 -08:00
2017-07-25 23:09:48 -07:00
2016-10-03 14:51:15 -07:00
2016-10-03 14:51:15 -07:00
2010-09-08 12:38:56 -07:00
2019-01-13 10:09:46 -08:00
2016-06-02 14:30:51 -07:00
2019-09-25 11:27:51 -07:00
2019-09-25 11:27:51 -07:00
2019-02-20 09:59:56 -08:00
2014-07-22 09:39:16 -07:00
2017-07-12 21:28:13 -07:00
2018-02-08 21:25:19 -08:00
2017-12-21 09:13:06 -08:00
2016-05-26 10:11:51 -07:00
2017-07-25 23:09:48 -07:00
2018-10-01 10:42:05 -07:00
2018-01-31 16:13:26 -08:00
2017-01-24 08:50:15 -08:00
2017-01-24 08:50:15 -08:00
2017-01-24 08:50:15 -08:00
2018-04-14 12:16:17 -07:00
2017-12-05 09:39:16 -08:00
2016-12-12 10:46:26 -08:00
2018-03-12 11:27:02 -07:00
2015-01-06 16:53:24 -08:00
2018-06-04 14:56:06 -07:00
2019-03-29 09:13:20 -07:00
2010-09-08 12:38:56 -07:00
2010-09-08 12:38:56 -07:00
2019-03-21 12:47:57 -07:00
2017-07-13 13:54:00 -04:00
2018-10-16 11:11:24 -07:00
2013-11-04 10:55:25 -08:00
2010-09-08 12:38:56 -07:00
2018-07-23 15:40:15 -07:00
2016-12-21 10:47:15 -08:00
2019-03-29 09:13:20 -07:00
2018-04-14 12:16:17 -07:00
2018-04-14 12:16:17 -07:00
2019-03-29 09:13:20 -07:00
2018-01-09 14:46:52 -08:00
2016-12-12 10:46:26 -08:00
2019-09-25 11:27:47 -07:00
2019-03-29 09:13:20 -07:00
2019-03-29 09:13:20 -07:00
2018-06-19 21:51:18 -07:00
2017-03-07 09:51:59 -08:00
2018-04-18 14:19:50 -07:00
2019-09-25 11:27:47 -07:00
2018-02-08 15:28:18 -08:00
2018-02-08 15:28:18 -08:00
2018-02-08 15:28:18 -08:00
2018-06-15 15:10:42 -07:00
2016-05-17 11:52:07 -07:00
2018-02-13 14:54:54 -08:00
2019-09-25 11:27:49 -07:00
2017-03-10 09:51:33 -08:00
2019-03-29 09:13:20 -07:00
2018-05-29 16:00:33 -07:00
2019-02-12 10:41:15 -08:00
2018-05-29 16:00:33 -07:00
2019-05-07 15:18:44 -07:00
2010-09-08 12:38:56 -07:00
2018-02-13 14:54:54 -08:00
2018-03-04 17:34:51 -08:00
2018-10-11 10:19:33 -07:00
2018-02-13 14:54:54 -08:00
2010-09-08 12:38:56 -07:00
2018-09-06 21:44:52 -07:00
2019-05-07 10:06:30 -07:00
2018-05-02 15:01:24 -07:00
2019-09-25 11:27:50 -07:00
2018-12-07 11:09:42 -08:00
2018-04-14 12:16:17 -07:00
2017-03-29 12:24:51 -07:00
2019-09-25 11:27:47 -07:00
2018-05-02 15:36:20 -07:00
2019-03-29 09:13:20 -07:00
2019-03-29 09:13:20 -07:00
2019-03-29 09:13:20 -07:00
2018-06-19 21:51:18 -07:00
2017-01-12 09:42:11 -08:00
2019-01-13 10:09:46 -08:00
2017-07-12 13:05:37 -07:00