1. 03 4月, 2009 6 次提交
    • M
      dm snapshot: avoid having two exceptions for the same chunk · 35bf659b
      Mikulas Patocka 提交于
      We need to check if the exception was completed after dropping the lock.
      
      After regaining the lock, __find_pending_exception checks if the exception
      was already placed into &s->pending hash.
      
      But we don't check if the exception was already completed and placed into
      &s->complete hash. If the process waiting in alloc_pending_exception was
      delayed at this point because of a scheduling latency and the exception
      was meanwhile completed, we'd miss that and allocate another pending
      exception for already completed chunk.
      
      It would lead to a situation where two records for the same chunk exist
      and potential data corruption because multiple snapshot I/Os to the
      affected chunk could be redirected to different locations in the
      snapshot.
      
      Cc: stable@kernel.org
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      35bf659b
    • M
      dm snapshot: avoid dropping lock in __find_pending_exception · c6621392
      Mikulas Patocka 提交于
      It is uncommon and bug-prone to drop a lock in a function that is called with
      the lock held, so this is moved to the caller.
      
      Cc: stable@kernel.org
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      c6621392
    • M
      dm snapshot: refactor __find_pending_exception · 2913808e
      Mikulas Patocka 提交于
      Move looking-up of a pending exception from __find_pending_exception to another
      function.
      
      Cc: stable@kernel.org
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      2913808e
    • M
      dm io: make sync_io uninterruptible · b64b6bf4
      Mikulas Patocka 提交于
      If someone sends signal to a process performing synchronous dm-io call,
      the kernel may crash.
      
      The function sync_io attempts to exit with -EINTR if it has pending signal,
      however the structure "io" is allocated on stack, so already submitted io
      requests end up touching unallocated stack space and corrupting kernel memory.
      
      sync_io sets its state to TASK_UNINTERRUPTIBLE, so the signal can't break out
      of io_schedule() --- however, if the signal was pending before sync_io entered
      while (1) loop, the corruption of kernel memory will happen.
      
      There is no way to cancel in-progress IOs, so the best solution is to ignore
      signals at this point.
      
      Cc: stable@kernel.org
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      b64b6bf4
    • M
      dm raid1: switch read_record from kmalloc to slab to save memory · 95f8fac8
      Mikulas Patocka 提交于
      With my previous patch to save bi_io_vec, the size of dm_raid1_read_record
      is significantly increased (the vector list takes 3072 bytes on 32-bit machines
      and 4096 bytes on 64-bit machines).
      
      The structure dm_raid1_read_record used to be allocated with kmalloc,
      but kmalloc aligns the size on the next power-of-two so an object
      slightly greater than 4096 will allocate 8192 bytes of memory and half of
      that memory will be wasted.
      
      This patch turns kmalloc into a slab cache which doesn't have this
      padding so it will reduce the memory consumed.
      
      Cc: stable@kernel.org
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      95f8fac8
    • M
      dm: preserve bi_io_vec when resubmitting bios · a920f6b3
      Mikulas Patocka 提交于
      Device mapper saves and restores various fields in the bio, but it doesn't save
      bi_io_vec.  If the device driver modifies this after a partially successful
      request, dm-raid1 and dm-multipath may attempt to resubmit a bio that has
      bi_size inconsistent with the size of vector.
      
      To make requests resubmittable in dm-raid1 and dm-multipath, we must save
      and restore the bio vector as well.
      
      To reduce the memory overhead involved in this, we do not save the pages in a
      vector and use a 16-bit field size if the page size is less than 65536.
      
      Cc: stable@kernel.org
      Signed-off-by: NMikulas Patocka <mpatocka@redhat.com>
      Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
      a920f6b3
  2. 02 4月, 2009 17 次提交
  3. 01 4月, 2009 17 次提交