From: Mike Snitzer Have the error target respond to a discard request with a hard -EIO rather than fail the request with -EOPNOTSUPP. Signed-off-by: Mike Snitzer Signed-off-by: Alasdair G Kergon --- drivers/md/dm-target.c | 5 +++++ 1 file changed, 5 insertions(+) Index: linux-2.6.35/drivers/md/dm-target.c =================================================================== --- linux-2.6.35.orig/drivers/md/dm-target.c +++ linux-2.6.35/drivers/md/dm-target.c @@ -113,6 +113,11 @@ void dm_unregister_target(struct target_ */ static int io_err_ctr(struct dm_target *tt, unsigned int argc, char **args) { + /* + * Return error for discards instead of -EOPNOTSUPP + */ + tt->num_discard_requests = 1; + return 0; }