01 Nov, 2016

1 commit


25 Aug, 2016

1 commit

  • Commit e6047149db ("dm: use bio op accessors") switched DM over to
    using bio_set_op_attrs() but didn't take care to initialize
    lc->io_req.bi_op_flags in dm-log.c:rw_header(). This caused
    rw_header()'s call to dm_io() to make bio->bi_op_flags be uninitialized
    in dm-io.c:do_region(), which ultimately resulted in a SCSI BUG() in
    sd_init_command().

    Also, adjust rw_header() and its callers to use REQ_OP_{READ|WRITE}.

    Fixes: e6047149db ("dm: use bio op accessors")
    Signed-off-by: Heinz Mauelshagen
    Reviewed-by: Shaun Tancheff
    Signed-off-by: Mike Snitzer

    Heinz Mauelshagen
     

08 Jun, 2016

1 commit


31 Jul, 2012

1 commit

  • Use memweight() to count the total number of bits set in memory area.

    Signed-off-by: Akinobu Mita
    Cc: Alasdair Kergon
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Akinobu Mita
     

29 Mar, 2012

1 commit

  • Device mapper uses sscanf to convert arguments to numbers. The problem is that
    the way we use it ignores additional unmatched characters in the scanned string.

    For example, this `if (sscanf(string, "%d", &number) == 1)' will match a number,
    but also it will match number with some garbage appended, like "123abc".

    As a result, device mapper accepts garbage after some numbers. For example
    the command `dmsetup create vg1-new --table "0 16384 linear 254:1bla 34816bla"'
    will pass without an error.

    This patch fixes all sscanf uses in device mapper. It appends "%c" with
    a pointer to a dummy character variable to every sscanf statement.

    The construct `if (sscanf(string, "%d%c", &number, &dummy) == 1)' succeeds
    only if string is a null-terminated number (optionally preceded by some
    whitespace characters). If there is some character appended after the number,
    sscanf matches "%c", writes the character to the dummy variable and returns 2.
    We check the return value for 1 and consequently reject numbers with some
    garbage appended.

    Signed-off-by: Mikulas Patocka
    Acked-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka
     

02 Aug, 2011

3 commits


29 May, 2011

1 commit

  • Replace the arbitrary calculation of an initial io struct mempool size
    with a constant.

    The code calculated the number of reserved structures based on the request
    size and used a "magic" multiplication constant of 4. This patch changes
    it to reserve a fixed number - itself still chosen quite arbitrarily.
    Further testing might show if there is a better number to choose.

    Note that if there is no memory pressure, we can still allocate an
    arbitrary number of "struct io" structures. One structure is enough to
    process the whole request.

    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka
     

26 Mar, 2011

1 commit

  • * git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-2.6-dm:
    dm stripe: implement merge method
    dm mpath: allow table load with no priority groups
    dm mpath: fail message ioctl if specified path is not valid
    dm ioctl: add flag to wipe buffers for secure data
    dm ioctl: prepare for crypt key wiping
    dm crypt: wipe keys string immediately after key is set
    dm: add flakey target
    dm: fix opening log and cow devices for read only tables

    Linus Torvalds
     

24 Mar, 2011

2 commits

  • If a table is read-only, also open any log and cow devices it uses read-only.

    Previously, even read-only devices were opened read-write internally.
    After patch 75f1dc0d076d1c1168f2115f1941ea627d38bd5a
    block: check bdev_read_only() from blkdev_get()
    was applied, loading such tables began to fail. The patch
    was reverted by e51900f7d38cbcfb481d84567fd92540e7e1d23a
    block: revert block_dev read-only check
    but this patch fixes this part of the code to work with the original patch.

    Signed-off-by: Milan Broz
    Signed-off-by: Alasdair G Kergon

    Milan Broz
     
  • As a preparation for removing ext2 non-atomic bit operations from
    asm/bitops.h. This converts ext2 non-atomic bit operations to
    little-endian bit operations.

    Signed-off-by: Akinobu Mita
    Cc: Alasdair Kergon
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Akinobu Mita
     

14 Jan, 2011

1 commit

  • It's nicer to return the PTR_ERR() value instead of just returning
    -ENOMEM. In the current code the PTR_ERR() value is always equal to
    -ENOMEM so this doesn't actually affect anything, but still...

    In addition, dm_dirty_log_create() doesn't check for a specific -ENOMEM
    return. So this change is safe relative to potential for a non -ENOMEM
    return in the future.

    Signed-off-by: Dan Carpenter
    Acked-by: Jonathan Brassow
    Signed-off-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon

    Dan Carpenter
     

10 Sep, 2010

1 commit

  • This patch converts bio-based dm to support REQ_FLUSH/FUA instead of
    now deprecated REQ_HARDBARRIER.

    * -EOPNOTSUPP handling logic dropped.

    * Preflush is handled as before but postflush is dropped and replaced
    with passing down REQ_FUA to member request_queues. This replaces
    one array wide cache flush w/ member specific FUA writes.

    * __split_and_process_bio() now calls __clone_and_map_flush() directly
    for flushes and guarantees all FLUSH bio's going to targets are zero
    ` length.

    * It's now guaranteed that all FLUSH bio's which are passed onto dm
    targets are zero length. bio_empty_barrier() tests are replaced
    with REQ_FLUSH tests.

    * Empty WRITE_BARRIERs are replaced with WRITE_FLUSHes.

    * Dropped unlikely() around REQ_FLUSH tests. Flushes are not unlikely
    enough to be marked with unlikely().

    * Block layer now filters out REQ_FLUSH/FUA bio's if the request_queue
    doesn't support cache flushing. Advertise REQ_FLUSH | REQ_FUA
    capability.

    * Request based dm isn't converted yet. dm_init_request_based_queue()
    resets flush support to 0 for now. To avoid disturbing request
    based dm code, dm->flush_error is added for bio based dm while
    requested based dm continues to use dm->barrier_error.

    Lightly tested linear, stripe, raid1, snap and crypt targets. Please
    proceed with caution as I'm not familiar with the code base.

    Signed-off-by: Tejun Heo
    Cc: dm-devel@redhat.com
    Cc: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Tejun Heo
     

06 Mar, 2010

1 commit


11 Dec, 2009

6 commits

  • Report flush errors as 'F' instead of 'D' for log and mirror devices.

    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka
     
  • Call the flush callback from the log.

    If flush failed, we have no alternative but to mark the whole log as dirty.
    Also we set the variable flush_failed to prevent any bits ever being marked as
    clean again.

    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    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: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    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: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    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: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    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: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka
     

22 Jun, 2009

2 commits

  • create_log_context() must use the logical_block_size from the log disk,
    where the I/O happens, not the target's logical_block_size.

    Signed-off-by: Mike Snitzer
    Signed-off-by: Alasdair G Kergon

    Mike Snitzer
     
  • Use i_size_read() instead of reading i_size.

    If someone changes the size of the device simultaneously, i_size_read
    is guaranteed to return a valid value (either the old one or the new one).

    i_size can return some intermediate invalid value (on 32-bit computers
    with 64-bit i_size, the reads to both halves of i_size can be interleaved
    with updates to i_size, resulting in garbage being returned).

    Cc: stable@kernel.org
    Signed-off-by: Mikulas Patocka
    Signed-off-by: Alasdair G Kergon

    Mikulas Patocka
     

23 May, 2009

1 commit

  • Until now we have had a 1:1 mapping between storage device physical
    block size and the logical block sized used when addressing the device.
    With SATA 4KB drives coming out that will no longer be the case. The
    sector size will be 4KB but the logical block size will remain
    512-bytes. Hence we need to distinguish between the physical block size
    and the logical ditto.

    This patch renames hardsect_size to logical_block_size.

    Signed-off-by: Martin K. Petersen
    Signed-off-by: Jens Axboe

    Martin K. Petersen
     

03 Apr, 2009

2 commits


06 Jan, 2009

4 commits


22 Oct, 2008

1 commit


21 Jul, 2008

1 commit


25 Apr, 2008

7 commits


08 Feb, 2008

1 commit