aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm.c
diff options
context:
space:
mode:
authorShaohua Li <shaohua.li@intel.com>2011-03-22 08:35:35 +0100
committerJens Axboe <jaxboe@fusionio.com>2011-03-22 08:35:35 +0100
commit1e9bb8808ac11094d711d20d580e7b45a4992d0c (patch)
treed0e228b619664b7f507e37e5eba4a5ebeef103a0 /drivers/md/dm.c
parent5e84ea3a9c662dc2d7a48703a4468fad954a3b7f (diff)
downloadkernel_samsung_aries-1e9bb8808ac11094d711d20d580e7b45a4992d0c.zip
kernel_samsung_aries-1e9bb8808ac11094d711d20d580e7b45a4992d0c.tar.gz
kernel_samsung_aries-1e9bb8808ac11094d711d20d580e7b45a4992d0c.tar.bz2
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<shaohua.li@intel.com> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r--drivers/md/dm.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 8882070..0cf68b4 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -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 */