diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-03 08:40:37 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-10-03 08:40:37 -0700 |
commit | ee042ec88022249b848306dd6e87ffd2fd88a839 (patch) | |
tree | c730a6a460b8228094636e21088a9a6277a586a0 | |
parent | 80ad99da8bd213e12b925407f1c97a303aa8f87f (diff) | |
parent | 8e0e99ba64c7ba46133a7c8a3e3f7de01f23bd93 (diff) | |
download | op-kernel-dev-ee042ec88022249b848306dd6e87ffd2fd88a839.zip op-kernel-dev-ee042ec88022249b848306dd6e87ffd2fd88a839.tar.gz |
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.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 183588b..9f0fbec 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 && |