summaryrefslogtreecommitdiffstats
path: root/drivers/md
Commit message (Collapse)AuthorAgeFilesLines
* md: Add in export.h for files using EXPORT_SYMBOLPaul Gortmaker2011-10-313-0/+3
| | | | | | | | These files were getting the defines for EXPORT_SYMBOL because device.h was including module.h. But we are going to put an end to that. So add the proper export.h include now. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
* md: Add module.h to all files using it implicitlyPaul Gortmaker2011-10-3114-0/+14
| | | | | | | | A pending cleanup will mean that module.h won't be implicitly everywhere anymore. Make sure the modular drivers in md dir are actually calling out for <module.h> explicitly in advance. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
* Merge branch 'for-linus' of git://neil.brown.name/mdLinus Torvalds2011-10-2618-1272/+1216
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'for-linus' of git://neil.brown.name/md: (34 commits) md: Fix some bugs in recovery_disabled handling. md/raid5: fix bug that could result in reads from a failed device. lib/raid6: Fix filename emitted in generated code md.c: trivial comment fix MD: Allow restarting an interrupted incremental recovery. md: clear In_sync bit on devices added to an active array. md: add proper write-congestion reporting to RAID1 and RAID10. md: rename "mdk_personality" to "md_personality" md/bitmap remove fault injection options. md/raid5: typedef removal: raid5_conf_t -> struct r5conf md/raid1: typedef removal: conf_t -> struct r1conf md/raid10: typedef removal: conf_t -> struct r10conf md/raid0: typedef removal: raid0_conf_t -> struct r0conf md/multipath: typedef removal: multipath_conf_t -> struct mpconf md/linear: typedef removal: linear_conf_t -> struct linear_conf md/faulty: remove typedef: conf_t -> struct faulty_conf md/linear: remove typedefs: dev_info_t -> struct dev_info md: remove typedefs: mirror_info_t -> struct mirror_info md: remove typedefs: r10bio_t -> struct r10bio and r1bio_t -> struct r1bio md: remove typedefs: mdk_thread_t -> struct md_thread ...
| * md: Fix some bugs in recovery_disabled handling.NeilBrown2011-10-263-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 3.0 we changed the way recovery_disabled was handle so that instead of testing against zero, we test an mddev-> value against a conf-> value. Two problems: 1/ one place in raid1 was missed and still sets to '1'. 2/ We didn't explicitly set the conf-> value at array creation time. It defaulted to '0' just like the mddev value does so they could appear equal and thus disable recovery. This did not affect normal 'md' as it calls bind_rdev_to_array which changes the mddev value. However the dmraid interface doesn't call this and so doesn't change ->recovery_disabled; so at array start all recovery is incorrectly disabled. So initialise the 'conf' value to one less that the mddev value, so the will only be the same when explicitly set that way. Reported-by: Jonathan Brassow <jbrassow@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
| * md/raid5: fix bug that could result in reads from a failed device.NeilBrown2011-10-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This bug was introduced in 415e72d034c50520ddb7ff79e7d1792c1306f0c9 which was in 2.6.36. There is a small window of time between when a device fails and when it is removed from the array. During this time we might still read from it, but we won't write to it - so it is possible that we could read stale data. We didn't need the test of 'Faulty' before because the test on In_sync is sufficient. Since we started allowing reads from the early part of non-In_sync devices we need a test on Faulty too. This is suitable for any kernel from 2.6.36 onwards, though the patch might need a bit of tweaking in 3.0 and earlier. Cc: stable@kernel.org Signed-off-by: NeilBrown <neilb@suse.de>
| * md.c: trivial comment fixChris Dunlop2011-10-191-2/+2
| | | | | | | | | | | | | | Trivial comment fix Signed-off-by: Chris Dunlop <chris@onthe.net.au> Signed-off-by: NeilBrown <neilb@suse.de>
| * MD: Allow restarting an interrupted incremental recovery.Andrei Warkentin2011-10-181-7/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | If an incremental recovery was interrupted, a subsequent re-add will result in a full recovery, even though an incremental should be possible (seen with raid1). Solve this problem by not updating the superblock on the recovering device until array is not degraded any longer. Cc: Neil Brown <neilb@suse.de> Signed-off-by: Andrei Warkentin <andreiw@vmware.com> Signed-off-by: NeilBrown <neilb@suse.de>
| * md: clear In_sync bit on devices added to an active array.NeilBrown2011-10-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When we add a device to an active array it can be meaningful to set the 'insync' flag. This indicates that the device is in-sync with the array except for locations recorded in the bitmap. A bitmap-based recovery can then bring it completely in-sync. Internally we move that flag to 'saved_raid_disk' but forgot to clear In_sync like we do in add_new_disk. So clear In_sync after moving its value to saved_raid_disk. Reported-by: Andrei Warkentin <andreiw@vmware.com> Signed-off-by: NeilBrown <neilb@suse.de>
| * md: add proper write-congestion reporting to RAID1 and RAID10.NeilBrown2011-10-114-1/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RAID1 and RAID10 handle write requests by queuing them for handling by a separate thread. This is because when a write-intent-bitmap is active we might need to update the bitmap first, so it is good to queue a lot of writes, then do one big bitmap update for them all. However writeback request devices to appear to be congested after a while so it can make some guesstimate of throughput. The infinite queue defeats that (note that RAID5 has already has a finite queue so it doesn't suffer from this problem). So impose a limit on the number of pending write requests. By default it is 1024 which seems to be generally suitable. Make it configurable via module option just in case someone finds a regression. Signed-off-by: NeilBrown <neilb@suse.de>
| * md: rename "mdk_personality" to "md_personality"NeilBrown2011-10-119-22/+22
| | | | | | | | | | | | "mdk" doesn't mean anything any more. Signed-off-by: NeilBrown <neilb@suse.de>
| * md/bitmap remove fault injection options.NeilBrown2011-10-111-33/+1
| | | | | | | | | | | | These are too hard to use to be much more than noise. Signed-off-by: NeilBrown <neilb@suse.de>
| * md/raid5: typedef removal: raid5_conf_t -> struct r5confNeilBrown2011-10-113-86/+84
| | | | | | | | Signed-off-by: NeilBrown <neilb@suse.de>
| * md/raid1: typedef removal: conf_t -> struct r1confNeilBrown2011-10-112-50/+48
| | | | | | | | Signed-off-by: NeilBrown <neilb@suse.de>
| * md/raid10: typedef removal: conf_t -> struct r10confNeilBrown2011-10-112-57/+55
| | | | | | | | Signed-off-by: NeilBrown <neilb@suse.de>
| * md/raid0: typedef removal: raid0_conf_t -> struct r0confNeilBrown2011-10-114-24/+20
| | | | | | | | Signed-off-by: NeilBrown <neilb@suse.de>
| * md/multipath: typedef removal: multipath_conf_t -> struct mpconfNeilBrown2011-10-112-18/+16
| | | | | | | | Signed-off-by: NeilBrown <neilb@suse.de>
| * md/linear: typedef removal: linear_conf_t -> struct linear_confNeilBrown2011-10-112-13/+9
| | | | | | | | Signed-off-by: NeilBrown <neilb@suse.de>
| * md/faulty: remove typedef: conf_t -> struct faulty_confNeilBrown2011-10-111-10/+10
| | | | | | | | Signed-off-by: NeilBrown <neilb@suse.de>
| * md/linear: remove typedefs: dev_info_t -> struct dev_infoNeilBrown2011-10-112-8/+6
| | | | | | | | Signed-off-by: NeilBrown <neilb@suse.de>
| * md: remove typedefs: mirror_info_t -> struct mirror_infoNeilBrown2011-10-114-17/+13
| | | | | | | | Signed-off-by: NeilBrown <neilb@suse.de>
| * md: remove typedefs: r10bio_t -> struct r10bio and r1bio_t -> struct r1bioNeilBrown2011-10-114-76/+71
| | | | | | | | Signed-off-by: NeilBrown <neilb@suse.de>
| * md: remove typedefs: mdk_thread_t -> struct md_threadNeilBrown2011-10-115-18/+20
| | | | | | | | Signed-off-by: NeilBrown <neilb@suse.de>
| * md: remove typedefs: mddev_t -> struct mddevNeilBrown2011-10-1116-420/+417
| | | | | | | | | | | | Having mddev_t and 'struct mddev_s' is ugly and not preferred Signed-off-by: NeilBrown <neilb@suse.de>
| * md: removing typedefs: mdk_rdev_t -> struct md_rdevNeilBrown2011-10-1117-219/+219
| | | | | | | | | | | | | | The typedefs are just annoying. 'mdk' probably refers to 'md_k.h' which used to be an include file that defined this thing. Signed-off-by: NeilBrown <neilb@suse.de>
| * md/raid0: convert some printks to pr_debug.NeilBrown2011-10-071-48/+50
| | | | | | | | | | | | | | | | | | When md assembles a RAID0 array it prints out lots of info which is really just for debugging, so convert that to pr_debug. It also prints out the resulting configuration which could be interesting, so keep that as 'printk' but tidy it up a bit. Signed-off-by: NeilBrown <neilb@suse.de>
| * md: remove PRINTK and dprintk debugging and use pr_debugNeilBrown2011-10-073-50/+35
| | | | | | | | | | | | Being able to dynamically enable these make them much more useful. Signed-off-by: NeilBrown <neilb@suse.de>
| * md: remove some old DEBUGging code.NeilBrown2011-10-072-84/+0
| | | | | | | | | | | | | | This code is not really helpful and is hard to maintain, so just discard it. Signed-off-by: NeilBrown <neilb@suse.de>
| * md/raid5: convert to macros into inline functions.NeilBrown2011-10-071-3/+14
| | | | | | | | | | | | More type-safety. Easier to read. Signed-off-by: NeilBrown <neilb@suse.de>
| * md/raid1/ avoid bio search in end_sync_read()NeilBrown2011-10-071-2/+1
| | | | | | | | | | | | | | We know which device we just read from so we don't need to search the bios to find out. Just use ->read_disk. Signed-off-by: NeilBrown <neilb@suse.de>
| * md/raid1: factor out common bio handling codeNamhyung Kim2011-10-071-20/+24
| | | | | | | | | | | | | | | | | | When normal-write and sync-read/write bio completes, we should find out the disk number the bio belongs to. Factor those common code out to a separate function. Signed-off-by: Namhyung Kim <namhyung@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
| * md/raid5: remove pointless NULL test.NeilBrown2011-10-071-4/+2
| | | | | | | | | | | | | | | | In the 'abort' branch of run(), 'conf' cannot possibly be NULL, so remove the test. Reported-by: Zdenek Kabelac <zdenek.kabelac@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
| * md/raid1: add documentation to r1_private_data_s data structure.NeilBrown2011-10-071-17/+42
| | | | | | | | | | | | | | | | There wasn't much and it is inconsistent. Also rearrange fields to keep related fields together. Reported-by: Aapo Laine <aapo.laine@shiftmail.org> Signed-off-by: NeilBrown <neilb@suse.de>
| * md: don't delay reboot by 1 second if no MD devices existDaniel P. Berrange2011-09-231-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The md_notify_reboot() method includes a call to mdelay(1000), to deal with "exotic SCSI devices" which are too volatile on reboot. The delay is unconditional. Even if the machine does not have any block devices, let alone MD devices, the kernel shutdown sequence is slowed down. 1 second does not matter much with physical hardware, but with certain virtualization use cases any wasted time in the bootup & shutdown sequence counts for alot. * drivers/md/md.c: md_notify_reboot() - only impose a delay if there was at least one MD device to be stopped during reboot Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
| * trival: md_k.h should be md.h in the beginning comment of file md.hWang Sheng-Hui2011-09-211-1/+1
| | | | | | | | | | Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
| * md/bitmap: improve handling of 'allclean'.NeilBrown2011-09-211-15/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 'allclean' flag is used to cache the fact that there is nothing to do, so we can avoid waking up and scanning the bitmap regularly. The two sorts of pages that might need the attention of the bitmap daemon are BITMAP_PAGE_PENDING and BITMAP_PAGE_NEEDWRITE pages. So make sure allclean reflects exactly when there are none of those. So: set it before scanning all pages with either bit set. clear it whenever these bits are set clear it when we desire not to clear one of these bits. don't clear it any other time. Signed-off-by: NeilBrown <neilb@suse.de>
| * md/bitmap: rename and tidy up BITMAP_PAGE_CLEANNeilBrown2011-09-211-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The flag 'BITMAP_PAGE_CLEAN' has a confusing name as it doesn't mean that the page is clean, but rather that there are counters in the page which allow bits in the bitmap to be cleared - i.e. maybe cleaning can happen. So change it to BITMAP_PAGE_PENDING and fix some irregularities: - Don't set it in bitmap_init_from_disk as bitmap_set_memory_bits sets it when needed - in bitmap_daemon_work, if we find a counter that is '1', but need_sync is set, then set BITMAP_PAGE_PENDING again (it was recently cleared) to ensure we don't forget about this bit. Signed-off-by: NeilBrown <neilb@suse.de>
* | dm kcopyd: fix job_pool leakAlasdair G Kergon2011-10-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix memory leak introduced by commit a6e50b409d3f9e0833e69c3c9cca822e8fa4adbb (dm snapshot: skip reading origin when overwriting complete chunk). When allocating a set of jobs from kc->job_pool, job->master_job must be set (to point to itself) so that the mempool item gets freed when the master_job completes. master_job was introduced by commit c6ea41fbbe08f270a8edef99dc369faf809d1bd6 (dm kcopyd: preallocate sub jobs to avoid deadlock) Reported-by: Michael Leun <ml@newton.leun.net> Cc: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
* | Merge branch 'for-linus' of http://people.redhat.com/agk/git/linux-dmLinus Torvalds2011-10-064-8/+32
|\ \ | |/ |/| | | | | | | | | | | * 'for-linus' of http://people.redhat.com/agk/git/linux-dm: dm crypt: always disable discard_zeroes_data dm: raid fix write_mostly arg validation dm table: avoid crash if integrity profile changes dm: flakey fix corrupt_bio_byte error path
| * dm crypt: always disable discard_zeroes_dataMilan Broz2011-09-252-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If optional discard support in dm-crypt is enabled, discards requests bypass the crypt queue and blocks of the underlying device are discarded. For the read path, discarded blocks are handled the same as normal ciphertext blocks, thus decrypted. So if the underlying device announces discarded regions return zeroes, dm-crypt must disable this flag because after decryption there is just random noise instead of zeroes. Signed-off-by: Milan Broz <mbroz@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
| * dm: raid fix write_mostly arg validationJonthan Brassow2011-09-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Fix off-by-one error in validation of write_mostly. The user-supplied value given for the 'write_mostly' argument must be an index starting at 0. The validation of the supplied argument failed to check for 'N' ('>' vs '>='), which would have caused an access beyond the end of the array. Reported-by: Doug Ledford <dledford@redhat.com> Signed-off-by: Jonathan Brassow <jbrassow@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
| * dm table: avoid crash if integrity profile changesMike Snitzer2011-09-251-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit a63a5cf (dm: improve block integrity support) introduced a two-phase initialization of a DM device's integrity profile. This patch avoids dereferencing a NULL 'template_disk' pointer in blk_integrity_register() if there is an integrity profile mismatch in dm_table_set_integrity(). This can occur if the integrity profiles for stacked devices in a DM table are changed between the call to dm_table_prealloc_integrity() and dm_table_set_integrity(). Reported-by: Zdenek Kabelac <zkabelac@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com> Cc: stable@kernel.org # 2.6.39
| * dm: flakey fix corrupt_bio_byte error pathMike Snitzer2011-09-251-1/+3
| | | | | | | | | | | | | | | | | | If no arguments were provided to the corrupt_bio_byte feature an error should be returned immediately. Reported-by: Zdenek Kabelac <zkabelac@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
* | md: Avoid waking up a thread after it has been freed.NeilBrown2011-09-216-15/+26
|/ | | | | | | | | | | | | | | | | | | | | | | | | | Two related problems: 1/ some error paths call "md_unregister_thread(mddev->thread)" without subsequently clearing ->thread. A subsequent call to mddev_unlock will try to wake the thread, and crash. 2/ Most calls to md_wakeup_thread are protected against the thread disappeared either by: - holding the ->mutex - having an active request, so something else must be keeping the array active. However mddev_unlock calls md_wakeup_thread after dropping the mutex and without any certainty of an active request, so the ->thread could theoretically disappear. So we need a spinlock to provide some protections. So change md_unregister_thread to take a pointer to the thread pointer, and ensure that it always does the required locking, and clears the pointer properly. Reported-by: "Moshe Melnikov" <moshe@zadarastorage.com> Signed-off-by: NeilBrown <neilb@suse.de> cc: stable@kernel.org
* md: Fix handling for devices from 2TB to 4TB in 0.90 metadata.NeilBrown2011-09-101-2/+10
| | | | | | | | | | | | | | | | | | | | 0.90 metadata uses an unsigned 32bit number to count the number of kilobytes used from each device. This should allow up to 4TB per device. However we multiply this by 2 (to get sectors) before casting to a larger type, so sizes above 2TB get truncated. Also we allow rdev->sectors to be larger than 4TB, so it is possible for the array to be resized larger than the metadata can handle. So make sure rdev->sectors never exceeds 4TB when 0.90 metadata is in used. Also the sanity check at the end of super_90_load should include level 1 as it used ->size too. (RAID0 and Linear don't use ->size at all). Reported-by: Pim Zandbergen <P.Zandbergen@macroscoop.nl> Cc: stable@kernel.org Signed-off-by: NeilBrown <neilb@suse.de>
* md/raid1,10: Remove use-after-free bug in make_request.NeilBrown2011-09-102-10/+17
| | | | | | | | | | | | | | | | | | | | A single request to RAID1 or RAID10 might result in multiple requests if there are known bad blocks that need to be avoided. To detect if we need to submit another write request we test: if (sectors_handled < (bio->bi_size >> 9)) { However this is after we call **_write_done() so the 'bio' no longer belongs to us - the writes could have completed and the bio freed. So move the **_write_done call until after the test against bio->bi_size. This addresses https://bugzilla.kernel.org/show_bug.cgi?id=41862 Reported-by: Bruno Wolff III <bruno@wolff.to> Tested-by: Bruno Wolff III <bruno@wolff.to> Signed-off-by: NeilBrown <neilb@suse.de>
* md/raid10: unify handling of write completion.NeilBrown2011-09-101-20/+18
| | | | | | | | | | | | | | | | | | | | A write can complete at two different places: 1/ when the last member-device write completes, through raid10_end_write_request 2/ in make_request() when we remove the initial bias from ->remaining. These two should do exactly the same thing and the comment says they do, but they don't. So factor the correct code out into a function and call it in both places. This makes the code much more similar to RAID1. The difference is only significant if there is an error, and they usually take a while, so it is unlikely that there will be an error already when make_request is completing, so this is unlikely to cause real problems. Signed-off-by: NeilBrown <neilb@suse.de>
* md/raid5: fix a hang on device failure.NeilBrown2011-08-311-1/+1
| | | | | | | | | | | Waiting for a 'blocked' rdev to become unblocked in the raid5d thread cannot work with internal metadata as it is the raid5d thread which will clear the blocked flag. This wasn't a problem in 3.0 and earlier as we only set the blocked flag when external metadata was used then. However we now set it always, so we need to be more careful. Signed-off-by: NeilBrown <neilb@suse.de>
* md: fix clearing of 'blocked' flag in the presence of bad blocks.NeilBrown2011-08-301-1/+1
| | | | | | | | | | | When the 'blocked' flag on a device is cleared while there are unacknowledged bad blocks we must fail the device. This is needed for backwards compatability of the interface. The code currently uses the wrong test for "unacknowledged bad blocks exist". Change it to the right test. Signed-off-by: NeilBrown <neilb@suse.de>
* md/linear: avoid corrupting structure while waiting for rcu_free to complete.NeilBrown2011-08-251-1/+1
| | | | | | | | | I don't know what I was thinking putting 'rcu' after a dynamically sized array! The array could still be in use when we call rcu_free() (That is the point) so we mustn't corrupt it. Cc: stable@kernel.org Signed-off-by: NeilBrown <neilb@suse.de>
* md: use REQ_NOIDLE flag in md_super_write()Namhyung Kim2011-08-251-1/+1
| | | | | | | | | | | | | | Queue idling is used for the anticipation of immediate sequencial I/O's but md_super_write() is a kind of one- shot operation, coupled with md_super_wait(), so the idling in this case will be just a waste of time. Specifying REQ_NOIDLE prevents it. Instead of adding the flag to submit_bio() directly, use pre-defined macro WRITE_FLUSH_FUA. Signed-off-by: Namhyung Kim <namhyung@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
OpenPOWER on IntegriCloud