linux-next: hdparm -B <value> broken
Hello,
Since next-20140823:
# hdparm -B 200 /dev/sda
/dev/sda:
setting Advanced Power Management level to 0xc8 (200) HDIO_DRIVE_CMD failed: Bad address
APM_level = 128
It looks like before commit 2cada584b200 ("block: cleanup error handling in sg_io"), we had ret = 0 before entering the last big if block of sg_io, and now ret = -EFAULT.
The following patch seems to fix the problem:
block/scsi_ioctl.c +1 -0
@@ -330,6 +330,7 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk,if (blk_fill_sghdr_rq (q, rq, hdr, mode)) goto out_free_cdb; + ret =0 ;if (hdr->iovec_count) {size_t iov_data_len;struct iovec *iov =NULL ;
Thanks,
Signature · 1 line
Sabrina
Quoted 1 line · Sabrina Dubroca
The following patch seems to fix the problem:
Thanks for the fix! Can you turn this into a patch with a proper subject and a signoff?
PATCH 1/1 block: fix error handling in sg_io
Before commit 2cada584b200 ("block: cleanup error handling in sg_io"), we had ret = 0 before entering the last big if block of sg_io.
Since 2cada584b200, ret = -EFAULT, which breaks hdparm:
/dev/sda:
setting Advanced Power Management level to 0xc8 (200) HDIO_DRIVE_CMD failed: Bad address
APM_level = 128
--- block/scsi_ioctl.c | 1 + 1 file changed, 1 insertion(+)
block/scsi_ioctl.c +1 -0
@@ -330,6 +330,7 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk,if (blk_fill_sghdr_rq (q, rq, hdr, mode)) goto out_free_cdb; + ret =0 ;if (hdr->iovec_count) {size_t iov_data_len;struct iovec *iov =NULL ;
Signature · 1 line
2.1.0
Jens Axboe
maintainerRe: [PATCH] block: fix error handling in sg_io
Quoted 5 lines · Sabrina Dubroca
Before commit
2cada584b200("block: cleanup error handling insg_io"), we had ret = 0 before entering the last big if block ofsg_io.Since
2cada584b200, ret =-EFAULT, which breaks hdparm:
Quoted 7 lines
/dev/sda:
setting Advanced Power Management level to0xc8(200)HDIO_DRIVE_CMDfailed: Bad address
APM_level= 128Signed-off-by Sabrina Dubroca <[email protected]>Fixes 2cada584b200 ("block: cleanup error handling in sg_io")
Thanks, good catch. Someone else reported a regression with identical symptoms to me yesterday, but did not follow up, so I'm glad you both found and fixed it.
Signature · 1 line
Jens Axboe
Re: [PATCH] block: fix error handling in sg_io
In reply to Sabrina DubrocaQuoted 5 lines · Sabrina Dubroca
Before commit
2cada584b200("block: cleanup error handling insg_io"), we had ret = 0 before entering the last big if block ofsg_io.Since
2cada584b200, ret =-EFAULT, which breaks hdparm:
Quoted 7 lines
/dev/sda:
setting Advanced Power Management level to0xc8(200)HDIO_DRIVE_CMDfailed: Bad address
APM_level= 128Signed-off-by Sabrina Dubroca <[email protected]>Fixes 2cada584b200 ("block: cleanup error handling in sg_io")
Looks good,