dm snapshot: only take lock for statustype info not table
Take snapshot lock only for STATUSTYPE_INFO, not STATUSTYPE_TABLE.
Commit 4c6fff445d
(dm-snapshot-lock-snapshot-while-supplying-status.patch)
introduced this use of the lock, but userspace applications using
libdevmapper have been found to request STATUSTYPE_TABLE while the device
is suspended and the lock is already held, leading to deadlock. Since
the lock is not necessary in this case, don't try to take it.
Cc: stable@kernel.org
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
This commit is contained in:
parent
d2bb7df8ca
commit
94e76572b5
|
@ -1152,10 +1152,11 @@ static int snapshot_status(struct dm_target *ti, status_type_t type,
|
||||||
unsigned sz = 0;
|
unsigned sz = 0;
|
||||||
struct dm_snapshot *snap = ti->private;
|
struct dm_snapshot *snap = ti->private;
|
||||||
|
|
||||||
down_write(&snap->lock);
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case STATUSTYPE_INFO:
|
case STATUSTYPE_INFO:
|
||||||
|
|
||||||
|
down_write(&snap->lock);
|
||||||
|
|
||||||
if (!snap->valid)
|
if (!snap->valid)
|
||||||
DMEMIT("Invalid");
|
DMEMIT("Invalid");
|
||||||
else {
|
else {
|
||||||
|
@ -1171,6 +1172,9 @@ static int snapshot_status(struct dm_target *ti, status_type_t type,
|
||||||
else
|
else
|
||||||
DMEMIT("Unknown");
|
DMEMIT("Unknown");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
up_write(&snap->lock);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case STATUSTYPE_TABLE:
|
case STATUSTYPE_TABLE:
|
||||||
|
@ -1185,8 +1189,6 @@ static int snapshot_status(struct dm_target *ti, status_type_t type,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
up_write(&snap->lock);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue