1. 03 4月, 2009 3 次提交
    • 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 20 次提交