An error occurred fetching the project authors.
  1. 10 Dec, 2009 5 commits
    • Mike Snitzer's avatar
      dm ioctl: retrieve status from inactive table · 1d0f3ce8
      Mike Snitzer authored
      Add the flag DM_QUERY_INACTIVE_TABLE_FLAG to the ioctls to return
      infomation about the loaded-but-not-yet-active table instead of the live
      table.  Prior to this patch it was impossible to obtain this information
      until the device had been 'resumed'.
      
      Userspace dmsetup and libdevmapper support the flag as of version 1.02.40.
      e.g. dmsetup info --inactive vg1-lv1
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
      1d0f3ce8
    • Mike Anderson's avatar
      dm ioctl: forbid messages to devices being deleted · c50abeb3
      Mike Anderson authored
      Once we begin deleting a device, prevent any further messages being sent
      to targets of its table (to avoid races).
      Signed-off-by: default avatarMike Anderson <andmike@linux.vnet.ibm.com>
      Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
      c50abeb3
    • Alasdair G Kergon's avatar
      dm: rename dm_get_table to dm_get_live_table · 7c666411
      Alasdair G Kergon authored
      Rename dm_get_table to dm_get_live_table.
      Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
      7c666411
    • Roel Kluin's avatar
      dm ioctl: prefer strlcpy over strncpy · a518b86d
      Roel Kluin authored
      strlcpy() will always null terminate the string.
      
          The code should already guarantee this as the last bytes are already
          NULs and the string lengths were restricted before being stored in
          hc.  Removing the '-1' becomes necessary so strlcpy() doesn't
          lose the last character of a maximum-length string.
      	- agk
      Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
      a518b86d
    • Mikulas Patocka's avatar
      dm: avoid _hash_lock deadlock · 6076905b
      Mikulas Patocka authored
      Fix a reported deadlock if there are still unprocessed multipath events
      on a device that is being removed.
      
      _hash_lock is held during dev_remove while trying to send the
      outstanding events.  Sending the events requests the _hash_lock
      again in dm_copy_name_and_uuid.
      
      This patch introduces a separate lock around regions that modify the
      link to the hash table (dm_set_mdptr) or the name or uuid so that
      dm_copy_name_and_uuid no longer needs _hash_lock.
      
      Additionally, dm_copy_name_and_uuid can only be called if md exists
      so we can drop the dm_get() and dm_put() which can lead to a BUG()
      while md is being freed.
      
      The deadlock:
       #0 [ffff8106298dfb48] schedule at ffffffff80063035
       #1 [ffff8106298dfc20] __down_read at ffffffff8006475d
       #2 [ffff8106298dfc60] dm_copy_name_and_uuid at ffffffff8824f740
       #3 [ffff8106298dfc90] dm_send_uevents at ffffffff88252685
       #4 [ffff8106298dfcd0] event_callback at ffffffff8824c678
       #5 [ffff8106298dfd00] dm_table_event at ffffffff8824dd01
       #6 [ffff8106298dfd10] __hash_remove at ffffffff882507ad
       #7 [ffff8106298dfd30] dev_remove at ffffffff88250865
       #8 [ffff8106298dfd60] ctl_ioctl at ffffffff88250d80
       #9 [ffff8106298dfee0] do_ioctl at ffffffff800418c4
      #10 [ffff8106298dff00] vfs_ioctl at ffffffff8002fab9
      #11 [ffff8106298dff40] sys_ioctl at ffffffff8004bdaf
      #12 [ffff8106298dff80] tracesys at ffffffff8005d28d (via system_call)
      
      Cc: stable@kernel.org
      Reported-by: default avatarguy keren <choo@actcom.co.il>
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
      6076905b
  2. 19 Sep, 2009 1 commit
  3. 22 Jun, 2009 2 commits
    • Kiyoshi Ueda's avatar
      dm: enable request based option · e6ee8c0b
      Kiyoshi Ueda authored
      This patch enables request-based dm.
      
      o Request-based dm and bio-based dm coexist, since there are
        some target drivers which are more fitting to bio-based dm.
        Also, there are other bio-based devices in the kernel
        (e.g. md, loop).
        Since bio-based device can't receive struct request,
        there are some limitations on device stacking between
        bio-based and request-based.
      
                           type of underlying device
                         bio-based      request-based
         ----------------------------------------------
          bio-based         OK                OK
          request-based     --                OK
      
        The device type is recognized by the queue flag in the kernel,
        so dm follows that.
      
      o The type of a dm device is decided at the first table binding time.
        Once the type of a dm device is decided, the type can't be changed.
      
      o Mempool allocations are deferred to at the table loading time, since
        mempools for request-based dm are different from those for bio-based
        dm and needed mempool type is fixed by the type of table.
      
      o Currently, request-based dm supports only tables that have a single
        target.  To support multiple targets, we need to support request
        splitting or prevent bio/request from spanning multiple targets.
        The former needs lots of changes in the block layer, and the latter
        needs that all target drivers support merge() function.
        Both will take a time.
      Signed-off-by: default avatarKiyoshi Ueda <k-ueda@ct.jp.nec.com>
      Signed-off-by: default avatarJun'ichi Nomura <j-nomura@ce.jp.nec.com>
      Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
      e6ee8c0b
    • Milan Broz's avatar
      dm ioctl: support cookies for udev · 60935eb2
      Milan Broz authored
      Add support for passing a 32 bit "cookie" into the kernel with the
      DM_SUSPEND, DM_DEV_RENAME and DM_DEV_REMOVE ioctls.  The (unsigned)
      value of this cookie is returned to userspace alongside the uevents
      issued by these ioctls in the variable DM_COOKIE.
      
      This means the userspace process issuing these ioctls can be notified
      by udev after udev has completed any actions triggered.
      
      To minimise the interface extension, we pass the cookie into the
      kernel in the event_nr field which is otherwise unused when calling
      these ioctls.  Incrementing the version number allows userspace to
      determine in advance whether or not the kernel supports the cookie.
      If the kernel does support this but userspace does not, there should
      be no impact as the new variable will just get ignored.
      Signed-off-by: default avatarMilan Broz <mbroz@redhat.com>
      Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
      60935eb2
  4. 16 Jun, 2009 1 commit
  5. 08 Apr, 2009 1 commit
  6. 16 Mar, 2009 2 commits
  7. 06 Jan, 2009 2 commits
    • Mikulas Patocka's avatar
      dm table: rework reference counting · d5816876
      Mikulas Patocka authored
      Rework table reference counting.
      
      The existing code uses a reference counter. When the last reference is
      dropped and the counter reaches zero, the table destructor is called.
      Table reference counters are acquired/released from upcalls from other
      kernel code (dm_any_congested, dm_merge_bvec, dm_unplug_all).
      If the reference counter reaches zero in one of the upcalls, the table
      destructor is called from almost random kernel code.
      
      This leads to various problems:
      * dm_any_congested being called under a spinlock, which calls the
        destructor, which calls some sleeping function.
      * the destructor attempting to take a lock that is already taken by the
        same process.
      * stale reference from some other kernel code keeps the table
        constructed, which keeps some devices open, even after successful
        return from "dmsetup remove". This can confuse lvm and prevent closing
        of underlying devices or reusing device minor numbers.
      
      The patch changes reference counting so that the table destructor can be
      called only at predetermined places.
      
      The table has always exactly one reference from either mapped_device->map
      or hash_cell->new_map. After this patch, this reference is not counted
      in table->holders.  A pair of dm_create_table/dm_destroy_table functions
      is used for table creation/destruction.
      
      Temporary references from the other code increase table->holders. A pair
      of dm_table_get/dm_table_put functions is used to manipulate it.
      
      When the table is about to be destroyed, we wait for table->holders to
      reach 0. Then, we call the table destructor.  We use active waiting with
      msleep(1), because the situation happens rarely (to one user in 5 years)
      and removing the device isn't performance-critical task: the user doesn't
      care if it takes one tick more or not.
      
      This way, the destructor is called only at specific points
      (dm_table_destroy function) and the above problems associated with lazy
      destruction can't happen.
      
      Finally remove the temporary protection added to dm_any_congested().
      Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
      d5816876
    • Milan Broz's avatar
      dm ioctl: allow dm_copy_name_and_uuid to return only one field · 23d39f63
      Milan Broz authored
      Allow NULL buffer in dm_copy_name_and_uuid if you only want to return one of
      the fields.
      
      (Required by a following patch that adds these fields to sysfs.)
      Signed-off-by: default avatarMilan Broz <mbroz@redhat.com>
      Reviewed-by: default avatarAlasdair G Kergon <agk@redhat.com>
      Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
      23d39f63
  8. 21 Oct, 2008 1 commit
  9. 10 Oct, 2008 1 commit
  10. 09 Oct, 2008 2 commits
    • Tejun Heo's avatar
      block: move policy from disk to part0 · b7db9956
      Tejun Heo authored
      Move disk->policy to part0->policy.  Implement and use get_disk_ro().
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      b7db9956
    • Tejun Heo's avatar
      block: don't depend on consecutive minor space · f331c029
      Tejun Heo authored
      * Implement disk_devt() and part_devt() and use them to directly
        access devt instead of computing it from ->major and ->first_minor.
      
        Note that all references to ->major and ->first_minor outside of
        block layer is used to determine devt of the disk (the part0) and as
        ->major and ->first_minor will continue to represent devt for the
        disk, converting these users aren't strictly necessary.  However,
        convert them for consistency.
      
      * Implement disk_max_parts() to avoid directly deferencing
        genhd->minors.
      
      * Update bdget_disk() such that it doesn't assume consecutive minor
        space.
      
      * Move devt computation from register_disk() to add_disk() and make it
        the only one (all other usages use the initially determined value).
      
      These changes clean up the code and will help disk->part dereference
      fix and extended block device numbers.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      f331c029
  11. 08 Feb, 2008 3 commits
  12. 20 Dec, 2007 2 commits
    • Alasdair G Kergon's avatar
      dm: trigger change uevent on rename · 69267a30
      Alasdair G Kergon authored
      Insert a missing KOBJ_CHANGE notification when a device is renamed.
      
      Cc: Scott James Remnant <scott@ubuntu.com>
      Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
      69267a30
    • Jun'ichi Nomura's avatar
      dm: table detect io beyond device · 512875bd
      Jun'ichi Nomura authored
      This patch fixes a panic on shrinking a DM device if there is
      outstanding I/O to the part of the device that is being removed.
      (Normally this doesn't happen - a filesystem would be resized first,
      for example.)
      
      The bug is that __clone_and_map() assumes dm_table_find_target()
      always returns a valid pointer.  It may fail if a bio arrives from the
      block layer but its target sector is no longer included in the DM
      btree.
      
      This patch appends an empty entry to table->targets[] which will
      be returned by a lookup beyond the end of the device.
      
      After calling dm_table_find_target(), __clone_and_map() and target_message()
      check for this condition using
      dm_target_is_valid().
      
      Sample test script to trigger oops:
      512875bd
  13. 20 Oct, 2007 3 commits
    • Mike Anderson's avatar
      dm: export name and uuid · 96a1f7db
      Mike Anderson authored
      This patch adds a function to obtain a copy of a mapped device's name and uuid.
      Signed-off-by: default avatarMike Anderson <andmike@linux.vnet.ibm.com>
      Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
      96a1f7db
    • Jesper Juhl's avatar
      dm io:ctl remove vmalloc void cast · bb56acf8
      Jesper Juhl authored
      In drivers/md/dm-ioctl.c::copy_params() there's a call to vmalloc()
      where we currently cast the return value, but that's pretty pointless
      given that vmalloc() returns "void *".
      Signed-off-by: default avatarJesper Juhl <jesper.juhl@gmail.com>
      Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
      bb56acf8
    • Milan Broz's avatar
      dm io:ctl use constant struct size · 027d50f9
      Milan Broz authored
      Make size of dm_ioctl struct always 312 bytes on all supported
      architectures.
      
      This change retains compatibility with already-compiled code because
      it uses an embedded offset to locate the payload that follows the
      structure.
      
      On 64-bit architectures there is no change at all; on 32-bit
      we are increasing the size of dm-ioctl from 308 to 312 bytes.
      
      Currently with 32-bit userspace / 64-bit kernel on x86_64
      some ioctls (including rename, message) are incorrectly rejected
      by the comparison against 'param + 1'.  This breaks userspace
      lvrename and multipath 'fail_if_no_path' changes, for example.
      
      (BTW Device-mapper uses its own versioning and ignores the ioctl
      size bits.  Only the generic ioctl compat code on mixed arches
      checks them, and that will continue to accept both sizes for now,
      but we intend to list 308 as deprecated and eventually remove it.)
      Signed-off-by: default avatarMilan Broz <mbroz@redhat.com>
      Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
      Cc: Guido Guenther <agx@sigxcpu.org>
      Cc: Kevin Corry <kevcorry@us.ibm.com>
      Cc: stable@kernel.org
      027d50f9
  14. 12 Feb, 2007 1 commit
  15. 08 Dec, 2006 2 commits
  16. 09 Nov, 2006 1 commit
    • Alasdair G Kergon's avatar
      [PATCH] dm: fix find_device race · bfc5ecdf
      Alasdair G Kergon authored
      There is a race between dev_create() and find_device().
      
      If the mdptr has not yet been stored against a device, find_device() needs to
      behave as though no device was found.  It already returns NULL, but there is a
      dm_put() missing: it must drop the reference dm_get_md() took.
      
      The bug was introduced by dm-fix-mapped-device-ref-counting.patch.
      
      It manifests itself if another dm ioctl attempts to reference a newly-created
      device while the device creation ioctl is still running.  The consequence is
      that the device cannot be removed until the machine is rebooted.  Certain udev
      configurations can lead to this happening.
      Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
      Cc: <dm-devel@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
      bfc5ecdf
  17. 26 Jun, 2006 9 commits
  18. 27 Mar, 2006 1 commit