projects
/
firefly-linux-kernel-4.4.55.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e47c1fe
)
ieee1394: sbp2: fix race condition in state change
author
Stefan Richter
<stefanr@s5r6.in-berlin.de>
Sat, 29 Nov 2008 13:55:47 +0000
(14:55 +0100)
committer
Stefan Richter
<stefanr@s5r6.in-berlin.de>
Sat, 29 Nov 2008 16:07:56 +0000
(17:07 +0100)
An intermediate transition from _RUNNING to _IN_SHUTDOWN could have been
missed by the former code.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
drivers/ieee1394/sbp2.c
patch
|
blob
|
history
diff --git
a/drivers/ieee1394/sbp2.c
b/drivers/ieee1394/sbp2.c
index 3f5dbcb216057cc513d51f3ea5ba68cb94a0e5d0..a373c18cf7b8fe8bd077c47b0808abea743e573f 100644
(file)
--- a/
drivers/ieee1394/sbp2.c
+++ b/
drivers/ieee1394/sbp2.c
@@
-895,12
+895,13
@@
static void sbp2_host_reset(struct hpsb_host *host)
return;
read_lock_irqsave(&sbp2_hi_logical_units_lock, flags);
+
list_for_each_entry(lu, &hi->logical_units, lu_list)
- if (
likely(atomic_read(&lu->state) !=
- SBP2LU_STATE_IN_SHUTDOWN)) {
- atomic_set(&lu->state, SBP2LU_STATE_IN_RESET);
+ if (
atomic_cmpxchg(&lu->state,
+ SBP2LU_STATE_RUNNING, SBP2LU_STATE_IN_RESET)
+ == SBP2LU_STATE_RUNNING)
scsi_block_requests(lu->shost);
- }
+
read_unlock_irqrestore(&sbp2_hi_logical_units_lock, flags);
}