dm mpath: support discard
Changes
1 files changed · +10 −0
| File | Status | Add | Del | Content |
|---|---|---|---|---|
| drivers/md/dm-mpath.c | modified | +10 | −0 | View file |
drivers/md/dm-mpath.c
View filediff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index da2223a..487ecda 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -893,6 +893,7 @@ static int multipath_ctr(struct dm_target *ti, unsigned int argc,
}
ti->num_flush_requests = 1;
+ ti->num_discard_requests = 1;
return 0;
@@ -1272,6 +1273,15 @@ static int do_end_io(struct multipath *m, struct request *clone,
if (error == -EOPNOTSUPP)
return error;
+ if (clone->cmd_flags & REQ_DISCARD)
+ /*
+ * Pass all discard request failures up.
+ * FIXME: only fail_path if the discard failed due to a
+ * transport problem. This requires precise understanding
+ * of the underlying failure (e.g. the SCSI sense).
+ */
+ return error;
+
if (mpio->pgpath)
fail_path(mpio->pgpath);