1. 26 7月, 2011 1 次提交
  2. 18 7月, 2011 5 次提交
  3. 28 6月, 2011 1 次提交
    • N
      md: avoid endless recovery loop when waiting for fail device to complete. · 4274215d
      NeilBrown 提交于
      If a device fails in a way that causes pending request to take a while
      to complete, md will not be able to immediately remove it from the
      array in remove_and_add_spares.
      It will then incorrectly look like a spare device and md will try to
      recover it even though it is failed.
      This leads to a recovery process starting and instantly aborting over
      and over again.
      
      We should check if the device is faulty before considering it to be a
      spare.  This will avoid trying to start a recovery that cannot
      proceed.
      
      This bug was introduced in 2.6.26 so that patch is suitable for any
      kernel since then.
      
      Cc: stable@kernel.org
      Reported-by: NJim Paradis <james.paradis@stratus.com>
      Signed-off-by: NNeilBrown <neilb@suse.de>
      4274215d
  4. 14 6月, 2011 3 次提交
  5. 09 6月, 2011 7 次提交
    • N
      md/bitmap: remove unused fields from struct bitmap · 97b3d4aa
      Namhyung Kim 提交于
      Get rid of ->syncchunk and ->counter_bits since they're never used.
      
      Also discard COUNTER_BYTE_RATIO which is unused.
      Signed-off-by: NNamhyung Kim <namhyung@gmail.com>
      Signed-off-by: NNeilBrown <neilb@suse.de>
      97b3d4aa
    • N
      md/bitmap: use proper accessor macro · 27d5ea04
      Namhyung Kim 提交于
      Use COUNTER()/NEEDED() macro instead of open-coding them.
      Signed-off-by: NNamhyung Kim <namhyung@gmail.com>
      Signed-off-by: NNeilBrown <neilb@suse.de>
      27d5ea04
    • N
      md: check ->hot_remove_disk when removing disk · 01393f3d
      Namhyung Kim 提交于
      Check pers->hot_remove_disk instead of pers->hot_add_disk in slot_store()
      during disk removal. The linear personality only has ->hot_add_disk and
      no ->hot_remove_disk, so that removing disk in the array resulted to
      following kernel bug:
      
      $ sudo mdadm --create /dev/md0 --level=linear --raid-devices=4 /dev/loop[0-3]
      $ echo none | sudo tee /sys/block/md0/md/dev-loop2/slot
       BUG: unable to handle kernel NULL pointer dereference at           (null)
       IP: [<          (null)>]           (null)
       PGD c9f5d067 PUD 8575a067 PMD 0
       Oops: 0010 [#1] SMP
       CPU 2
       Modules linked in: linear loop bridge stp llc kvm_intel kvm asus_atk0110 sr_mod cdrom sg
      
       Pid: 10450, comm: tee Not tainted 3.0.0-rc1-leonard+ #173 System manufacturer System Product Name/P5G41TD-M PRO
       RIP: 0010:[<0000000000000000>]  [<          (null)>]           (null)
       RSP: 0018:ffff880085757df0  EFLAGS: 00010282
       RAX: ffffffffa00168e0 RBX: ffff8800d1431800 RCX: 000000000000006e
       RDX: 0000000000000001 RSI: 0000000000000002 RDI: ffff88008543c000
       RBP: ffff880085757e48 R08: 0000000000000002 R09: 000000000000000a
       R10: 0000000000000000 R11: ffff88008543c2e0 R12: 00000000ffffffff
       R13: ffff8800b4641000 R14: 0000000000000005 R15: 0000000000000000
       FS:  00007fe8c9e05700(0000) GS:ffff88011fa00000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
       CR2: 0000000000000000 CR3: 00000000b4502000 CR4: 00000000000406e0
       DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
       DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
       Process tee (pid: 10450, threadinfo ffff880085756000, task ffff8800c9f08000)
       Stack:
        ffffffff8138496a ffff8800b4641000 ffff88008543c268 0000000000000000
        ffff8800b4641000 ffff88008543c000 ffff8800d1431868 ffffffff81a78a90
        ffff8800b4641000 ffff88008543c000 ffff8800d1431800 ffff880085757e98
       Call Trace:
        [<ffffffff8138496a>] ? slot_store+0xaa/0x265
        [<ffffffff81384bae>] rdev_attr_store+0x89/0xa8
        [<ffffffff8115a96a>] sysfs_write_file+0x108/0x144
        [<ffffffff81106b87>] vfs_write+0xb1/0x10d
        [<ffffffff8106e6c0>] ? trace_hardirqs_on_caller+0x111/0x135
        [<ffffffff81106cac>] sys_write+0x4d/0x77
        [<ffffffff814fe702>] system_call_fastpath+0x16/0x1b
       Code:  Bad RIP value.
       RIP  [<          (null)>]           (null)
        RSP <ffff880085757df0>
       CR2: 0000000000000000
       ---[ end trace ba5fc64319a826fb ]---
      Signed-off-by: NNamhyung Kim <namhyung@gmail.com>
      Cc: stable@kernel.org
      Signed-off-by: NNeilBrown <neilb@suse.de>
      01393f3d
    • J
      MD: use is_power_of_2 macro · d744540c
      Jonathan Brassow 提交于
      Make use of is_power_of_2 macro.
      Signed-off-by: NJonathan Brassow <jbrassow@redhat.com>
      Signed-off-by: NNeilBrown <neilb@suse.de>
      d744540c
    • J
      MD: raid5 do not set fullsync · d6b212f4
      Jonathan Brassow 提交于
      Add check to determine if a device needs full resync or if partial resync will do
      
      RAID 5 was assuming that if a device was not In_sync, it must undergo a full
      resync.  We add a check to see if 'saved_raid_disk' is the same as 'raid_disk'.
      If it is, we can safely skip the full resync and rely on the bitmap for
      partial recovery instead.  This is the legitimate purpose of 'saved_raid_disk',
      from md.h:
      int saved_raid_disk;            /* role that device used to have in the
                                       * array and could again if we did a partial
                                       * resync from the bitmap
                                       */
      Signed-off-by: NJonathan Brassow <jbrassow@redhat.com>
      Signed-off-by: NNeilBrown <neilb@suse.de>
      d6b212f4
    • J
      MD: support initial bitmap creation in-kernel · 9c81075f
      Jonathan Brassow 提交于
      Add bitmap support to the device-mapper specific metadata area.
      
      This patch allows the creation of the bitmap metadata area upon
      initial array creation via device-mapper.
      Signed-off-by: NJonathan Brassow <jbrassow@redhat.com>
      Signed-off-by: NNeilBrown <neilb@suse.de>
      9c81075f
  6. 08 6月, 2011 6 次提交
  7. 29 5月, 2011 11 次提交
  8. 11 5月, 2011 6 次提交
    • N
      md: allow resync_start to be set while an array is active. · b098636c
      NeilBrown 提交于
      The sysfs attribute 'resync_start' (known internally as recovery_cp),
      records where a resync is up to.  A value of 0 means the array is
      not known to be in-sync at all.  A value of MaxSector means the array
      is believed to be fully in-sync.
      
      When the size of member devices of an array (RAID1,RAID4/5/6) is
      increased, the array can be increased to match.  This process sets
      resync_start to the old end-of-device offset so that the new part of
      the array gets resynced.
      
      However with RAID1 (and RAID6) a resync is not technically necessary
      and may be undesirable.  So it would be good if the implied resync
      after the array is resized could be avoided.
      
      So: change 'resync_start' so the value can be changed while the array
      is active, and as a precaution only allow it to be changed while
      resync/recovery is 'frozen'.  Changing it once resync has started is
      not going to be useful anyway.
      
      This allows the array to be resized without a resync by:
        write 'frozen' to 'sync_action'
        write new size to 'component_size' (this will set resync_start)
        write 'none' to 'resync_start'
        write 'idle' to 'sync_action'.
      
      Also slightly improve some tests on recovery_cp when resizing
      raid1/raid5.  Now that an arbitrary value could be set we should be
      more careful in our tests.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      b098636c
    • N
      md/raid10: reformat some loops with less indenting. · ab9d47e9
      NeilBrown 提交于
      When a loop ends with an 'if' with a large body, it is neater
      to make the if 'continue' on the inverse condition, and then
      the body is indented less.
      
      Apply this pattern 3 times, and wrap some other long lines.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      ab9d47e9
    • N
      md/raid10: remove unused variable. · f17ed07c
      NeilBrown 提交于
      This variable 'disk' is never used - how odd.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      f17ed07c
    • N
      md/raid10: make more use of 'slot' in raid10d. · a8830bca
      NeilBrown 提交于
      Now that we have a 'slot' variable, make better use of it to simplify
      some code a little.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      a8830bca
    • N
      md/raid10: some tidying up in fix_read_error · 7c4e06ff
      NeilBrown 提交于
      Currently the rdev on which a read error happened could be removed
      before we perform the fix_error handling.  This requires extra tests
      for NULL.
      
      So delay the rdev_dec_pending call until after the call to
      fix_read_error so that we can be sure that the rdev still exists.
      
      This allows an 'if' clause to be removed so the body gets re-indented
      back one level.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      7c4e06ff
    • N
      md/raid1: improve handling of pages allocated for write-behind. · af6d7b76
      NeilBrown 提交于
      The current handling and freeing of these pages is a bit fragile.
      We only keep the list of allocated pages in each bio, so we need to
      still have a valid bio when freeing the pages, which is a bit clumsy.
      
      So simply store the allocated page list in the r1_bio so it can easily
      be found and freed when we are finished with the r1_bio.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      af6d7b76