Skip to contentSkip to conversation

block,scsi: BLK_STS_AGAIN clarification

PATCH Applied Hannes Reinecke 5 participants 8 messages May 24, 2022 – Jun 2, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover block,scsi: BLK_STS_AGAIN clarification

Hi all,

BLK_STS_AGAIN should only be used under very specify circumstances, so we should better document that. And modify the SCSI midlayer to not return it, of course.

As usual, comments and reviews are welcome.

Hannes Reinecke (2):
block: document BLK_STS_AGAIN usage
scsi: return BLK_STS_TRANSPORT for ALUA transitioning

 drivers/scsi/scsi_lib.c   | 2 +-
 include/linux/blk_types.h | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)
Signature · 1 line
2.29.2
#1 lore raw

PATCH 1/2 block: document BLK_STS_AGAIN usage

BLK_STS_AGAIN should only be used if RQF_NOWAIT is set and the bio would block. So we'd better document that to avoid accidental misuse.

---
 include/linux/blk_types.h | 4 ++++
 1 file changed, 4 insertions(+)
include/linux/blk_types.h +4 -0
index 1973ef9bd40f..8fb8f79cb74e 100644
@@ -105,6 +105,10 @@ typedef u16 blk_short_t;
 /* hack for device mapper, don't use elsewhere: */
 #define BLK_STS_DM_REQUEUE    ((__force blk_status_t)11)
 
+/*
+ * BLK_STS_AGAIN should only be returned if RQF_NOWAIT is set
+ * and the bio would block (cf bio_wouldblock_error())
+ */
 #define BLK_STS_AGAIN		((__force blk_status_t)12)
 
 /*
Signature · 1 line
2.29.2
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] block: document BLK_STS_AGAIN usage

Quoted 2 lines · Hannes Reinecke

BLK_STS_AGAIN should only be used if RQF_NOWAIT is set and the bio would block. So we'd better document that to avoid accidental misuse.

Looks good:

given that nothing in patch 2 depends on this it would be good to just get this into the block tree ASAP.

#4 lore raw

PATCH 2/2 scsi: return BLK_STS_TRANSPORT for ALUA transitioning

In reply to Hannes Reinecke

When the 'ALUA state transitioning' sense code is returned we cannot use BLK_STS_AGAIN, as this has a very specific use-case. So return BLK_STS_TRANSPORT here.

---
 drivers/scsi/scsi_lib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_lib.c +1 -1
index 8d18cc7e510e..a55deb5caa34 100644
@@ -779,7 +779,7 @@ static void scsi_io_completion_action(struct scsi_cmnd *cmd, int result)
 					action = ACTION_DELAYED_RETRY;
 					break;
 				case 0x0a: /* ALUA state transition */
-					blk_stat = BLK_STS_AGAIN;
+					blk_stat = BLK_STS_TRANSPORT;
 					fallthrough;
 				default:
 					action = ACTION_FAIL;
Signature · 1 line
2.29.2
Reviewed-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] scsi: return BLK_STS_TRANSPORT for ALUA transitioning

Quoted 6 lines · Hannes Reinecke

When the 'ALUA state transitioning' sense code is returned we cannot use BLK_STS_AGAIN, as this has a very specific use-case. So return BLK_STS_TRANSPORT here.

---

Do we need a fixes tag ? irrespective of that looks good.

-ck

#6 lore raw

Re: [PATCH 2/2] scsi: return BLK_STS_TRANSPORT for ALUA transitioning

In reply to Hannes Reinecke

Hannes,

Quoted 3 lines

When the 'ALUA state transitioning' sense code is returned we cannot use BLK_STS_AGAIN, as this has a very specific use-case. So return BLK_STS_TRANSPORT here.

Applied to 5.19/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
maintainer Applied
#7 lore raw

Re: (subset) [PATCH 0/2] block,scsi: BLK_STS_AGAIN clarification

In reply to Hannes Reinecke
Quoted 11 lines · Hannes Reinecke

BLK_STS_AGAIN should only be used under very specify circumstances, so we should better document that. And modify the SCSI midlayer to not return it, of course.

As usual, comments and reviews are welcome.

Hannes Reinecke (2):
block: document BLK_STS_AGAIN usage
scsi: return BLK_STS_TRANSPORT for ALUA transitioning

[...]

Applied, thanks!

[1/2] block: document BLK_STS_AGAIN usage

      commit: 98d40e76652e9aeb3aec4065f600d633ed335e94

Best regards,

Signature · 1 line
Jens Axboe