Check that the target supports discard Because of a various race conditions, discard request may be submitted to device mapper even if device mapper advertises that it doesn't support discards. (for example, the device is linear, dm advertises discard support, discard request is constructed, the table is reloaded with mirror, the discard is submitted to the mirror target that doesn't support it). To solve these problems we must check that the target supports discard just before submitting discard request to it. Signed-off-by: Mikulas Patocka <mpatocka@xxxxxxxxxx> --- drivers/md/dm.c | 3 +++ 1 file changed, 3 insertions(+) Index: linux-2.6.35-rc3-fast/drivers/md/dm.c =================================================================== --- linux-2.6.35-rc3-fast.orig/drivers/md/dm.c 2010-07-02 16:10:25.000000000 +0200 +++ linux-2.6.35-rc3-fast/drivers/md/dm.c 2010-07-02 16:11:22.000000000 +0200 @@ -1223,6 +1223,9 @@ static int __clone_and_map_discard(struc if (!dm_target_is_valid(ti)) return -EIO; + if (!(ti->type->features & DM_TARGET_SUPPORTS_DISCARDS)) + return -EOPNOTSUPP; + max = max_io_len(ci->md, ci->sector, ti); if (ci->sector_count > max) -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel