mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-21 14:46:23 +00:00
scst: Remove the dev_unregistering member variable
This variable is no longer needed because devices are
removed from the devices list via list_del_init() before
being unregistered. See also trunk r5510 / commit f3820d5bc4.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
This commit is contained in:
@@ -2523,14 +2523,6 @@ struct scst_device {
|
|||||||
/* Set, if a strictly serialized cmd is waiting blocked */
|
/* Set, if a strictly serialized cmd is waiting blocked */
|
||||||
unsigned int strictly_serialized_cmd_waiting:1;
|
unsigned int strictly_serialized_cmd_waiting:1;
|
||||||
|
|
||||||
/*
|
|
||||||
* Set, if this device is being unregistered. Useful to let sysfs
|
|
||||||
* attributes know when they should exit immediately to prevent
|
|
||||||
* possible deadlocks with their device unregistration waiting for
|
|
||||||
* their kobj last put.
|
|
||||||
*/
|
|
||||||
unsigned int dev_unregistering:1;
|
|
||||||
|
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
|
|
||||||
/*************************************************************
|
/*************************************************************
|
||||||
|
|||||||
@@ -7426,6 +7426,17 @@ static ssize_t vdisk_sysfs_rotational_show(struct kobject *kobj,
|
|||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool scst_dev_being_unregistered(struct scst_device *dev)
|
||||||
|
{
|
||||||
|
bool res;
|
||||||
|
|
||||||
|
mutex_lock(&scst_mutex);
|
||||||
|
res = list_empty(&dev->dev_list_entry);
|
||||||
|
mutex_unlock(&scst_mutex);
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
static int vdev_sysfs_process_get_filename(struct scst_sysfs_work_item *work)
|
static int vdev_sysfs_process_get_filename(struct scst_sysfs_work_item *work)
|
||||||
{
|
{
|
||||||
int res = 0;
|
int res = 0;
|
||||||
@@ -7443,7 +7454,7 @@ static int vdev_sysfs_process_get_filename(struct scst_sysfs_work_item *work)
|
|||||||
* under scst_vdisk_mutex.
|
* under scst_vdisk_mutex.
|
||||||
*/
|
*/
|
||||||
while (!mutex_trylock(&scst_vdisk_mutex)) {
|
while (!mutex_trylock(&scst_vdisk_mutex)) {
|
||||||
if (dev->dev_unregistering) {
|
if (scst_dev_being_unregistered(dev)) {
|
||||||
TRACE_MGMT_DBG("Skipping being unregistered dev %s",
|
TRACE_MGMT_DBG("Skipping being unregistered dev %s",
|
||||||
dev->virt_name);
|
dev->virt_name);
|
||||||
res = -ENOENT;
|
res = -ENOENT;
|
||||||
@@ -7454,18 +7465,6 @@ static int vdev_sysfs_process_get_filename(struct scst_sysfs_work_item *work)
|
|||||||
goto out_put;
|
goto out_put;
|
||||||
}
|
}
|
||||||
msleep(100);
|
msleep(100);
|
||||||
/*
|
|
||||||
* We need to reread dev_unregistering from memory, hence
|
|
||||||
* prevent compiler from putting it in a register. Generally,
|
|
||||||
* it shouldn't happen, because the compiler isn't allowed to do
|
|
||||||
* such a transformation if any functions that can cause side
|
|
||||||
* effects are called between successive accesses, but let's be
|
|
||||||
* on the safe side. We can't cast dev_unregistering to
|
|
||||||
* volatile, because it has no effect we need, and can't cast
|
|
||||||
* it to *(volatile bool*)&, because it isn't possible to get
|
|
||||||
* address of a bit field.
|
|
||||||
*/
|
|
||||||
barrier();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virt_dev = dev->dh_priv;
|
virt_dev = dev->dh_priv;
|
||||||
|
|||||||
@@ -1266,8 +1266,6 @@ static void scst_unregister_device(struct scsi_device *scsidp)
|
|||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev->dev_unregistering = 1;
|
|
||||||
|
|
||||||
list_del_init(&dev->dev_list_entry);
|
list_del_init(&dev->dev_list_entry);
|
||||||
|
|
||||||
scst_dg_dev_remove_by_dev(dev);
|
scst_dg_dev_remove_by_dev(dev);
|
||||||
@@ -1531,8 +1529,6 @@ void scst_unregister_virtual_device(int id)
|
|||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev->dev_unregistering = 1;
|
|
||||||
|
|
||||||
list_del_init(&dev->dev_list_entry);
|
list_del_init(&dev->dev_list_entry);
|
||||||
|
|
||||||
scst_pr_clear_dev(dev);
|
scst_pr_clear_dev(dev);
|
||||||
|
|||||||
Reference in New Issue
Block a user