1. 19 3月, 2014 16 次提交
  2. 18 3月, 2014 2 次提交
  3. 26 2月, 2014 2 次提交
  4. 19 2月, 2014 1 次提交
  5. 13 2月, 2014 1 次提交
    • O
      md/raid5: Fix CPU hotplug callback registration · 789b5e03
      Oleg Nesterov 提交于
      Subsystems that want to register CPU hotplug callbacks, as well as perform
      initialization for the CPUs that are already online, often do it as shown
      below:
      
      	get_online_cpus();
      
      	for_each_online_cpu(cpu)
      		init_cpu(cpu);
      
      	register_cpu_notifier(&foobar_cpu_notifier);
      
      	put_online_cpus();
      
      This is wrong, since it is prone to ABBA deadlocks involving the
      cpu_add_remove_lock and the cpu_hotplug.lock (when running concurrently
      with CPU hotplug operations).
      
      Interestingly, the raid5 code can actually prevent double initialization and
      hence can use the following simplified form of callback registration:
      
      	register_cpu_notifier(&foobar_cpu_notifier);
      
      	get_online_cpus();
      
      	for_each_online_cpu(cpu)
      		init_cpu(cpu);
      
      	put_online_cpus();
      
      A hotplug operation that occurs between registering the notifier and calling
      get_online_cpus(), won't disrupt anything, because the code takes care to
      perform the memory allocations only once.
      
      So reorganize the code in raid5 this way to fix the deadlock with callback
      registration.
      
      Cc: linux-raid@vger.kernel.org
      Cc: stable@vger.kernel.org (v2.6.32+)
      Fixes: 36d1c647Signed-off-by: NOleg Nesterov <oleg@redhat.com>
      [Srivatsa: Fixed the unregister_cpu_notifier() deadlock, added the
      free_scratch_buffer() helper to condense code further and wrote the changelog.]
      Signed-off-by: NSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      Signed-off-by: NNeilBrown <neilb@suse.de>
      789b5e03
  6. 11 2月, 2014 1 次提交
  7. 05 2月, 2014 1 次提交
    • N
      md/raid1: restore ability for check and repair to fix read errors. · 1877db75
      NeilBrown 提交于
      commit 30bc9b53
          md/raid1: fix bio handling problems in process_checks()
      
      Move the bio_reset() to a point before where BIO_UPTODATE is checked,
      so that check now always report that the bio is uptodate, even if it is not.
      
      This causes process_check() to sometimes treat read-errors as
      successful matches so the good data isn't written out.
      
      This patch preserves the flag until it is needed.
      
      Bug was introduced in 3.11, but backported to 3.10-stable (as it fixed
      an even worse bug).  So suitable for any -stable since 3.10.
      Reported-and-tested-by: NMichael Tokarev <mjt@tls.msk.ru>
      Cc: stable@vger.kernel.org (3.10+)
      Fixed: 30bc9b53Signed-off-by: NNeilBrown <neilb@suse.de>
      1877db75
  8. 30 1月, 2014 3 次提交
  9. 22 1月, 2014 3 次提交
    • D
      dm log userspace: allow mark requests to piggyback on flush requests · 5066a4df
      Dongmao Zhang 提交于
      In the cluster evironment, cluster write has poor performance because
      userspace_flush() has to contact a userspace program (cmirrord) for
      clear/mark/flush requests.  But both mark and flush requests require
      cmirrord to communicate the message to all the cluster nodes for each
      flush call.  This behaviour is really slow.
      
      To address this we now merge mark and flush requests together to reduce
      the kernel-userspace-kernel time.  We allow a new directive,
      "integrated_flush" that can be used to instruct the kernel log code to
      combine flush and mark requests when directed by userspace.  If not
      directed by userspace (due to an older version of the userspace code
      perhaps), the kernel will function as it did previously - preserving
      backwards compatibility.  Additionally, flush requests are performed
      lazily when only clear requests exist.
      Signed-off-by: NDongmao Zhang <dmzhang@suse.com>
      Signed-off-by: NJonathan Brassow <jbrassow@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      5066a4df
    • N
      md/raid5: close recently introduced race in stripe_head management. · 7da9d450
      NeilBrown 提交于
      As release_stripe and __release_stripe decrement ->count and then
      manipulate ->lru both under ->device_lock, it is important that
      get_active_stripe() increments ->count and clears ->lru also under
      ->device_lock.
      
      However we currently list_del_init ->lru under the lock, but increment
      the ->count outside the lock.  This can lead to races and list
      corruption.
      
      So move the atomic_inc(&sh->count) up inside the ->device_lock
      protected region.
      
      Note that we still increment ->count without device lock in the case
      where get_free_stripe() was called, and in fact don't take
      ->device_lock at all in that path.
      This is safe because if the stripe_head can be found by
      get_free_stripe, then the hash lock assures us the no-one else could
      possibly be calling release_stripe() at the same time.
      
      Fixes: 566c09c5
      Cc: stable@vger.kernel.org (3.13)
      Reported-and-tested-by: NIan Kumlien <ian.kumlien@gmail.com>
      Signed-off-by: NNeilBrown <neilb@suse.de>
      7da9d450
    • J
      dm space map metadata: fix bug in resizing of thin metadata · fca02843
      Joe Thornber 提交于
      This bug was introduced in commit 7e664b3d ("dm space map metadata:
      fix extending the space map").
      
      When extending a dm-thin metadata volume we:
      
      - Switch the space map into a simple bootstrap mode, which allocates
        all space linearly from the newly added space.
      - Add new bitmap entries for the new space
      - Increment the reference counts for those newly allocated bitmap
        entries
      - Commit changes to disk
      - Switch back out of bootstrap mode.
      
      But, the disk commit may allocate space itself, if so this fact will be
      lost when switching out of bootstrap mode.
      
      The bug exhibited itself as an error when the bitmap_root, with an
      erroneous ref count of 0, was subsequently decremented as part of a
      later disk commit.  This would cause the disk commit to fail, and thinp
      to enter read_only mode.  The metadata was not damaged (thin_check
      passed).
      
      The fix is to put the increments + commit into a loop, running until
      the commit has not allocated extra space.  In practise this loop only
      runs twice.
      
      With this fix the following device mapper testsuite test passes:
       dmtest run --suite thin-provisioning -n thin_remove_works_after_resize
      Signed-off-by: NJoe Thornber <ejt@redhat.com>
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      Cc: stable@vger.kernel.org # depends on commit 7e664b3d
      fca02843
  10. 17 1月, 2014 1 次提交
    • M
      dm cache: add policy name to status output · 2e68c4e6
      Mike Snitzer 提交于
      The cache's policy may have been established using the "default" alias,
      which is currently the "mq" policy but the default policy may change in
      the future.  It is useful to know exactly which policy is being used.
      
      Add a 'real' member to the dm_cache_policy_type structure and have the
      "default" dm_cache_policy_type point to the real "mq"
      dm_cache_policy_type.  Update dm_cache_policy_get_name() to check if
      real is set, if so report the name of the real policy (not the alias).
      Requested-by: NJonathan Brassow <jbrassow@redhat.com>
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      2e68c4e6
  11. 16 1月, 2014 3 次提交
    • M
      dm thin: fix pool feature parsing · 74aa45c3
      Mike Snitzer 提交于
      Commit 787a996c ("dm thin: add error_if_no_space feature")
      mistakenly forgot to increase the number of feature args supported.
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      74aa45c3
    • N
      md/raid5: fix long-standing problem with bitmap handling on write failure. · 9f97e4b1
      NeilBrown 提交于
      Before a write starts we set a bit in the write-intent bitmap.
      When the write completes we clear that bit if the write was successful
      to all devices.  However if the write wasn't fully successful we
      should not clear the bit.  If the faulty drive is subsequently
      re-added, the fact that the bit is still set ensure that we will
      re-write the data that is missing.
      
      This logic is mediated by the STRIPE_DEGRADED flag - we only clear the
      bitmap bit when this flag is not set.
      Currently we correctly set the flag if a write starts when some
      devices are failed or missing.  But we do *not* set the flag if some
      device failed during the write attempt.
      This is wrong and can result in clearing the bit inappropriately.
      
      So: set the flag when a write fails.
      
      This bug has been present since bitmaps were introduces, so the fix is
      suitable for any -stable kernel.
      Reported-by: NEthan Wilson <ethan.wilson@shiftmail.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: NNeilBrown <neilb@suse.de>
      9f97e4b1
    • N
      md: check command validity early in md_ioctl(). · cb335f88
      Nicolas Schichan 提交于
      Verify that the cmd parameter passed to md_ioctl() is valid before
      doing anything.
      
      This fixes mddev->hold_active being set to 0 when an invalid ioctl
      command is passed to md_ioctl() before the array has been configured.
      
      Clearing mddev->hold_active in that case can lead to a livelock
      situation when an invalid ioctl number is given to md_ioctl() by a
      process when the mddev is currently being opened by another process:
      
      Process 1				Process 2
      ---------				---------
      
      md_alloc()
        mddev_find()
        -> returns a new mddev with
           hold_active == UNTIL_IOCTL
        add_disk()
        -> sends KOBJ_ADD uevent
      
      					(sees KOBJ_ADD uevent for device)
                          			md_open()
                          			md_ioctl(INVALID_IOCTL)
                          			-> returns ENODEV and clears
                             			   mddev->hold_active
                          			md_release()
                            			md_put()
                            			-> deletes the mddev as
                               		   hold_active is 0
      
      md_open()
        mddev_find()
        -> returns a newly
          allocated mddev with
          mddev->gendisk == NULL
      -> returns with ERESTARTSYS
         (kernel restarts the open syscall)
      Signed-off-by: NNicolas Schichan <nschichan@freebox.fr>
      Signed-off-by: NNeilBrown <neilb@suse.de>
      cb335f88
  12. 15 1月, 2014 5 次提交
    • M
      dm sysfs: fix a module unload race · 2995fa78
      Mikulas Patocka 提交于
      This reverts commit be35f486 ("dm: wait until embedded kobject is
      released before destroying a device") and provides an improved fix.
      
      The kobject release code that calls the completion must be placed in a
      non-module file, otherwise there is a module unload race (if the process
      calling dm_kobject_release is preempted and the DM module unloaded after
      the completion is triggered, but before dm_kobject_release returns).
      
      To fix this race, this patch moves the completion code to dm-builtin.c
      which is always compiled directly into the kernel if BLK_DEV_DM is
      selected.
      
      The patch introduces a new dm_kobject_holder structure, its purpose is
      to keep the completion and kobject in one place, so that it can be
      accessed from non-module code without the need to export the layout of
      struct mapped_device to that code.
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      Cc: stable@vger.kernel.org
      2995fa78
    • M
      dm snapshot: use dm-bufio prefetch · 55b082e6
      Mikulas Patocka 提交于
      This patch modifies dm-snapshot so that it prefetches the buffers when
      loading the exceptions.
      
      The number of buffers read ahead is specified in the DM_PREFETCH_CHUNKS
      macro.  The current value for DM_PREFETCH_CHUNKS (12) was found to
      provide the best performance on a single 15k SCSI spindle.  In the
      future we may modify this default or make it configurable.
      
      Also, introduce the function dm_bufio_set_minimum_buffers to setup
      bufio's number of internal buffers before freeing happens.  dm-bufio may
      hold more buffers if enough memory is available.  There is no guarantee
      that the specified number of buffers will be available - if you need a
      guarantee, use the argument reserved_buffers for
      dm_bufio_client_create.
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      55b082e6
    • M
      dm snapshot: use dm-bufio · 55494bf2
      Mikulas Patocka 提交于
      Use dm-bufio for initial loading of the exceptions.
      Introduce a new function dm_bufio_forget that frees the given buffer.
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      55494bf2
    • M
      dm snapshot: prepare for switch to using dm-bufio · 2cadabd5
      Mikulas Patocka 提交于
      Change the functions get_exception, read_exception and insert_exceptions
      so that ps->area is passed as an argument.
      
      This patch doesn't change any functionality, but it refactors the code
      to allow for a cleaner switch over to using dm-bufio.
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      2cadabd5
    • M
      dm snapshot: use GFP_KERNEL when initializing exceptions · 119bc547
      Mikulas Patocka 提交于
      The list of initial exceptions is loaded in the target constructor.  We
      are allowed to allocate memory with GFP_KERNEL at this point.  So,
      change alloc_completed_exception to use GFP_KERNEL when being called
      from the constructor.
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      119bc547
  13. 14 1月, 2014 1 次提交
    • N
      md: ensure metadata is writen after raid level change. · 830778a1
      NeilBrown 提交于
      level_store() currently does not make sure the metadata is
      updates to reflect the new raid level.  It simply sets MD_CHANGE_DEVS.
      
      Any level with a ->thread will quickly notice this and update the
      metadata.  However RAID0 and Linear do not have a thread so no
      metadata update happens until the array is stopped.  At that point the
      metadata is written.
      
      This is later that we would like.  While the delay doesn't risk any
      data it can cause confusion.  So if there is no md thread, immediately
      update the metadata after a level change.
      Reported-by: NRichard Michael <rmichael@edgeofthenet.org>
      Signed-off-by: NNeilBrown <neilb@suse.de>
      830778a1