ib_srpt: Made sure that accessing sysfs entries during target creation is harmle

ss.
(Merged r2703 from the trunk.)


git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.0.0.x@2714 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2010-11-16 11:33:37 +00:00
parent b4d9a93a0c
commit 9d7859a04a
+6
View File
@@ -2140,6 +2140,9 @@ static int srpt_enable_target(struct scst_tgt *scst_tgt, bool enable)
EXTRACHECKS_WARN_ON_ONCE(irqs_disabled());
if (!sdev)
return -ENOENT;
TRACE_DBG("%s target %s", enable ? "Enabling" : "Disabling",
sdev->device->name);
@@ -2160,6 +2163,9 @@ static bool srpt_is_target_enabled(struct scst_tgt *scst_tgt)
EXTRACHECKS_WARN_ON_ONCE(irqs_disabled());
if (!sdev)
return false;
spin_lock_irq(&sdev->spinlock);
res = sdev->enabled;
spin_unlock_irq(&sdev->spinlock);