From: Mike Snitzer Have the zero target silently drop a discard rather than fail the request with -EOPNOTSUPP. Signed-off-by: Mike Snitzer Signed-off-by: Alasdair G Kergon --- drivers/md/dm-zero.c | 5 +++++ 1 file changed, 5 insertions(+) Index: linux-2.6.35/drivers/md/dm-zero.c =================================================================== --- linux-2.6.35.orig/drivers/md/dm-zero.c +++ linux-2.6.35/drivers/md/dm-zero.c @@ -22,6 +22,11 @@ static int zero_ctr(struct dm_target *ti return -EINVAL; } + /* + * Silently drop discards, avoiding -EOPNOTSUPP. + */ + ti->num_discard_requests = 1; + return 0; }