The following commit has been merged in the linux branch: commit 8c279598585e4992a41016bb973993ed15888cb3 Author: KOSAKI Motohiro kosaki.motohiro@jp.fujitsu.com Date: Fri Oct 9 08:48:08 2009 +0200
elv_iosched_store(): fix strstrip() misuse
elv_iosched_store() ignore the return value of strstrip(). It makes small inconsistent behavior.
This patch fixes it.
<before> ==================================== # cd /sys/block/{blockdev}/queue
case1: # echo "anticipatory" > scheduler # cat scheduler noop [anticipatory] deadline cfq
case2: # echo "anticipatory " > scheduler # cat scheduler noop [anticipatory] deadline cfq
case3: # echo " anticipatory" > scheduler bash: echo: write error: Invalid argument
<after> ==================================== # cd /sys/block/{blockdev}/queue
case1: # echo "anticipatory" > scheduler # cat scheduler noop [anticipatory] deadline cfq
case2: # echo "anticipatory " > scheduler # cat scheduler noop [anticipatory] deadline cfq
case3: # echo " anticipatory" > scheduler noop [anticipatory] deadline cfq
Cc: Li Zefan lizf@cn.fujitsu.com Cc: Jens Axboe jens.axboe@oracle.com Signed-off-by: KOSAKI Motohiro kosaki.motohiro@jp.fujitsu.com Signed-off-by: Jens Axboe jens.axboe@oracle.com
diff --git a/block/elevator.c b/block/elevator.c index 1975b61..a847046 100644 --- a/block/elevator.c +++ b/block/elevator.c @@ -1059,9 +1059,7 @@ ssize_t elv_iosched_store(struct request_queue *q, const char *name, return count;
strlcpy(elevator_name, name, sizeof(elevator_name)); - strstrip(elevator_name); - - e = elevator_get(elevator_name); + e = elevator_get(strstrip(elevator_name)); if (!e) { printk(KERN_ERR "elevator: type %s not found\n", elevator_name); return -EINVAL;