]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: core: Fix capacity set to zero after offlinining device
authorlijinlin <lijinlin3@huawei.com>
Tue, 27 Jul 2021 03:44:55 +0000 (11:44 +0800)
committerSasha Levin <sashal@kernel.org>
Thu, 26 Aug 2021 12:36:14 +0000 (08:36 -0400)
commit06befb8b8ff1bc7343b117befe1a77dd210d85b6
treef01bf06f7ebf0dc107fd58edc409856644c36b75
parentbaf703ef2ed48563f79f740aedce4de98800c36e
scsi: core: Fix capacity set to zero after offlinining device

[ Upstream commit f0f82e2476f6adb9c7a0135cfab8091456990c99 ]

After adding physical volumes to a volume group through vgextend, the
kernel will rescan the partitions. This in turn will cause the device
capacity to be queried.

If the device status is set to offline through sysfs at this time, READ
CAPACITY command will return a result which the host byte is
DID_NO_CONNECT, and the capacity of the device will be set to zero in
read_capacity_error(). After setting device status back to running, the
capacity of the device will remain stuck at zero.

Fix this issue by rescanning device when the device state changes to
SDEV_RUNNING.

Link: https://lore.kernel.org/r/20210727034455.1494960-1-lijinlin3@huawei.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: lijinlin <lijinlin3@huawei.com>
Signed-off-by: Wu Bo <wubo40@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/scsi_sysfs.c