1. 22 6月, 2009 1 次提交
    • M
      dm ioctl: support cookies for udev · 60935eb2
      Milan Broz 提交于
      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: NMilan Broz <mbroz@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      60935eb2
  2. 16 6月, 2009 1 次提交
  3. 09 4月, 2009 1 次提交
  4. 17 3月, 2009 2 次提交
  5. 06 1月, 2009 2 次提交
    • M
      dm table: rework reference counting · d5816876
      Mikulas Patocka 提交于
      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: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      d5816876
    • M
      dm ioctl: allow dm_copy_name_and_uuid to return only one field · 23d39f63
      Milan Broz 提交于
      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: NMilan Broz <mbroz@redhat.com>
      Reviewed-by: NAlasdair G Kergon <agk@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      23d39f63
  6. 21 10月, 2008 1 次提交
  7. 10 10月, 2008 1 次提交
  8. 09 10月, 2008 2 次提交
    • T
      block: move policy from disk to part0 · b7db9956
      Tejun Heo 提交于
      Move disk->policy to part0->policy.  Implement and use get_disk_ro().
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      b7db9956
    • T
      block: don't depend on consecutive minor space · f331c029
      Tejun Heo 提交于
      * 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: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      f331c029
  9. 08 2月, 2008 3 次提交
  10. 21 12月, 2007 2 次提交
    • A
      dm: trigger change uevent on rename · 69267a30
      Alasdair G Kergon 提交于
      Insert a missing KOBJ_CHANGE notification when a device is renamed.
      
      Cc: Scott James Remnant <scott@ubuntu.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      69267a30
    • J
      dm: table detect io beyond device · 512875bd
      Jun'ichi Nomura 提交于
      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
  11. 20 10月, 2007 3 次提交
    • M
      dm: export name and uuid · 96a1f7db
      Mike Anderson 提交于
      This patch adds a function to obtain a copy of a mapped device's name and uuid.
      Signed-off-by: NMike Anderson <andmike@linux.vnet.ibm.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      96a1f7db
    • J
      dm io:ctl remove vmalloc void cast · bb56acf8
      Jesper Juhl 提交于
      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: NJesper Juhl <jesper.juhl@gmail.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      bb56acf8
    • M
      dm io:ctl use constant struct size · 027d50f9
      Milan Broz 提交于
      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: NMilan Broz <mbroz@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      Cc: Guido Guenther <agx@sigxcpu.org>
      Cc: Kevin Corry <kevcorry@us.ibm.com>
      Cc: stable@kernel.org
      027d50f9
  12. 13 2月, 2007 1 次提交
  13. 09 12月, 2006 2 次提交
  14. 09 11月, 2006 1 次提交
    • A
      [PATCH] dm: fix find_device race · bfc5ecdf
      Alasdair G Kergon 提交于
      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: NAlasdair G Kergon <agk@redhat.com>
      Cc: <dm-devel@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      bfc5ecdf
  15. 27 6月, 2006 9 次提交
  16. 28 3月, 2006 3 次提交
  17. 02 2月, 2006 1 次提交
  18. 15 1月, 2006 1 次提交
  19. 07 1月, 2006 3 次提交