diff options
author | NeilBrown <neilb@suse.de> | 2014-09-29 18:53:05 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2015-02-24 19:38:46 -0500 |
commit | 750f199ee8b578062341e6ddfe36c59ac8ff2dcb (patch) | |
tree | 406d8eb49a99834266b397656820d9430faca3f2 | |
parent | 16d9cfab930bb6f4946cff8ba7429701fd15b414 (diff) |
md: mark some attributes as pre-alloc
Since __ATTR_PREALLOC was introduced in v3.19-rc1~78^2~18
it can now be used by md.
This ensure that writing to these sysfs attributes will never
block due to a memory allocation.
Such blocking could become a deadlock if mdmon is trying to
reconfigure an array after a failure prior to re-enabling writes.
Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r-- | drivers/md/md.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index c8d2bac4e28b..cadf9cc02b25 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -2555,7 +2555,7 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len) | |||
2555 | return err ? err : len; | 2555 | return err ? err : len; |
2556 | } | 2556 | } |
2557 | static struct rdev_sysfs_entry rdev_state = | 2557 | static struct rdev_sysfs_entry rdev_state = |
2558 | __ATTR(state, S_IRUGO|S_IWUSR, state_show, state_store); | 2558 | __ATTR_PREALLOC(state, S_IRUGO|S_IWUSR, state_show, state_store); |
2559 | 2559 | ||
2560 | static ssize_t | 2560 | static ssize_t |
2561 | errors_show(struct md_rdev *rdev, char *page) | 2561 | errors_show(struct md_rdev *rdev, char *page) |
@@ -3638,7 +3638,8 @@ resync_start_store(struct mddev *mddev, const char *buf, size_t len) | |||
3638 | return err ?: len; | 3638 | return err ?: len; |
3639 | } | 3639 | } |
3640 | static struct md_sysfs_entry md_resync_start = | 3640 | static struct md_sysfs_entry md_resync_start = |
3641 | __ATTR(resync_start, S_IRUGO|S_IWUSR, resync_start_show, resync_start_store); | 3641 | __ATTR_PREALLOC(resync_start, S_IRUGO|S_IWUSR, |
3642 | resync_start_show, resync_start_store); | ||
3642 | 3643 | ||
3643 | /* | 3644 | /* |
3644 | * The array state can be: | 3645 | * The array state can be: |
@@ -3851,7 +3852,7 @@ array_state_store(struct mddev *mddev, const char *buf, size_t len) | |||
3851 | return err ?: len; | 3852 | return err ?: len; |
3852 | } | 3853 | } |
3853 | static struct md_sysfs_entry md_array_state = | 3854 | static struct md_sysfs_entry md_array_state = |
3854 | __ATTR(array_state, S_IRUGO|S_IWUSR, array_state_show, array_state_store); | 3855 | __ATTR_PREALLOC(array_state, S_IRUGO|S_IWUSR, array_state_show, array_state_store); |
3855 | 3856 | ||
3856 | static ssize_t | 3857 | static ssize_t |
3857 | max_corrected_read_errors_show(struct mddev *mddev, char *page) { | 3858 | max_corrected_read_errors_show(struct mddev *mddev, char *page) { |
@@ -4101,7 +4102,7 @@ out_unlock: | |||
4101 | } | 4102 | } |
4102 | 4103 | ||
4103 | static struct md_sysfs_entry md_metadata = | 4104 | static struct md_sysfs_entry md_metadata = |
4104 | __ATTR(metadata_version, S_IRUGO|S_IWUSR, metadata_show, metadata_store); | 4105 | __ATTR_PREALLOC(metadata_version, S_IRUGO|S_IWUSR, metadata_show, metadata_store); |
4105 | 4106 | ||
4106 | static ssize_t | 4107 | static ssize_t |
4107 | action_show(struct mddev *mddev, char *page) | 4108 | action_show(struct mddev *mddev, char *page) |
@@ -4189,7 +4190,7 @@ action_store(struct mddev *mddev, const char *page, size_t len) | |||
4189 | } | 4190 | } |
4190 | 4191 | ||
4191 | static struct md_sysfs_entry md_scan_mode = | 4192 | static struct md_sysfs_entry md_scan_mode = |
4192 | __ATTR(sync_action, S_IRUGO|S_IWUSR, action_show, action_store); | 4193 | __ATTR_PREALLOC(sync_action, S_IRUGO|S_IWUSR, action_show, action_store); |
4193 | 4194 | ||
4194 | static ssize_t | 4195 | static ssize_t |
4195 | last_sync_action_show(struct mddev *mddev, char *page) | 4196 | last_sync_action_show(struct mddev *mddev, char *page) |
@@ -4335,7 +4336,8 @@ sync_completed_show(struct mddev *mddev, char *page) | |||
4335 | return sprintf(page, "%llu / %llu\n", resync, max_sectors); | 4336 | return sprintf(page, "%llu / %llu\n", resync, max_sectors); |
4336 | } | 4337 | } |
4337 | 4338 | ||
4338 | static struct md_sysfs_entry md_sync_completed = __ATTR_RO(sync_completed); | 4339 | static struct md_sysfs_entry md_sync_completed = |
4340 | __ATTR_PREALLOC(sync_completed, S_IRUGO, sync_completed_show, NULL); | ||
4339 | 4341 | ||
4340 | static ssize_t | 4342 | static ssize_t |
4341 | min_sync_show(struct mddev *mddev, char *page) | 4343 | min_sync_show(struct mddev *mddev, char *page) |