summaryrefslogtreecommitdiff
path: root/block/elevator.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-07-27 08:40:53 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-07-27 08:40:53 +0200
commit5d5fd841c34649f1b09220fe58e59dffd61c447d (patch)
tree195fd42377575ba4b25775564248630a2eb69ce5 /block/elevator.c
parentcae6572efdd0948a7b676b3c5a7cebf9483bc781 (diff)
parentf5098b6bae761e346ebcd9da7f95622c04733cff (diff)
downloadlinux-next-5d5fd841c34649f1b09220fe58e59dffd61c447d.tar.gz
linux-next-5d5fd841c34649f1b09220fe58e59dffd61c447d.zip
Merge 7.2-rc5 into usb-next
We need the USB fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'block/elevator.c')
-rw-r--r--block/elevator.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/block/elevator.c b/block/elevator.c
index 3bcd37c2aa34..2161b6eea680 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -812,8 +812,13 @@ ssize_t elv_iosched_store(struct gendisk *disk, const char *buf,
* reference during concurrent disk deletion:
* update_nr_hwq_lock -> kn->active (via del_gendisk -> kobject_del)
* kn->active -> update_nr_hwq_lock (via this sysfs write path)
+ *
+ * Use the writer lock instead of the reader lock of update_nr_hwq_lock
+ * to serialize the two-stage elevator switch steps in
+ * elevator_change(): the core switch step under the elevator lock and
+ * the elevator_change_done() step outside the elevator lock.
*/
- if (!down_read_trylock(&set->update_nr_hwq_lock)) {
+ if (!down_write_trylock(&set->update_nr_hwq_lock)) {
ret = -EBUSY;
goto out;
}
@@ -824,7 +829,7 @@ ssize_t elv_iosched_store(struct gendisk *disk, const char *buf,
} else {
ret = -ENOENT;
}
- up_read(&set->update_nr_hwq_lock);
+ up_write(&set->update_nr_hwq_lock);
out:
if (ctx.type)