1. 11 12月, 2009 17 次提交
    • M
      dm log: add flush callback fn · 87a8f240
      Mikulas Patocka 提交于
      Introduce a callback pointer from the log to dm-raid1 layer.
      
      Before some region is set as "in-sync", we need to flush hardware cache on
      all the disks. But the log module doesn't have access to the mirror_set
      structure. So it will use this callback.
      
      So far the callback is unused, it will be used in further patches.
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      87a8f240
    • M
      dm log: introduce flush_failed variable · 5adc78d0
      Mikulas Patocka 提交于
      Introduce "flush failed" variable.  When a flush before clearing a bit
      in the log fails, we don't know anything about which which regions are
      in-sync and which not.
      
      So we need to set all regions as not-in-sync and set the variable
      "flush_failed" to prevent setting the in-sync bit in the future.
      
      A target reload is the only way to get out of this situation.
      
      The variable will be set in following patches.
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      5adc78d0
    • M
      dm log: add flush_header function · 20a34a8e
      Mikulas Patocka 提交于
      Introduce flush_header and use it to flush the log device.
      
      Note that we don't have to flush if all the regions transition
      from "dirty" to "clean" state.
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      20a34a8e
    • M
      dm raid1: split touched state into two · b09acf1a
      Mikulas Patocka 提交于
      Split the variable "touched" into two, "touched_dirtied" and
      "touched_cleaned", set when some region was dirtied or cleaned.
      
      This will be used to optimize flushes.
      
      After a transition from "dirty" to "clean" state we don't have flush hardware
      cache on the log device. After a transition from "clean" to "dirty" the cache
      must be flushed.
      
      Before a transition from "clean" to "dirty" state we don't have to flush all
      the raid legs. Before a transition from "dirty" to "clean" we must flush all
      the legs to make sure that they are really in sync.
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      b09acf1a
    • M
      dm raid1: support flush · 4184153f
      Mikulas Patocka 提交于
      Flush support for dm-raid1.
      
      When it receives an empty barrier, submit it to all the devices via dm-io.
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      4184153f
    • M
      dm io: remove extra bi_io_vec region hack · f1e53987
      Mikulas Patocka 提交于
      Remove the hack where we allocate an extra bi_io_vec to store additional
      private data.  This hack prevents us from supporting barriers in
      dm-raid1 without first making another little block layer change.
      Instead of doing that, this patch eliminates the bi_io_vec abuse by
      storing the region number directly in the low bits of bi_private.
      
      We need to store two things for each bio, the pointer to the main io
      structure and, if parallel writes were requested, an index indicating
      which of these writes this bio belongs to.  There can be at most
      BITS_PER_LONG regions - 32 or 64.
      
      The index (region number) was stored in the last (hidden) bio vector and
      the pointer to struct io was stored in bi_private.
      
      This patch now aligns "struct io" on BITS_PER_LONG bytes and stores the
      region number in the low BITS_PER_LONG bits of bi_private.
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      f1e53987
    • M
      dm io: use slab for struct io · 952b3557
      Mikulas Patocka 提交于
      Allocate "struct io" from a slab.
      
      This patch changes dm-io, so that "struct io" is allocated from a slab cache.
      It used to be allocated with kmalloc. Allocating from a slab will be needed
      for the next patch, because it requires a special alignment of "struct io"
      and kmalloc cannot meet this alignment.
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      952b3557
    • M
      dm crypt: make wipe message also wipe essiv key · 542da317
      Milan Broz 提交于
      The "wipe key" message is used to wipe the volume key from memory
      temporarily, for example when suspending to RAM.
      
      But the initialisation vector in ESSIV mode is calculated from the
      hashed volume key, so the wipe message should wipe this IV key too and
      reinitialise it when the volume key is reinstated.
      
      This patch adds an IV wipe method called from a wipe message callback.
      ESSIV is then reinitialised using the init function added by the
      last patch.
      
      Cc: stable@kernel.org
      Signed-off-by: NMilan Broz <mbroz@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      542da317
    • M
      dm crypt: separate essiv allocation from initialisation · b95bf2d3
      Milan Broz 提交于
      This patch separates the construction of IV from its initialisation.
      (For ESSIV it is a hash calculation based on volume key.)
      
      Constructor code now preallocates hash tfm and salt array
      and saves it in a private IV structure.
      
      The next patch requires this to reinitialise the wiped IV
      without reallocating memory when resuming a suspended device.
      
      Cc: stable@kernel.org
      Signed-off-by: NMilan Broz <mbroz@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      b95bf2d3
    • M
      dm crypt: restructure essiv error path · 5861f1be
      Milan Broz 提交于
      Use kzfree for salt deallocation because it is derived from the volume
      key.  Use a common error path in ESSIV constructor.
      
      Required by a later patch which fixes the way key material is wiped
      from memory.
      
      Cc: stable@kernel.org
      Signed-off-by: NMilan Broz <mbroz@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      5861f1be
    • M
      dm crypt: move private iv fields to structs · 60473592
      Milan Broz 提交于
      Define private structures for IV so it's easy to add further attributes
      in a following patch which fixes the way key material is wiped from
      memory.  Also move ESSIV destructor and remove unnecessary 'status'
      operation.
      
      There are no functional changes in this patch.
      
      Cc: stable@kernel.org
      Signed-off-by: NMilan Broz <mbroz@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      60473592
    • M
      dm crypt: make wipe message also wipe tfm key · 0b430958
      Milan Broz 提交于
      The "wipe key" message is used to wipe a volume key from memory
      temporarily, for example when suspending to RAM.
      
      There are two instances of the key in memory (inside crypto tfm)
      but only one got wiped.  This patch wipes them both.
      
      Cc: stable@kernel.org
      Signed-off-by: NMilan Broz <mbroz@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      0b430958
    • M
      dm snapshot: cope with chunk size larger than origin · 8e87b9b8
      Mikulas Patocka 提交于
      Under some special conditions the snapshot hash_size is calculated as zero.
      This patch instead sets a minimum value of 64, the same as for the
      pending exception table.
      
      rounddown_pow_of_two(0) is an undefined operation (it expands to shift
      by -1).  init_exception_table with an argument of 0 would fail with -ENOMEM.
      
      The way to trigger the problem is to create a snapshot with a chunk size
      that is larger than the origin device.
      
      Cc: stable@kernel.org
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      8e87b9b8
    • M
      dm snapshot: only take lock for statustype info not table · 94e76572
      Mikulas Patocka 提交于
      Take snapshot lock only for STATUSTYPE_INFO, not STATUSTYPE_TABLE.
      
      Commit 4c6fff44
      (dm-snapshot-lock-snapshot-while-supplying-status.patch)
      introduced this use of the lock, but userspace applications using
      libdevmapper have been found to request STATUSTYPE_TABLE while the device
      is suspended and the lock is already held, leading to deadlock.  Since
      the lock is not necessary in this case, don't try to take it.
      
      Cc: stable@kernel.org
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      94e76572
    • M
      dm: sysfs add empty release function to avoid debug warning · d2bb7df8
      Milan Broz 提交于
      This patch just removes an unnecessary warning:
       kobject: 'dm': does not have a release() function,
       it is broken and must be fixed.
      
      The kobject is embedded in mapped device struct, so
      code does not need to release memory explicitly here.
      
      Cc: stable@kernel.org
      Signed-off-by: NMilan Broz <mbroz@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      d2bb7df8
    • J
      dm exception store: free tmp_store on persistent flag error · 613978f8
      Julia Lawall 提交于
      Error handling code following a kmalloc should free the allocated data.
      
      Cc: stable@kernel.org
      Signed-off-by: NJulia Lawall <julia@diku.dk>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      613978f8
    • M
      dm: avoid _hash_lock deadlock · 6076905b
      Mikulas Patocka 提交于
      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: Nguy keren <choo@actcom.co.il>
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      6076905b
  2. 10 12月, 2009 23 次提交