Cleanup suggested by Bart Van Assche <bvanassche@acm.org>

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4118 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Vladislav Bolkhovitin
2012-02-10 02:12:15 +00:00
parent 47134aad53
commit 6a34f10d81

View File

@@ -4569,7 +4569,7 @@ static int vdev_sysfs_process_get_filename(struct scst_sysfs_work_item *work)
* under scst_vdisk_mutex.
*/
while (!mutex_trylock(&scst_vdisk_mutex)) {
if ((volatile bool)(dev->dev_unregistering)) {
if (dev->dev_unregistering) {
TRACE_MGMT_DBG("Skipping being unregistered dev %s",
dev->virt_name);
res = -ENOENT;
@@ -4580,6 +4580,18 @@ static int vdev_sysfs_process_get_filename(struct scst_sysfs_work_item *work)
goto out_put;
}
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;