Skip to content

Commit

Permalink
Merge tag 'md/3.17-final-fix' of git://neil.brown.name/md
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Linus Torvalds committed Oct 3, 2014
2 parents 80ad99d + 8e0e99b commit ee042ec
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion drivers/md/raid5.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand All @@ -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 &&
Expand Down

0 comments on commit ee042ec

Please sign in to comment.