#
c6621392 |
| 02-Apr-2009 |
Mikulas Patocka <mpatocka@redhat.com> |
dm snapshot: avoid dropping lock in __find_pending_exception
It is uncommon and bug-prone to drop a lock in a function that is called with the lock held, so this is moved to the caller.
Cc: stable@
dm snapshot: avoid dropping lock in __find_pending_exception
It is uncommon and bug-prone to drop a lock in a function that is called with the lock held, so this is moved to the caller.
Cc: stable@kernel.org Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
show more ...
|
#
2913808e |
| 02-Apr-2009 |
Mikulas Patocka <mpatocka@redhat.com> |
dm snapshot: refactor __find_pending_exception
Move looking-up of a pending exception from __find_pending_exception to another function.
Cc: stable@kernel.org Signed-off-by: Mikulas Patocka <mpatoc
dm snapshot: refactor __find_pending_exception
Move looking-up of a pending exception from __find_pending_exception to another function.
Cc: stable@kernel.org Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
show more ...
|
Revision tags: v2.6.29, v2.6.29-rc8, v2.6.29-rc7, v2.6.29-rc6, v2.6.29-rc5, v2.6.29-rc4, v2.6.29-rc3, v2.6.29-rc2, v2.6.29-rc1 |
|
#
a159c1ac |
| 05-Jan-2009 |
Jonathan Brassow <jbrassow@redhat.com> |
dm snapshot: extend exception store functions
Supply dm_add_exception as a callback to the read_metadata function. Add a status function ready for a later patch and name the functions consistently.
dm snapshot: extend exception store functions
Supply dm_add_exception as a callback to the read_metadata function. Add a status function ready for a later patch and name the functions consistently.
Signed-off-by: Jonathan Brassow <jbrassow@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
show more ...
|
#
4db6bfe0 |
| 05-Jan-2009 |
Alasdair G Kergon <agk@redhat.com> |
dm snapshot: split out exception store implementations
Move the existing snapshot exception store implementations out into separate files. Later patches will place these behind a new interface in p
dm snapshot: split out exception store implementations
Move the existing snapshot exception store implementations out into separate files. Later patches will place these behind a new interface in preparation for alternative implementations.
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
show more ...
|
#
aea53d92 |
| 05-Jan-2009 |
Jonathan Brassow <jbrassow@redhat.com> |
dm snapshot: separate out exception store interface
Pull structures that bridge the gap between snapshot and exception store out of dm-snap.h and put them in a new .h file - dm-exception-store.h. T
dm snapshot: separate out exception store interface
Pull structures that bridge the gap between snapshot and exception store out of dm-snap.h and put them in a new .h file - dm-exception-store.h. This file will define the API for new exception stores.
Ultimately, dm-snap.h is unnecessary, since only dm-snap.c should be using it.
Signed-off-by: Jonathan Brassow <jbrassow@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
show more ...
|
#
10d3bd09 |
| 05-Jan-2009 |
Mikulas Patocka <mpatocka@redhat.com> |
dm: consolidate target deregistration error handling
Change dm_unregister_target to return void and use BUG() for error reporting.
dm_unregister_target can only fail because of programming bug in t
dm: consolidate target deregistration error handling
Change dm_unregister_target to return void and use BUG() for error reporting.
dm_unregister_target can only fail because of programming bug in the target driver. It can't fail because of user's behavior or disk errors.
This patch changes unregister_target to return void and use BUG if someone tries to unregister non-registered target or unregister target that is in use.
This patch removes code duplication (testing of error codes in all dm targets) and reports bugs in just one place, in dm_unregister_target. In some target drivers, these return codes were ignored, which could lead to a situation where bugs could be missed.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
show more ...
|
#
90fa1527 |
| 05-Jan-2009 |
Mikulas Patocka <mpatocka@redhat.com> |
dm snapshot: change yield to msleep
Change yield() to msleep(1). If the thread had realtime priority, yield() doesn't really yield, so the yielding process would loop indefinitely and cause machine
dm snapshot: change yield to msleep
Change yield() to msleep(1). If the thread had realtime priority, yield() doesn't really yield, so the yielding process would loop indefinitely and cause machine lockup.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
show more ...
|
Revision tags: v2.6.28, v2.6.28-rc9, v2.6.28-rc8, v2.6.28-rc7, v2.6.28-rc6, v2.6.28-rc5, v2.6.28-rc4, v2.6.28-rc3 |
|
#
879129d2 |
| 30-Oct-2008 |
Mikulas Patocka <mpatocka@redhat.com> |
dm snapshot: wait for chunks in destructor
If there are several snapshots sharing an origin and one is removed while the origin is being written to, the snapshot's mempool may get deleted while elem
dm snapshot: wait for chunks in destructor
If there are several snapshots sharing an origin and one is removed while the origin is being written to, the snapshot's mempool may get deleted while elements are still referenced.
Prior to dm-snapshot-use-per-device-mempools.patch the pending exceptions may still have been referenced after the snapshot was destroyed, but this was not a problem because the shared mempool was still there.
This patch fixes the problem by tracking the number of mempool elements in use.
The scenario: - You have an origin and two snapshots 1 and 2. - Someone writes to the origin. - It creates two exceptions in the snapshots, snapshot 1 will be primary exception, snapshot 2's pending_exception->primary_pe will point to the exception in snapshot 1. - The exceptions are being relocated, relocation of exception 1 finishes (but it's pending_exception is still allocated, because it is referenced by an exception from snapshot 2) - The user lvremoves snapshot 1 --- it calls just suspend (does nothing) and destructor. md->pending is zero (there is no I/O submitted to the snapshot by md layer), so it won't help us. - The destructor waits for kcopyd jobs to finish on snapshot 1 --- but there are none. - The destructor on snapshot 1 cleans up everything. - The relocation of exception on snapshot 2 finishes, it drops reference on primary_pe. This frees its primary_pe pointer. Primary_pe points to pending exception created for snapshot 1. So it frees memory into non-existing mempool.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
show more ...
|
#
60c856c8 |
| 30-Oct-2008 |
Mikulas Patocka <mpatocka@redhat.com> |
dm snapshot: fix register_snapshot deadlock
register_snapshot() performs a GFP_KERNEL allocation while holding _origins_lock for write, but that could write out dirty pages onto a device that attemp
dm snapshot: fix register_snapshot deadlock
register_snapshot() performs a GFP_KERNEL allocation while holding _origins_lock for write, but that could write out dirty pages onto a device that attempts to acquire _origins_lock for read, resulting in deadlock.
So move the allocation up before taking the lock.
This path is not performance-critical, so it doesn't matter that we allocate memory and free it if we find that we won't need it.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
show more ...
|
Revision tags: v2.6.28-rc2, v2.6.28-rc1 |
|
#
f68d4f3d |
| 21-Oct-2008 |
Mikulas Patocka <mpatocka@redhat.com> |
dm snapshot: drop unused last_percent
The last_percent field is unused - remove it. (It dates from when events were triggered as each X% filled up.)
Signed-off-by: Mikulas Patocka <mpatocka@redhat.
dm snapshot: drop unused last_percent
The last_percent field is unused - remove it. (It dates from when events were triggered as each X% filled up.)
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
show more ...
|
#
7c5f78b9 |
| 21-Oct-2008 |
Mikulas Patocka <mpatocka@redhat.com> |
dm snapshot: fix primary_pe race
Fix a race condition with primary_pe ref_count handling.
put_pending_exception runs under dm_snapshot->lock, it does atomic_dec_and_test on primary_pe->ref_count, a
dm snapshot: fix primary_pe race
Fix a race condition with primary_pe ref_count handling.
put_pending_exception runs under dm_snapshot->lock, it does atomic_dec_and_test on primary_pe->ref_count, and later does atomic_read primary_pe->ref_count.
__origin_write does atomic_dec_and_test on primary_pe->ref_count without holding dm_snapshot->lock.
This opens the following race condition: Assume two CPUs, CPU1 is executing put_pending_exception (and holding dm_snapshot->lock). CPU2 is executing __origin_write in parallel. primary_pe->ref_count == 2.
CPU1: if (primary_pe && atomic_dec_and_test(&primary_pe->ref_count)) origin_bios = bio_list_get(&primary_pe->origin_bios); ... decrements primary_pe->ref_count to 1. Doesn't load origin_bios
CPU2: if (first && atomic_dec_and_test(&primary_pe->ref_count)) { flush_bios(bio_list_get(&primary_pe->origin_bios)); free_pending_exception(primary_pe); /* If we got here, pe_queue is necessarily empty. */ return r; } ... decrements primary_pe->ref_count to 0, submits pending bios, frees primary_pe.
CPU1: if (!primary_pe || primary_pe != pe) free_pending_exception(pe); ... this has no effect. if (primary_pe && !atomic_read(&primary_pe->ref_count)) free_pending_exception(primary_pe); ... sees ref_count == 0 (written by CPU 2), does double free !!
This bug can happen only if someone is simultaneously writing to both the origin and the snapshot.
If someone is writing only to the origin, __origin_write will submit kcopyd request after it decrements primary_pe->ref_count (so it can't happen that the finished copy races with primary_pe->ref_count decrementation).
If someone is writing only to the snapshot, __origin_write isn't invoked at all and the race can't happen.
The race happens when someone writes to the snapshot --- this creates pending_exception with primary_pe == NULL and starts copying. Then, someone writes to the same chunk in the snapshot, and __origin_write races with termination of already submitted request in pending_complete (that calls put_pending_exception).
This race may be reason for bugs: http://bugzilla.kernel.org/show_bug.cgi?id=11636 https://bugzilla.redhat.com/show_bug.cgi?id=465825
The patch fixes the code to make sure that: 1. If atomic_dec_and_test(&primary_pe->ref_count) returns false, the process must no longer dereference primary_pe (because someone else may free it under us). 2. If atomic_dec_and_test(&primary_pe->ref_count) returns true, the process is responsible for freeing primary_pe.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com> Cc: stable@kernel.org
show more ...
|
Revision tags: v2.6.27, v2.6.27-rc9, v2.6.27-rc8, v2.6.27-rc7, v2.6.27-rc6, v2.6.27-rc5, v2.6.27-rc4, v2.6.27-rc3, v2.6.27-rc2, v2.6.27-rc1 |
|
#
92e86812 |
| 21-Jul-2008 |
Mikulas Patocka <mpatocka@redhat.com> |
dm snapshot: use per device mempools
Change snapshot per-module mempool to per-device mempool.
Per-module mempools could cause a deadlock if multiple snapshot devices are stacked above each other.
dm snapshot: use per device mempools
Change snapshot per-module mempool to per-device mempool.
Per-module mempools could cause a deadlock if multiple snapshot devices are stacked above each other.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
show more ...
|
#
a8d41b59 |
| 21-Jul-2008 |
Mikulas Patocka <mpatocka@redhat.com> |
dm snapshot: fix race during exception creation
Fix a race condition that returns incorrect data when a write causes an exception to be allocated whilst a read is still in flight.
The race conditio
dm snapshot: fix race during exception creation
Fix a race condition that returns incorrect data when a write causes an exception to be allocated whilst a read is still in flight.
The race condition happens as follows: * A read to non-reallocated sector in the snapshot is submitted so that the read is routed to the original device. * A write to the original device is submitted. The write causes an exception that reallocates the block. The write proceeds. * The original read is dequeued and reads the wrong data.
This race can be triggered with CFQ scheduler and one thread writing and multiple threads reading simultaneously.
(This patch relies upon the earlier dm-kcopyd-per-device.patch to avoid a deadlock.)
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
show more ...
|
#
cd45daff |
| 21-Jul-2008 |
Mikulas Patocka <mpatocka@redhat.com> |
dm snapshot: track snapshot reads
Whenever a snapshot read gets mapped through to the origin, track it in a per-snapshot hash table indexed by chunk number, using memory allocated from a new per-sna
dm snapshot: track snapshot reads
Whenever a snapshot read gets mapped through to the origin, track it in a per-snapshot hash table indexed by chunk number, using memory allocated from a new per-snapshot mempool.
We need to track these reads to avoid race conditions which will be fixed by patches that follow.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
show more ...
|
Revision tags: v2.6.26, v2.6.26-rc9, v2.6.26-rc8, v2.6.26-rc7, v2.6.26-rc6, v2.6.26-rc5, v2.6.26-rc4, v2.6.26-rc3, v2.6.26-rc2, v2.6.26-rc1 |
|
#
a765e20e |
| 24-Apr-2008 |
Alasdair G Kergon <agk@redhat.com> |
dm: move include files
Publish the dm-io, dm-log and dm-kcopyd headers in include/linux.
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
|
#
eb69aca5 |
| 24-Apr-2008 |
Heinz Mauelshagen <hjm@redhat.com> |
dm kcopyd: clean interface
Clean up the kcopyd interface to prepare for publishing it in include/linux.
Signed-off-by: Heinz Mauelshagen <hjm@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redha
dm kcopyd: clean interface
Clean up the kcopyd interface to prepare for publishing it in include/linux.
Signed-off-by: Heinz Mauelshagen <hjm@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
show more ...
|
#
22a1ceb1 |
| 24-Apr-2008 |
Heinz Mauelshagen <hjm@redhat.com> |
dm io: clean interface
Clean up the dm-io interface to prepare for publishing it in include/linux.
Signed-off-by: Heinz Mauelshagen <hjm@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
|
#
72727bad |
| 24-Apr-2008 |
Mikulas Patocka <mpatocka@redhat.com> |
dm snapshot: store pointer to target instance
Save pointer to dm_target in dm_snapshot structure.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.c
dm snapshot: store pointer to target instance
Save pointer to dm_target in dm_snapshot structure.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
show more ...
|
#
8ee2767a |
| 24-Apr-2008 |
Milan Broz <mbroz@redhat.com> |
dm snapshot: reduce default memory allocation
Limit the amount of memory allocated per snapshot on systems with a large page size. (The larger default chunk size on these systems compensates for th
dm snapshot: reduce default memory allocation
Limit the amount of memory allocated per snapshot on systems with a large page size. (The larger default chunk size on these systems compensates for the smaller number of pages reserved.)
Signed-off-by: Milan Broz <mbroz@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
show more ...
|
Revision tags: v2.6.25, v2.6.25-rc9, v2.6.25-rc8 |
|
#
4cdc1d1f |
| 28-Mar-2008 |
Alasdair G Kergon <agk@redhat.com> |
dm io: write error bits form long not int
write_err is an unsigned long used with set_bit() so should not be passed around as unsigned int.
http://bugzilla.kernel.org/show_bug.cgi?id=10271
Signed-
dm io: write error bits form long not int
write_err is an unsigned long used with set_bit() so should not be passed around as unsigned int.
http://bugzilla.kernel.org/show_bug.cgi?id=10271
Signed-off-by: Alasdair G Kergon <agk@redhat.com> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
show more ...
|
Revision tags: v2.6.25-rc7, v2.6.25-rc6, v2.6.25-rc5, v2.6.25-rc4, v2.6.25-rc3, v2.6.25-rc2, v2.6.25-rc1 |
|
#
d74f81f8 |
| 07-Feb-2008 |
Milan Broz <mbroz@redhat.com> |
dm snapshot: combine consecutive exceptions in memory
Provided sector_t is 64 bits, reduce the in-memory footprint of the snapshot exception table by the simple method of using unused bits of the ch
dm snapshot: combine consecutive exceptions in memory
Provided sector_t is 64 bits, reduce the in-memory footprint of the snapshot exception table by the simple method of using unused bits of the chunk number to combine consecutive entries.
Signed-off-by: Milan Broz <mbroz@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
show more ...
|
#
8defd830 |
| 07-Feb-2008 |
Robert P. J. Day <rpjday@crashcourse.ca> |
dm snapshot: use rounddown_pow_of_two
Since the source file already includes the log2.h header file, it seems pointless to re-invent the necessary routine.
Signed-off-by: Robert P. J. Day <rpjday@c
dm snapshot: use rounddown_pow_of_two
Since the source file already includes the log2.h header file, it seems pointless to re-invent the necessary routine.
Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
show more ...
|
Revision tags: v2.6.24, v2.6.24-rc8, v2.6.24-rc7, v2.6.24-rc6, v2.6.24-rc5, v2.6.24-rc4, v2.6.24-rc3, v2.6.24-rc2, v2.6.24-rc1 |
|
#
6f3c3f0a |
| 19-Oct-2007 |
vignesh babu <vignesh.babu@wipro.com> |
dm: use is_power_of_2
Replacing n & (n - 1) for power of 2 check by is_power_of_2(n)
Signed-off-by: vignesh babu <vignesh.babu@wipro.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
|
Revision tags: v2.6.23, v2.6.23-rc9 |
|
#
6712ecf8 |
| 27-Sep-2007 |
NeilBrown <neilb@suse.de> |
Drop 'size' argument from bio_endio and bi_end_io
As bi_end_io is only called once when the reqeust is complete, the 'size' argument is now redundant. Remove it.
Now there is no need for bio_endio
Drop 'size' argument from bio_endio and bi_end_io
As bi_end_io is only called once when the reqeust is complete, the 'size' argument is now redundant. Remove it.
Now there is no need for bio_endio to subtract the size completed from bi_size. So don't do that either.
While we are at it, change bi_end_io to return void.
Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
show more ...
|
Revision tags: v2.6.23-rc8, v2.6.23-rc7, v2.6.23-rc6, v2.6.23-rc5, v2.6.23-rc4, v2.6.23-rc3, v2.6.23-rc2, v2.6.23-rc1 |
|
#
07a83c47 |
| 12-Jul-2007 |
Stefan Bader <shbader@de.ibm.com> |
dm: disable barriers
This patch causes device-mapper to reject any barrier requests. This is done since most of the targets won't handle this correctly anyway. So until the situation improves it i
dm: disable barriers
This patch causes device-mapper to reject any barrier requests. This is done since most of the targets won't handle this correctly anyway. So until the situation improves it is better to reject these requests at the first place. Since barrier requests won't get to the targets, the checks there can be removed.
Cc: stable@kernel.org Signed-off-by: Stefan Bader <shbader@de.ibm.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
show more ...
|