Revert "block: Convert RQF_PREEMPT into REQ_PREEMPT" [6/7]

This reverts commit 3e48d1e84012b6b55e62c3593ef35f30cd4df0f6.

Reason for revert: this patchset is either mismerged or incomplete.
UFS may fail to resume from suspend with the log containing these lines:

[23703.703882] scsi host0: runtime PM trying to activate child device host0 but parent (1d84000.ufshc) is not active
[23703.703977] scsi target0:0:0: runtime PM trying to activate child device target0:0:0 but parent (host0) is not active
[23703.704369] sd 0:0:0:0: runtime PM trying to activate child device 0:0:0:0 but parent (target0:0:0) is not active
[23703.704380] scsi 0:0:0:49488: runtime PM trying to activate child device 0:0:0:49488 but parent (target0:0:0) is not active
[23703.704470] sd 0:0:0:3: runtime PM trying to activate child device 0:0:0:3 but parent (target0:0:0) is not active
[23703.704478] sd 0:0:0:5: runtime PM trying to activate child device 0:0:0:5 but parent (target0:0:0) is not active
[23703.704557] sd 0:0:0:1: runtime PM trying to activate child device 0:0:0:1 but parent (target0:0:0) is not active
[23703.704565] scsi 0:0:0:49476: runtime PM trying to activate child device 0:0:0:49476 but parent (target0:0:0) is not active
[23703.704643] sd 0:0:0:4: runtime PM trying to activate child device 0:0:0:4 but parent (target0:0:0) is not active
[23703.704651] scsi 0:0:0:49456: runtime PM trying to activate child device 0:0:0:49456 but parent (target0:0:0) is not active
[23703.704722] sd 0:0:0:2: runtime PM trying to activate child device 0:0:0:2 but parent (target0:0:0) is not active

This shoudn't be a problem [1], but the device becomes unresponsive
until forced reboot is done by holding power button.

[1] https://lkml.org/lkml/2020/11/13/2

Test: the mentioned kernel messages do not cause any issue
Change-Id: I6725d35a052495c6525d847c5c19aa0ff4f68409
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
This commit is contained in:
Alexander Winkowski 2022-08-17 05:19:34 +00:00 committed by Richard Raya
parent 3ad9f1c9e2
commit 14e399226e
7 changed files with 14 additions and 17 deletions

View File

@ -304,7 +304,6 @@ static const char *const cmd_flag_name[] = {
CMD_FLAG_NAME(BACKGROUND),
CMD_FLAG_NAME(NOUNMAP),
CMD_FLAG_NAME(NOWAIT),
CMD_FLAG_NAME(PREEMPT),
};
#undef CMD_FLAG_NAME
@ -318,6 +317,7 @@ static const char *const rqf_name[] = {
RQF_NAME(MIXED_MERGE),
RQF_NAME(MQ_INFLIGHT),
RQF_NAME(DONTPREP),
RQF_NAME(PREEMPT),
RQF_NAME(COPY_USER),
RQF_NAME(FAILED),
RQF_NAME(QUIET),

View File

@ -211,8 +211,9 @@ void ide_prep_sense(ide_drive_t *drive, struct request *rq)
}
sense_rq->rq_disk = rq->rq_disk;
sense_rq->cmd_flags = REQ_OP_DRV_IN | REQ_PREEMPT;
sense_rq->cmd_flags = REQ_OP_DRV_IN;
ide_req(sense_rq)->type = ATA_PRIV_SENSE;
sense_rq->rq_flags |= RQF_PREEMPT;
req->cmd[0] = GPCMD_REQUEST_SENSE;
req->cmd[4] = cmd_len;

View File

@ -534,7 +534,7 @@ repeat:
*/
if ((drive->dev_flags & IDE_DFLAG_BLOCKED) &&
ata_pm_request(rq) == 0 &&
(rq->cmd_flags & REQ_PREEMPT) == 0) {
(rq->rq_flags & RQF_PREEMPT) == 0) {
/* there should be no pending command at this point */
ide_unlock_port(hwif);
goto plug_device;

View File

@ -90,9 +90,9 @@ int generic_ide_resume(struct device *dev)
}
memset(&rqpm, 0, sizeof(rqpm));
rq = blk_get_request(drive->queue, REQ_OP_DRV_IN | REQ_PREEMPT,
__GFP_RECLAIM);
rq = blk_get_request(drive->queue, REQ_OP_DRV_IN, __GFP_RECLAIM);
ide_req(rq)->type = ATA_PRIV_PM_RESUME;
rq->rq_flags |= RQF_PREEMPT;
rq->special = &rqpm;
rqpm.pm_step = IDE_PM_START_RESUME;
rqpm.pm_state = PM_EVENT_ON;

View File

@ -253,9 +253,8 @@ int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
int ret = DRIVER_ERROR << 24;
req = blk_get_request(sdev->request_queue,
(data_direction == DMA_TO_DEVICE ?
REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN) | REQ_PREEMPT,
__GFP_RECLAIM);
data_direction == DMA_TO_DEVICE ?
REQ_OP_SCSI_OUT : REQ_OP_SCSI_IN, __GFP_RECLAIM);
if (IS_ERR(req))
return ret;
rq = scsi_req(req);
@ -273,7 +272,7 @@ int scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
req->timeout = sdev->timeout_override;
req->cmd_flags |= flags;
req->rq_flags |= rq_flags | RQF_QUIET;
req->rq_flags |= rq_flags | RQF_QUIET | RQF_PREEMPT;
/*
* head injection *required* here otherwise quiesce won't work
@ -1346,7 +1345,7 @@ scsi_prep_state_check(struct scsi_device *sdev, struct request *req)
/*
* If the devices is blocked we defer normal commands.
*/
if (!(req->cmd_flags & REQ_PREEMPT))
if (!(req->rq_flags & RQF_PREEMPT))
ret = BLKPREP_DEFER;
break;
default:
@ -1355,7 +1354,7 @@ scsi_prep_state_check(struct scsi_device *sdev, struct request *req)
* special commands. In particular any user initiated
* command is not allowed.
*/
if (!(req->cmd_flags & REQ_PREEMPT))
if (!(req->rq_flags & RQF_PREEMPT))
ret = BLKPREP_KILL;
break;
}

View File

@ -248,11 +248,6 @@ enum req_flag_bits {
__REQ_URGENT, /* urgent request */
__REQ_NOWAIT, /* Don't wait if request will block */
/*
* set for "ide_preempt" requests and also for requests for which the
* SCSI "quiesce" state must be ignored.
*/
__REQ_PREEMPT,
__REQ_NR_BITS, /* stops here */
};
@ -273,7 +268,6 @@ enum req_flag_bits {
#define REQ_NOUNMAP (1ULL << __REQ_NOUNMAP)
#define REQ_NOWAIT (1ULL << __REQ_NOWAIT)
#define REQ_PREEMPT (1ULL << __REQ_PREEMPT)
#define REQ_FAILFAST_MASK \
(REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER)

View File

@ -108,6 +108,9 @@ typedef __u32 __bitwise req_flags_t;
#define RQF_MQ_INFLIGHT ((__force req_flags_t)(1 << 6))
/* don't call prep for this one */
#define RQF_DONTPREP ((__force req_flags_t)(1 << 7))
/* set for "ide_preempt" requests and also for requests for which the SCSI
"quiesce" state must be ignored. */
#define RQF_PREEMPT ((__force req_flags_t)(1 << 8))
/* contains copies of user pages */
#define RQF_COPY_USER ((__force req_flags_t)(1 << 9))
/* vaguely specified driver internal error. Ignored by the block layer */