Skip to content

Commit 720fc22

Browse files
Mikulas Patockadavem330
authored andcommitted
ide: Fix IDE taskfile with cfq scheduler
When ide taskfile access is being used (for example with hdparm --security commands) and cfq scheduler is selected, the scheduler crashes on BUG in cfq_put_request. The reason is that the cfq scheduler is tracking counts of read and write requests separately; the ide-taskfile subsystem allocates a read request and then flips the flag to make it a write request. The counters in cfq will mismatch. This patch changes ide-taskfile to allocate the READ or WRITE request as required and don't change the flag later. Signed-off-by: Mikulas Patocka <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1af1850 commit 720fc22

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/ide/ide-taskfile.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -428,13 +428,11 @@ int ide_raw_taskfile(ide_drive_t *drive, struct ide_cmd *cmd, u8 *buf,
428428
{
429429
struct request *rq;
430430
int error;
431+
int rw = !(cmd->tf_flags & IDE_TFLAG_WRITE) ? READ : WRITE;
431432

432-
rq = blk_get_request(drive->queue, READ, __GFP_WAIT);
433+
rq = blk_get_request(drive->queue, rw, __GFP_WAIT);
433434
rq->cmd_type = REQ_TYPE_ATA_TASKFILE;
434435

435-
if (cmd->tf_flags & IDE_TFLAG_WRITE)
436-
rq->cmd_flags |= REQ_RW;
437-
438436
/*
439437
* (ks) We transfer currently only whole sectors.
440438
* This is suffient for now. But, it would be great,

0 commit comments

Comments
 (0)