Messages in this thread Patch in this message | | | Date | Fri, 06 Nov 2009 14:14:22 -0800 | From | Greg KH <> | Subject | [24/99] dm snapshot: lock snapshot while supplying status |
| |
2.6.31-stable review patch. If anyone has any objections, please let us know.
------------------ From: Mikulas Patocka <mpatocka@redhat.com>
commit 4c6fff445d7aa753957856278d4d93bcad6e2c14 upstream.
This patch locks the snapshot when returning status. It fixes a race when it could return an invalid number of free chunks if someone was simultaneously modifying it.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
--- drivers/md/dm-snap.c | 4 ++++ 1 file changed, 4 insertions(+)
--- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c @@ -1147,6 +1147,8 @@ static int snapshot_status(struct dm_tar unsigned sz = 0; struct dm_snapshot *snap = ti->private; + down_write(&snap->lock); + switch (type) { case STATUSTYPE_INFO: if (!snap->valid) @@ -1178,6 +1180,8 @@ static int snapshot_status(struct dm_tar break; } + up_write(&snap->lock); + return 0; }
| |