mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
block: fix non-atomic access to genhd inflight structures
After the stack plugging introduction, these are called lockless. Ensure that the counters are updated atomically. Signed-off-by: Shaohua Li<[email protected]> Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
parent
5e84ea3a9c
commit
1e9bb8808a
3 changed files with 12 additions and 10 deletions
|
|
@ -477,7 +477,8 @@ static void start_io_acct(struct dm_io *io)
|
|||
cpu = part_stat_lock();
|
||||
part_round_stats(cpu, &dm_disk(md)->part0);
|
||||
part_stat_unlock();
|
||||
dm_disk(md)->part0.in_flight[rw] = atomic_inc_return(&md->pending[rw]);
|
||||
atomic_set(&dm_disk(md)->part0.in_flight[rw],
|
||||
atomic_inc_return(&md->pending[rw]));
|
||||
}
|
||||
|
||||
static void end_io_acct(struct dm_io *io)
|
||||
|
|
@ -497,8 +498,8 @@ static void end_io_acct(struct dm_io *io)
|
|||
* After this is decremented the bio must not be touched if it is
|
||||
* a flush.
|
||||
*/
|
||||
dm_disk(md)->part0.in_flight[rw] = pending =
|
||||
atomic_dec_return(&md->pending[rw]);
|
||||
pending = atomic_dec_return(&md->pending[rw]);
|
||||
atomic_set(&dm_disk(md)->part0.in_flight[rw], pending);
|
||||
pending += atomic_read(&md->pending[rw^0x1]);
|
||||
|
||||
/* nudge anyone waiting on suspend queue */
|
||||
|
|
|
|||
Loading…
Reference in a new issue