Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dm: convert suspend_lock semaphore to mutex

Replace semaphore with mutex.

Signed-off-by: Daniel Walker <dwalker@mvista.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>

authored by

Daniel Walker and committed by
Alasdair G Kergon
e61290a4 8defd830

+8 -8
+8 -8
drivers/md/dm.c
··· 73 73 74 74 struct mapped_device { 75 75 struct rw_semaphore io_lock; 76 - struct semaphore suspend_lock; 76 + struct mutex suspend_lock; 77 77 spinlock_t pushback_lock; 78 78 rwlock_t map_lock; 79 79 atomic_t holders; ··· 994 994 995 995 memset(md, 0, sizeof(*md)); 996 996 init_rwsem(&md->io_lock); 997 - init_MUTEX(&md->suspend_lock); 997 + mutex_init(&md->suspend_lock); 998 998 spin_lock_init(&md->pushback_lock); 999 999 rwlock_init(&md->map_lock); 1000 1000 atomic_set(&md->holders, 1); ··· 1282 1282 { 1283 1283 int r = -EINVAL; 1284 1284 1285 - down(&md->suspend_lock); 1285 + mutex_lock(&md->suspend_lock); 1286 1286 1287 1287 /* device must be suspended */ 1288 1288 if (!dm_suspended(md)) ··· 1297 1297 r = __bind(md, table); 1298 1298 1299 1299 out: 1300 - up(&md->suspend_lock); 1300 + mutex_unlock(&md->suspend_lock); 1301 1301 return r; 1302 1302 } 1303 1303 ··· 1353 1353 int do_lockfs = suspend_flags & DM_SUSPEND_LOCKFS_FLAG ? 1 : 0; 1354 1354 int noflush = suspend_flags & DM_SUSPEND_NOFLUSH_FLAG ? 1 : 0; 1355 1355 1356 - down(&md->suspend_lock); 1356 + mutex_lock(&md->suspend_lock); 1357 1357 1358 1358 if (dm_suspended(md)) 1359 1359 goto out_unlock; ··· 1475 1475 dm_table_put(map); 1476 1476 1477 1477 out_unlock: 1478 - up(&md->suspend_lock); 1478 + mutex_unlock(&md->suspend_lock); 1479 1479 return r; 1480 1480 } 1481 1481 ··· 1485 1485 struct bio *def; 1486 1486 struct dm_table *map = NULL; 1487 1487 1488 - down(&md->suspend_lock); 1488 + mutex_lock(&md->suspend_lock); 1489 1489 if (!dm_suspended(md)) 1490 1490 goto out; 1491 1491 ··· 1521 1521 1522 1522 out: 1523 1523 dm_table_put(map); 1524 - up(&md->suspend_lock); 1524 + mutex_unlock(&md->suspend_lock); 1525 1525 1526 1526 return r; 1527 1527 }