1. 14 1月, 2016 3 次提交
    • D
      md/raid: only permit hot-add of compatible integrity profiles · 1501efad
      Dan Williams 提交于
      It is not safe for an integrity profile to be changed while i/o is
      in-flight in the queue.  Prevent adding new disks or otherwise online
      spares to an array if the device has an incompatible integrity profile.
      
      The original change to the blk_integrity_unregister implementation in
      md, commmit c7bfced9 "md: suspend i/o during runtime
      blk_integrity_unregister" introduced an immediate hang regression.
      
      This policy of disallowing changes the integrity profile once one has
      been established is shared with DM.
      
      Here is an abbreviated log from a test run that:
      1/ Creates a degraded raid1 with an integrity-enabled device (pmem0s) [   59.076127]
      2/ Tries to add an integrity-disabled device (pmem1m) [   90.489209]
      3/ Retries with an integrity-enabled device (pmem1s) [  205.671277]
      
      [   59.076127] md/raid1:md0: active with 1 out of 2 mirrors
      [   59.078302] md: data integrity enabled on md0
      [..]
      [   90.489209] md0: incompatible integrity profile for pmem1m
      [..]
      [  205.671277] md: super_written gets error=-5
      [  205.677386] md/raid1:md0: Disk failure on pmem1m, disabling device.
      [  205.677386] md/raid1:md0: Operation continuing on 1 devices.
      [  205.683037] RAID1 conf printout:
      [  205.684699]  --- wd:1 rd:2
      [  205.685972]  disk 0, wo:0, o:1, dev:pmem0s
      [  205.687562]  disk 1, wo:1, o:1, dev:pmem1s
      [  205.691717] md: recovery of RAID array md0
      
      Fixes: c7bfced9 ("md: suspend i/o during runtime blk_integrity_unregister")
      Cc: <stable@vger.kernel.org>
      Cc: Mike Snitzer <snitzer@redhat.com>
      Reported-by: NNeilBrown <neilb@suse.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NNeilBrown <neilb@suse.com>
      1501efad
    • S
      MD: add journal with array suspended · 87d4d916
      Shaohua Li 提交于
      Hot add journal disk in recovery thread context brings a lot of trouble
      as IO could be running. Unlike spare disk hot add, adding journal disk
      with array suspended makes more sense and implmentation is much easier.
      Signed-off-by: NShaohua Li <shli@fb.com>
      Signed-off-by: NNeilBrown <neilb@suse.com>
      87d4d916
    • S
      md: set MD_HAS_JOURNAL in correct places · a62ab49e
      Shaohua Li 提交于
      Set MD_HAS_JOURNAL when a array is loaded or journal is initialized.
      This is to avoid the flags set too early in journal disk hotadd.
      Signed-off-by: NShaohua Li <shli@fb.com>
      Signed-off-by: NNeilBrown <neilb@suse.com>
      a62ab49e
  2. 07 1月, 2016 2 次提交
  3. 06 1月, 2016 9 次提交
    • S
      raid5-cache: add journal hot add/remove support · f6b6ec5c
      Shaohua Li 提交于
      Add support for journal disk hot add/remove. Mostly trival checks in md
      part. The raid5 part is a little tricky. For hot-remove, we can't wait
      pending write as it's called from raid5d. The wait will cause deadlock.
      We simplily fail the hot-remove. A hot-remove retry can success
      eventually since if journal disk is faulty all pending write will be
      failed and finish. For hot-add, since an array supporting journal but
      without journal disk will be marked read-only, we are safe to hot add
      journal without stopping IO (should be read IO, while journal only
      handles write IO).
      Signed-off-by: NShaohua Li <shli@fb.com>
      Signed-off-by: NNeilBrown <neilb@suse.com>
      f6b6ec5c
    • D
      drivers: md: use ktime_get_real_seconds() · 9ebc6ef1
      Deepa Dinamani 提交于
      get_seconds() API is not y2038 safe on 32 bit systems and the API
      is deprecated. Replace it with calls to ktime_get_real_seconds()
      API instead. Change mddev structure types to time64_t accordingly.
      
      32 bit signed timestamps will overflow in the year 2038.
      
      Change the user interface mdu_array_info_s structure timestamps:
      ctime and utime values used in ioctls GET_ARRAY_INFO and
      SET_ARRAY_INFO to unsigned int. This will extend the field to last
      until the year 2106.
      The long term plan is to get rid of ctime and utime values in
      this structure as this information can be read from the on-disk
      meta data directly.
      
      Clamp the tim64_t timestamps to positive values with a max of U32_MAX
      when returning from GET_ARRAY_INFO ioctl to accommodate above changes
      in the data type of timestamps to unsigned int.
      
      v0.90 on disk meta data uses u32 for maintaining time stamps.
      So this will also last until year 2106.
      Assumption is that the usage of v0.90 will be deprecated by
      year 2106.
      
      Timestamp fields in the on disk meta data for v1.0 version already
      use 64 bit data types. Remove the truncation of the bits while
      writing to or reading from these from the disk.
      Signed-off-by: NDeepa Dinamani <deepa.kernel@gmail.com>
      Reviewed-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NNeilBrown <neilb@suse.com>
      9ebc6ef1
    • A
      md: avoid warning for 32-bit sector_t · 3312c951
      Arnd Bergmann 提交于
      When CONFIG_LBDAF is not set, sector_t is only 32-bits wide, which
      means we cannot have devices with more than 2TB, and the code that
      is trying to handle compatibility support for large devices in
      md version 0.90 is meaningless but also causes a compile-time warning:
      
      drivers/md/md.c: In function 'super_90_load':
      drivers/md/md.c:1029:19: warning: large integer implicitly truncated to unsigned type [-Woverflow]
      drivers/md/md.c: In function 'super_90_rdev_size_change':
      drivers/md/md.c:1323:17: warning: large integer implicitly truncated to unsigned type [-Woverflow]
      
      This adds a check for CONFIG_LBDAF to avoid even getting into this
      code path, and also adds an explicit cast to let the compiler know
      it doesn't have to warn about the truncation.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NNeilBrown <neilb@suse.com>
      3312c951
    • G
      md: update comment for md_allow_write · abf3508d
      Guoqing Jiang 提交于
      MD_CHANGE_CLEAN had been replaced with MD_CHANGE_PENDING after
      commit 070dc6 ("md: resolve confusion of MD_CHANGE_CLEAN"),
      so make the change accordingly.
      Signed-off-by: NGuoqing Jiang <gqjiang@suse.com>
      Signed-off-by: NNeilBrown <neilb@suse.com>
      abf3508d
    • G
      md-cluster: Defer MD reloading to mddev->thread · 15858fa5
      Guoqing Jiang 提交于
      Reloading of superblock must be performed under reconfig_mutex. However,
      this cannot be done with md_reload_sb because it would deadlock with
      the message DLM lock. So, we defer it in md_check_recovery() which is
      executed by mddev->thread.
      
      This introduces a new flag, MD_RELOAD_SB, which if set, will reload the
      superblock. And good_device_nr is also added to 'struct mddev' which is
      used to get the num of the good device within cluster raid.
      Signed-off-by: NGoldwyn Rodrigues <rgoldwyn@suse.com>
      Signed-off-by: NGuoqing Jiang <gqjiang@suse.com>
      Signed-off-by: NNeilBrown <neilb@suse.com>
      15858fa5
    • G
      md-cluster: append some actions when change bitmap from clustered to none · f6a2dc64
      Guoqing Jiang 提交于
      For clustered raid, we need to do extra actions when change
      bitmap to none.
      
      1. check if all the bitmap lock could be get or not, if yes then
         we can continue the change since cluster raid is only active
         in current node. Otherwise return fail and unlock the related
         bitmap locks
      2. set nodes to 0 and then leave cluster environment.
      3. release other nodes's bitmap lock.
      Signed-off-by: NGuoqing Jiang <gqjiang@suse.com>
      Signed-off-by: NNeilBrown <neilb@suse.com>
      f6a2dc64
    • G
      md-cluster: Allow spare devices to be marked as faulty · 09afd2a8
      Goldwyn Rodrigues 提交于
      If a spare device was marked faulty, it would not be reflected
      in receiving nodes because it would mark it as activated and continue.
      Continue the operation, so it may be set as faulty.
      Signed-off-by: NGoldwyn Rodrigues <rgoldwyn@suse.com>
      Signed-off-by: NNeilBrown <neilb@suse.com>
      09afd2a8
    • G
      md-cluster: Fix the remove sequence with the new MD reload code · 54a88392
      Goldwyn Rodrigues 提交于
      The remove disk message does not need metadata_update_start(), but
      can be an independent message.
      Signed-off-by: NGoldwyn Rodrigues <rgoldwyn@suse.com>
      Signed-off-by: NGuoqing Jiang <gqjiang@suse.com>
      Signed-off-by: NNeilBrown <neilb@suse.com>
      54a88392
    • G
      md-cluster: remove a disk asynchronously from cluster environment · 659b254f
      Guoqing Jiang 提交于
      For cluster raid, if one disk couldn't be reach in one node, then
      other nodes would receive the REMOVE message for the disk.
      
      In receiving node, we can't call md_kick_rdev_from_array to remove
      the disk from array synchronously since the disk might still be busy
      in this node. So let's set a ClusterRemove flag on the disk, then
      let the thread to do the removal job eventually.
      Signed-off-by: NGuoqing Jiang <gqjiang@suse.com>
      Signed-off-by: NGoldwyn Rodrigues <rgoldwyn@suse.com>
      Signed-off-by: NNeilBrown <neilb@suse.com>
      659b254f
  4. 21 12月, 2015 1 次提交
    • N
      md: remove check for MD_RECOVERY_NEEDED in action_store. · 312045ee
      NeilBrown 提交于
      md currently doesn't allow a 'sync_action' such as 'reshape' to be set
      while MD_RECOVERY_NEEDED is set.
      
      This s a problem, particularly since commit 738a2738 as that can
      cause ->check_shape to call mddev_resume() which sets
      MD_RECOVERY_NEEDED.  So by the time we come to start 'reshape' it is
      very likely that MD_RECOVERY_NEEDED is still set.
      
      Testing for this flag is not really needed and is in any case very
      racy as it can be set at any moment - asynchronously.  Any race
      between setting a sync_action and setting MD_RECOVERY_NEEDED must
      already be handled properly in some locked code, probably
      md_check_recovery(), so remove the test here.
      
      The test on MD_RECOVERY_RUNNING is also racy in the 'reshape' case
      so we should test it again after getting mddev_lock().
      
      As this fixes a race and a regression which can cause 'reshape' to
      fail, it is suitable for -stable kernels since 4.1
      Reported-by: NXiao Ni <xni@redhat.com>
      Fixes: 738a2738 ("md/raid5: fix allocation of 'scribble' array.")
      Cc: stable@vger.kernel.org (v4.1+)
      Signed-off-by: NNeilBrown <neilb@suse.com>
      312045ee
  5. 18 12月, 2015 3 次提交
    • G
      Fix remove_and_add_spares removes drive added as spare in slot_store · cb01c549
      Goldwyn Rodrigues 提交于
      Commit 2910ff17
      introduced a regression which would remove a recently added spare via
      slot_store. Revert part of the patch which touches slot_store() and add
      the disk directly using pers->hot_add_disk()
      
      Fixes: 2910ff17 ("md: remove_and_add_spares() to activate specific
      rdev")
      Signed-off-by: NGoldwyn Rodrigues <rgoldwyn@suse.com>
      Signed-off-by: NPawel Baldysiak <pawel.baldysiak@intel.com>
      Signed-off-by: NNeilBrown <neilb@suse.com>
      cb01c549
    • M
      md: fix bug due to nested suspend · 0dc10e50
      Mikulas Patocka 提交于
      The patch c7bfced9 committed to 4.4-rc
      causes crash in LVM test shell/lvchange-raid.sh. The kernel crashes with
      this BUG, the reason is that we attempt to suspend a device that is
      already suspended. See also
      https://bugzilla.redhat.com/show_bug.cgi?id=1283491
      
      This patch fixes the bug by changing functions mddev_suspend and
      mddev_resume to always nest.
      The number of nested calls to mddev_nested_suspend is kept in the
      variable mddev->suspended.
      [neilb: made mddev_suspend() always nest instead of introduce mddev_nested_suspend]
      
      kernel BUG at drivers/md/md.c:317!
      CPU: 3 PID: 32754 Comm: lvm Not tainted 4.4.0-rc2 #1
      task: 0000000047076040 ti: 0000000047014000 task.ti: 0000000047014000
      
           YZrvWESTHLNXBCVMcbcbcbcbOGFRQPDI
      PSW: 00001000000001000000000000001111 Not tainted
      r00-03  000000000804000f 00000000102c5280 0000000010c7522c 000000007e3d1810
      r04-07  0000000010c6f000 000000004ef37f20 000000007e3d1dd0 000000007e3d1810
      r08-11  000000007c9f1600 0000000000000000 0000000000000001 ffffffffffffffff
      r12-15  0000000010c1d000 0000000000000041 00000000f98d63c8 00000000f98e49e4
      r16-19  00000000f98e49e4 00000000c138fd06 00000000f98d63c8 0000000000000001
      r20-23  0000000000000002 000000004ef37f00 00000000000000b0 00000000000001d1
      r24-27  00000000424783a0 000000007e3d1dd0 000000007e3d1810 00000000102b2000
      r28-31  0000000000000001 0000000047014840 0000000047014930 0000000000000001
      sr00-03  0000000007040800 0000000000000000 0000000000000000 0000000007040800
      sr04-07  0000000000000000 0000000000000000 0000000000000000 0000000000000000
      
      IASQ: 0000000000000000 0000000000000000 IAOQ: 00000000102c538c 00000000102c5390
       IIR: 03ffe01f    ISR: 0000000000000000  IOR: 00000000102b2748
       CPU:        3   CR30: 0000000047014000 CR31: 0000000000000000
       ORIG_R28: 00000000000000b0
       IAOQ[0]: mddev_suspend+0x10c/0x160 [md_mod]
       IAOQ[1]: mddev_suspend+0x110/0x160 [md_mod]
       RP(r2): raid1_add_disk+0xd4/0x2c0 [raid1]
      Backtrace:
       [<0000000010c7522c>] raid1_add_disk+0xd4/0x2c0 [raid1]
       [<0000000010c20078>] raid_resume+0x390/0x418 [dm_raid]
       [<00000000105833e8>] dm_table_resume_targets+0xc0/0x188 [dm_mod]
       [<000000001057f784>] dm_resume+0x144/0x1e0 [dm_mod]
       [<0000000010587dd4>] dev_suspend+0x1e4/0x568 [dm_mod]
       [<0000000010589278>] ctl_ioctl+0x1e8/0x428 [dm_mod]
       [<0000000010589518>] dm_compat_ctl_ioctl+0x18/0x68 [dm_mod]
       [<0000000040377b88>] compat_SyS_ioctl+0xd0/0x1558
      
      Fixes: c7bfced9 ("md: suspend i/o during runtime blk_integrity_unregister")
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NNeilBrown <neilb@suse.com>
      0dc10e50
    • S
      MD: change journal disk role to disk 0 · 9b15603d
      Shaohua Li 提交于
      Neil pointed out setting journal disk role to raid_disks will confuse
      reshape if we support reshape eventually. Switching the role to 0 (we
      should be fine as long as the value >=0) and skip sysfs file creation to
      avoid error.
      Signed-off-by: NShaohua Li <shli@fb.com>
      Signed-off-by: NNeilBrown <neilb@suse.com>
      9b15603d
  6. 08 11月, 2015 1 次提交
  7. 01 11月, 2015 8 次提交
  8. 31 10月, 2015 1 次提交
    • N
      Revert "md: allow a partially recovered device to be hot-added to an array." · d01552a7
      NeilBrown 提交于
      This reverts commit 7eb41885.
      
      This commit is poorly justified, I can find not discusison in email,
      and it clearly causes a problem.
      
      If a device which is being recovered fails and is subsequently
      re-added to an array, there could easily have been changes to the
      array *before* the point where the recovery was up to.  So the
      recovery must start again from the beginning.
      
      If a spare is being recovered and fails, then when it is re-added we
      really should do a bitmap-based recovery up to the recovery-offset,
      and then a full recovery from there.  Before this reversion, we only
      did the "full recovery from there" which is not corect.  After this
      reversion with will do a full recovery from the start, which is safer
      but not ideal.
      
      It will be left to a future patch to arrange the two different styles
      of recovery.
      Reported-and-tested-by: NNate Dailey <nate.dailey@stratus.com>
      Signed-off-by: NNeilBrown <neilb@suse.com>
      Cc: stable@vger.kernel.org (3.14+)
      Fixes: 7eb41885 ("md: allow a partially recovered device to be hot-added to an array.")
      d01552a7
  9. 24 10月, 2015 4 次提交
  10. 22 10月, 2015 3 次提交
  11. 13 10月, 2015 2 次提交
  12. 12 10月, 2015 3 次提交
    • G
      md-cluster: Fix adding of new disk with new reload code · dbb64f86
      Goldwyn Rodrigues 提交于
      Adding the disk worked incorrectly with the new reload code. Fix it:
      
       - No operation should be performed on rdev marked as Candidate
       - After a metadata update operation, kick disk if role is 0xfffe
         else clear Candidate bit and continue with the regular change check.
       - Saving the mode of the lock resource to check if token lock is already
         locked, because it can be called twice while adding a disk. However,
         unlock_comm() must be called only once.
       - add_new_disk() is called by the node initiating the --add operation.
         If it needs to be canceled, call add_new_disk_cancel(). The operation
         is completed by md_update_sb() which will write and unlock the
         communication.
      Signed-off-by: NGoldwyn Rodrigues <rgoldwyn@suse.com>
      dbb64f86
    • G
      md-cluster: Perform resync/recovery under a DLM lock · c186b128
      Goldwyn Rodrigues 提交于
      Resync or recovery must be performed by only one node at a time.
      A DLM lock resource, resync_lockres provides the mutual exclusion
      so that only one node performs the recovery/resync at a time.
      
      If a node is unable to get the resync_lockres, because recovery is
      being performed by another node, it set MD_RECOVER_NEEDED so as
      to schedule recovery in the future.
      
      Remove the debug message in resync_info_update()
      used during development.
      Signed-off-by: NGoldwyn Rodrigues <rgoldwyn@suse.com>
      c186b128
    • G
      md-cluster: Perform a lazy update · 2aa82191
      Goldwyn Rodrigues 提交于
      In a clustered environment, a change such as marking a device faulty,
      can be recorded by any of the nodes. This is communicated to all the
      nodes and re-recording such a change is unnecessary, and quite often
      pretty disruptive.
      
      With this patch, just before the update, we detect for the changes
      and if the changes are already in superblock, we abort the update
      after clearing all the flags
      Signed-off-by: NGoldwyn Rodrigues <rgoldwyn@suse.com>
      2aa82191