• Mike Snitzer's avatar
    dm stripe: fix regression in stripe_width calculation · d793e684
    Mike Snitzer authored
    Fix a regression in the calculation of the stripe_width in the
    dm stripe target which led to incorrect processing of device limits.
    The stripe_width is the stripe device length divided by the number of
    stripes.  The group of commits in the range f14fa693 ("dm stripe: fix
    size test") to eb850de6 ("dm stripe: support for non power of 2
    chunksize") interfered with each other (a merging error) and led to the
    stripe_width being set incorrectly to the stripe device length divided by
    chunk_size * stripe_count.
    For example, a stripe device's table with: 0 33553920 striped 3 512 ...
    should result in a stripe_width of 11184640 (33553920 / 3), but due to
    the bug it was getting set to 21845 (33553920 / (512 * 3)).
    The impact of this bug is that device topologies that previously worked
    fine with the stripe target are no longer considered valid.  In
    particular, there is a higher risk of seeing this issue if one of the
    stripe devices has a 4K logical block size.  Resulting in an error
    message like this:
    "device-mapper: table: 253:4: len=21845 not aligned to h/w logical block size 4096 of dm-1"
    The fix is to swap the order of the divisions and to use a temporary
    variable for the second one, so that width retains the intended
    Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
    Cc: stable@vger.kernel.org # 3.6+
    Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
dm-stripe.c 10.3 KB