02 Aug, 2011

31 commits

  • Add the ability to parse and use metadata devices to dm-raid. Although
    not strictly required, without the metadata devices, many features of
    RAID are unavailable. They are used to store a superblock and bitmap.

    The role, or position in the array, of each device must be recorded in
    its superblock. This is to help with fault handling, array reshaping,
    and sanity checks. RAID 4/5/6 devices must be loaded in a specific order:
    in this way, the 'array_position' field helps validate the correctness
    of the mapping when it is loaded. It can be used during reshaping to
    identify which devices are added/removed. Fault handling is impossible
    without this field. For example, when a device fails it is recorded in
    the superblock. If this is a RAID1 device and the offending device is
    removed from the array, there must be a way during subsequent array
    assembly to determine that the failed device was the one removed. This
    is done by correlating the 'array_position' field and the bit-field
    variable 'failed_devices'.

    Signed-off-by: Jonathan Brassow
    Signed-off-by: Alasdair G Kergon

    Jonathan Brassow
     
  • Add the write_mostly parameter to RAID1 dm-raid tables.

    This allows the user to set the WriteMostly flag on a RAID1 device that
    should normally be avoided for read I/O.

    Signed-off-by: Jonathan Brassow
    Signed-off-by: Alasdair G Kergon

    Jonathan Brassow
     
  • Allow the user to specify the region_size.

    Ensures that the supplied value meets md's constraints, viz. the number of
    regions does not exceed 2^21.

    Signed-off-by: Jonathan Brassow
    Signed-off-by: Alasdair G Kergon

    Jonathan Brassow
     
  • Add more information about some dm-raid table parameters and clarify how
    parameters are printed when 'dmsetup table' is issued.

    Signed-off-by: Jonathan Brassow
    Signed-off-by: Alasdair G Kergon

    Jonathan Brassow
     
  • Exactly one of name, uuid or device must be specified when referencing
    an existing device. This removes the ambiguity (risking the wrong
    device being updated) if two conflicting parameters were specified.
    Previously one parameter got used and any others were ignored silently.

    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka
     
  • Move logic to find device based on major/minor number to a separate
    function __get_dev_cell (similar to __get_uuid_cell and __get_name_cell).
    This makes the function __find_device_hash_cell more straightforward.

    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka
     
  • Move parameter filling from find_device to __find_device_hash_cell.

    This patch causes ioctls using __find_device_hash_cell
    (DM_DEV_REMOVE_CMD, DM_DEV_SUSPEND_CMD - resume, DM_TABLE_CLEAR_CMD)
    to return device parameters, bringing them into line with the other
    ioctls.

    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka
     
  • Add corrupt_bio_byte feature to simulate corruption by overwriting a byte at a
    specified position with a specified value during intervals when the device is
    "down".

    Signed-off-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon

    Mike Snitzer
     
  • Add 'drop_writes' option to drop writes silently while the
    device is 'down'. Reads are not touched.

    Signed-off-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon

    Mike Snitzer
     
  • Add the ability to specify arbitrary feature flags when creating a
    flakey target. This code uses the same target argument helpers that
    the multipath target does.

    Also remove the superfluous 'dm-flakey' prefixes from the error messages,
    as they already contain the prefix 'flakey'.

    Signed-off-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon

    Mike Snitzer
     
  • Use dm_target_offset() and support discards.

    Signed-off-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon

    Mike Snitzer
     
  • Move multipath target argument parsing code into dm-table so other
    targets can share it.

    Signed-off-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon

    Mike Snitzer
     
  • If we write a full chunk in the snapshot, skip reading the origin device
    because the whole chunk will be overwritten anyway.

    This patch changes the snapshot write logic when a full chunk is written.
    In this case:
    1. allocate the exception
    2. dispatch the bio (but don't report the bio completion to device mapper)
    3. write the exception record
    4. report bio completed

    Callbacks must be done through the kcopyd thread, because callbacks must not
    race with each other. So we create two new functions:

    dm_kcopyd_prepare_callback: allocate a job structure and prepare the callback.
    (This function must not be called from interrupt context.)

    dm_kcopyd_do_callback: submit callback.
    (This function may be called from interrupt context.)

    Performance test (on snapshots with 4k chunk size):
    without the patch:
    non-direct-io sequential write (dd): 17.7MB/s
    direct-io sequential write (dd): 20.9MB/s
    non-direct-io random write (mkfs.ext2): 0.44s

    with the patch:
    non-direct-io sequential write (dd): 26.5MB/s
    direct-io sequential write (dd): 33.2MB/s
    non-direct-io random write (mkfs.ext2): 0.27s

    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka
     
  • Add a new flag DMF_MERGE_IS_OPTIONAL to struct mapped_device to indicate
    whether the device can accept bios larger than the size its merge
    function returns. When set, use this to send large bios to snapshots
    which can split them if necessary. Snapshot I/O may be significantly
    fragmented and this approach seems to improve peformance.

    Before the patch, dm_set_device_limits restricted bio size to page size
    if the underlying device had a merge function and the target didn't
    provide a merge function. After the patch, dm_set_device_limits
    restricts bio size to page size if the underlying device has a merge
    function, doesn't have DMF_MERGE_IS_OPTIONAL flag and the target doesn't
    provide a merge function.

    The snapshot target can't provide a merge function because when the merge
    function is called, it is impossible to determine where the bio will be
    remapped. Previously this led us to impose a 4k limit, which we can
    now remove if the snapshot store is located on a device without a merge
    function. Together with another patch for optimizing full chunk writes,
    it improves performance from 29MB/s to 40MB/s when writing to the
    filesystem on snapshot store.

    If the snapshot store is placed on a non-dm device with a merge function
    (such as md-raid), device mapper still limits all bios to page size.

    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka
     
  • There is no need for __table_get_device to be factored out.
    Also move the exports to the end of their respective functions.

    Signed-off-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon

    Mike Snitzer
     
  • A dm target only needs to use include/linux dm headers.

    Signed-off-by: Alasdair G Kergon

    Alasdair G Kergon
     
  • Detect invalid empty messages in core dm instead of requiring every target to
    check this.

    Signed-off-by: Alasdair G Kergon

    Alasdair G Kergon
     
  • Re-order the parameters so they are handled consistently in the same order
    where defined, parsed and output.

    Only include rebuild parameters in the STATUSTYPE_TABLE output if they were
    supplied in the original table line.

    Correct the parameter count when outputting rebuild: there are two words,
    not one.

    Use case-independent checks for keywords (as in other device-mapper targets).

    Signed-off-by: Jonathan Brassow
    Signed-off-by: Alasdair G Kergon

    Jonathan Brassow
     
  • Coding style cleanups.

    Signed-off-by: Alasdair G Kergon
    Signed-off-by: Jonathan Brassow

    Jonathan Brassow
     
  • Remove a couple of unused #defines.

    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka
     
  • The nr_pages field in struct kcopyd_job is only used temporarily in
    run_pages_job() to count the number of required pages.
    We can use a local variable instead.

    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka
     
  • The offset field in struct kcopyd_job is always zero so remove it.

    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka
     
  • Use vzalloc() instead of vmalloc()+memset().

    Signed-off-by: Joe Perches
    Signed-off-by: Alasdair G Kergon

    Joe Perches
     
  • Replace list_del() followed by list_add() with list_move().

    Signed-off-by: Kirill A. Shutemov
    Signed-off-by: Alasdair G Kergon

    Kirill A. Shutemov
     
  • Using __test_and_{set,clear}_bit_le() with ignoring its return value
    can be replaced with __{set,clear}_bit_le().

    This also removes unnecessary casts.

    Signed-off-by: Akinobu Mita
    Signed-off-by: Alasdair G Kergon

    Akinobu Mita
     
  • Remove 'discards_supported' from the dm_table structure. The same
    information can be easily discovered from the table's target(s) in
    dm_table_supports_discards().

    Before this fix dm_table_supports_discards() would skip checking the
    individual targets' 'discards_supported' flag if any one target in the
    table didn't set num_discard_requests > 0. Now the per-target
    'discards_supported' flag is effective at insuring the final DM device
    advertises discard support. But, to be clear, targets that don't
    support discards (!num_discard_requests) will not receive discard
    requests.

    Also DMWARN if a target sets 'discards_supported' override but forgets
    to set 'num_discard_requests'.

    Signed-off-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon

    Mike Snitzer
     
  • Suppress sparse warnings about cpu_to_le32() by using __le32 types for
    on-disk data etc.

    Signed-off-by: Alasdair G Kergon

    Alasdair G Kergon
     
  • Destroy _minor_idr when unloading the core dm module. (Found by kmemleak.)

    Cc: stable@kernel.org
    Signed-off-by: Alasdair G Kergon

    Alasdair G Kergon
     
  • For normal kernel pages, CPU cache is synchronized by the dma layer.
    However, this is not done for pages allocated with vmalloc. If we do I/O
    to/from vmallocated pages, we must synchronize CPU cache explicitly.

    Prior to doing I/O on vmallocated page we must call
    flush_kernel_vmap_range to flush dirty cache on the virtual address.
    After finished read we must call invalidate_kernel_vmap_range to
    invalidate cache on the virtual address, so that accesses to the virtual
    address return newly read data and not stale data from CPU cache.

    This patch fixes metadata corruption on dm-snapshots on PA-RISC and
    possibly other architectures with caches indexed by virtual address.

    Cc: stable
    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka
     
  • Avoid dereferencing a NULL pointer if the number of feature arguments
    supplied is fewer than indicated.

    Signed-off-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon
    Cc: stable@kernel.org

    Mike Snitzer
     
  • This patch makes dm-snapshot flush disk cache when writing metadata for
    merging snapshot.

    Without cache flushing the disk may reorder metadata write and other
    data writes and there is a possibility of data corruption in case of
    power fault.

    Cc: stable@kernel.org
    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka
     

28 Jul, 2011

9 commits

  • * 'for-linus' of git://neil.brown.name/md: (75 commits)
    md/raid10: handle further errors during fix_read_error better.
    md/raid10: Handle read errors during recovery better.
    md/raid10: simplify read error handling during recovery.
    md/raid10: record bad blocks due to write errors during resync/recovery.
    md/raid10: attempt to fix read errors during resync/check
    md/raid10: Handle write errors by updating badblock log.
    md/raid10: clear bad-block record when write succeeds.
    md/raid10: avoid writing to known bad blocks on known bad drives.
    md/raid10 record bad blocks as needed during recovery.
    md/raid10: avoid reading known bad blocks during resync/recovery.
    md/raid10 - avoid reading from known bad blocks - part 3
    md/raid10: avoid reading from known bad blocks - part 2
    md/raid10: avoid reading from known bad blocks - part 1
    md/raid10: Split handle_read_error out from raid10d.
    md/raid10: simplify/reindent some loops.
    md/raid5: Clear bad blocks on successful write.
    md/raid5. Don't write to known bad block on doubtful devices.
    md/raid5: write errors should be recorded as bad blocks if possible.
    md/raid5: use bad-block log to improve handling of uncorrectable read errors.
    md/raid5: avoid reading from known bad blocks.
    ...

    Linus Torvalds
     
  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
    sound: oss: rename local change_bits to avoid powerpc bitsops.h definition
    ALSA: hda - Fix duplicated DAC assignments for Realtek
    ALSA: asihpi - off by one in asihpi_hpi_ioctl()
    ALSA: hda - Fix Oops with Realtek quirks with NULL adc_nids
    ALSA: asihpi - bug fix pa use before init.
    ALSA: hda - Add support for vref-out based mute LED control on IDT codecs

    Linus Torvalds
     
  • …s/security-testing-2.6

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6: (54 commits)
    tpm_nsc: Fix bug when loading multiple TPM drivers
    tpm: Move tpm_tis_reenable_interrupts out of CONFIG_PNP block
    tpm: Fix compilation warning when CONFIG_PNP is not defined
    TOMOYO: Update kernel-doc.
    tpm: Fix a typo
    tpm_tis: Probing function for Intel iTPM bug
    tpm_tis: Fix the probing for interrupts
    tpm_tis: Delay ACPI S3 suspend while the TPM is busy
    tpm_tis: Re-enable interrupts upon (S3) resume
    tpm: Fix display of data in pubek sysfs entry
    tpm_tis: Add timeouts sysfs entry
    tpm: Adjust interface timeouts if they are too small
    tpm: Use interface timeouts returned from the TPM
    tpm_tis: Introduce durations sysfs entry
    tpm: Adjust the durations if they are too small
    tpm: Use durations returned from TPM
    TOMOYO: Enable conditional ACL.
    TOMOYO: Allow using argv[]/envp[] of execve() as conditions.
    TOMOYO: Allow using executable's realpath and symlink's target as conditions.
    TOMOYO: Allow using owner/group etc. of file objects as conditions.
    ...

    Fix up trivial conflict in security/tomoyo/realpath.c

    Linus Torvalds
     
  • If we find more read/write errors we should record a bad block before
    failing the device.

    Signed-off-by: NeilBrown

    NeilBrown
     
  • Currently when we get a read error during recovery, we simply abort
    the recovery.

    Instead, repeat the read in page-sized blocks.
    On successful reads, write to the target.
    On read errors, record a bad block on the destination,
    and only if that fails do we abort the recovery.

    As we now retry reads we need to know where we read from. This was in
    bi_sector but that can be changed during a read attempt.
    So store the correct from_addr and to_addr in the r10_bio for later
    access.

    Signed-off-by: NeilBrown

    NeilBrown
     
  • If a read error is detected during recovery the code currently
    fails the read device.
    This isn't really necessary. recovery_request_write will signal
    a write error to end_sync_write and it will record a write
    error on the destination device which will record a bad block
    there or kick it from the array.

    So just remove this call to do md_error.

    Signed-off-by: NeilBrown

    NeilBrown
     
  • If we get a write error during resync/recovery don't fail the device
    but instead record a bad block. If that fails we can then fail the
    device.

    Signed-off-by: NeilBrown

    NeilBrown
     
  • We already attempt to fix read errors found during normal IO
    and a 'repair' process.
    It is best to try to repair them at any time they are found,
    so move a test so that during sync and check a read error will
    be corrected by over-writing with good data.

    If both (all) devices have known bad blocks in the sync section we
    won't try to fix even though the bad blocks might not overlap. That
    should be considered later.

    Also if we hit a read error during recovery we don't try to fix it.
    It would only be possible to fix if there were at least three copies
    of data, which is not very common with RAID10. But it should still
    be considered later.

    Signed-off-by: NeilBrown

    NeilBrown
     
  • When we get a write error (in the data area, not in metadata),
    update the badblock log rather than failing the whole device.

    As the write may well be many blocks, we trying writing each
    block individually and only log the ones which fail.

    Signed-off-by: NeilBrown

    NeilBrown