|
@@ -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 &&
|