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

[PATCH] dm snapshot: fix metadata writing when suspending

When suspending a device-mapper device, dm_suspend() sleeps until all
necessary I/O is completed. This state is triggered by a callback from
persistent_commit(). But some I/O can still be issued *after* the callback
(to prepare the next metadata area for use if the current one is full). This
patch delays the callback until after that I/O is complete.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Mark McLoughlin and committed by
Linus Torvalds
927ffe7c e4ff496d

+10 -10
+10 -10
drivers/md/dm-exception-store.c
··· 536 536 if (r) 537 537 ps->valid = 0; 538 538 539 + /* 540 + * Have we completely filled the current area ? 541 + */ 542 + if (ps->current_committed == ps->exceptions_per_area) { 543 + ps->current_committed = 0; 544 + r = zero_area(ps, ps->current_area + 1); 545 + if (r) 546 + ps->valid = 0; 547 + } 548 + 539 549 for (i = 0; i < ps->callback_count; i++) { 540 550 cb = ps->callbacks + i; 541 551 cb->callback(cb->context, r == 0 ? 1 : 0); 542 552 } 543 553 544 554 ps->callback_count = 0; 545 - } 546 - 547 - /* 548 - * Have we completely filled the current area ? 549 - */ 550 - if (ps->current_committed == ps->exceptions_per_area) { 551 - ps->current_committed = 0; 552 - r = zero_area(ps, ps->current_area + 1); 553 - if (r) 554 - ps->valid = 0; 555 555 } 556 556 } 557 557