summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-10-03 19:40:37 +0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-03 19:40:37 +0400
commitee042ec88022249b848306dd6e87ffd2fd88a839 (patch)
treec730a6a460b8228094636e21088a9a6277a586a0
parent80ad99da8bd213e12b925407f1c97a303aa8f87f (diff)
parent8e0e99ba64c7ba46133a7c8a3e3f7de01f23bd93 (diff)
downloadlinux-ee042ec88022249b848306dd6e87ffd2fd88a839.tar.xz
Merge tag 'md/3.17-final-fix' of git://neil.brown.name/md
Pull raid5 discard fix from Neil Brown: "One fix for raid5 discard issue" * tag 'md/3.17-final-fix' of git://neil.brown.name/md: md/raid5: disable 'DISCARD' by default due to safety concerns.
-rw-r--r--drivers/md/raid5.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 183588b11fc1..9f0fbecd1eb5 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -64,6 +64,10 @@
#define cpu_to_group(cpu) cpu_to_node(cpu)
#define ANY_GROUP NUMA_NO_NODE
+static bool devices_handle_discard_safely = false;
+module_param(devices_handle_discard_safely, bool, 0644);
+MODULE_PARM_DESC(devices_handle_discard_safely,
+ "Set to Y if all devices in each array reliably return zeroes on reads from discarded regions");
static struct workqueue_struct *raid5_wq;
/*
* Stripe cache
@@ -6208,7 +6212,7 @@ static int run(struct mddev *mddev)
mddev->queue->limits.discard_granularity = stripe;
/*
* unaligned part of discard request will be ignored, so can't
- * guarantee discard_zerors_data
+ * guarantee discard_zeroes_data
*/
mddev->queue->limits.discard_zeroes_data = 0;
@@ -6233,6 +6237,18 @@ static int run(struct mddev *mddev)
!bdev_get_queue(rdev->bdev)->
limits.discard_zeroes_data)
discard_supported = false;
+ /* Unfortunately, discard_zeroes_data is not currently
+ * a guarantee - just a hint. So we only allow DISCARD
+ * if the sysadmin has confirmed that only safe devices
+ * are in use by setting a module parameter.
+ */
+ if (!devices_handle_discard_safely) {
+ if (discard_supported) {
+ pr_info("md/raid456: discard support disabled due to uncertainty.\n");
+ pr_info("Set raid456.devices_handle_discard_safely=Y to override.\n");
+ }
+ discard_supported = false;
+ }
}
if (discard_supported &&