Message ID | 20211020184319.588002-2-k.shelekhin@yadro.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | scsi: target: iblock: Report space allocation errors | expand |
Konstantin, > According to SBC-3 4.7.3.6 this sense reason shall be used in situations > where thin provisioned logical unit cannot satisfy the write request due > to the lack of free blocks. > + [TCM_SPACE_ALLOCATION_FAILED] = { > + .key = DATA_PROTECT, > + .asc = 0x27, > + .ascq = 0x07, /* SPACE ALLOCATION FAILED WRITE PROTECT */ > + }, How do we know this is a permanent condition and not a temporary space exhaustion?
On Wed, Oct 20, 2021 at 11:21:54PM -0400, Martin K. Petersen wrote: > > Konstantin, > > > According to SBC-3 4.7.3.6 this sense reason shall be used in situations > > where thin provisioned logical unit cannot satisfy the write request due > > to the lack of free blocks. > > > + [TCM_SPACE_ALLOCATION_FAILED] = { > > + .key = DATA_PROTECT, > > + .asc = 0x27, > > + .ascq = 0x07, /* SPACE ALLOCATION FAILED WRITE PROTECT */ > > + }, > > How do we know this is a permanent condition and not a temporary space > exhaustion? By permanent condition SBC-3 means that an initiator should not resend the command immediately as it will fail again. Kernel tries hard not to fail with BLK_STS_NOSPC: /* * We're holding onto IO to allow userland time to react. After the * timeout either the pool will have been resized (and thus back in * PM_WRITE mode), or we degrade to PM_OUT_OF_DATA_SPACE w/ error_if_no_space. */ static void do_no_space_timeout(struct work_struct *ws) So BLK_STS_NOSPC means that we are stuck with this condition and some out-of-scope actions (like running fs-trim on the initiator) are required.
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 14c6f2bb1b01..d8261bd1cb5c 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -2025,6 +2025,7 @@ void transport_generic_request_failure(struct se_cmd *cmd, case TCM_ALUA_TG_PT_UNAVAILABLE: case TCM_ALUA_STATE_TRANSITION: case TCM_ALUA_OFFLINE: + case TCM_SPACE_ALLOCATION_FAILED: break; case TCM_OUT_OF_RESOURCES: cmd->scsi_status = SAM_STAT_TASK_SET_FULL; @@ -3369,6 +3370,11 @@ static const struct sense_detail sense_detail_table[] = { .asc = 0x04, .ascq = ASCQ_04H_ALUA_OFFLINE, }, + [TCM_SPACE_ALLOCATION_FAILED] = { + .key = DATA_PROTECT, + .asc = 0x27, + .ascq = 0x07, /* SPACE ALLOCATION FAILED WRITE PROTECT */ + }, }; /** diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index fb11c7693b25..fe2f1c5bb1b8 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -192,6 +192,7 @@ enum tcm_sense_reason_table { TCM_ALUA_TG_PT_UNAVAILABLE = R(0x21), TCM_ALUA_STATE_TRANSITION = R(0x22), TCM_ALUA_OFFLINE = R(0x23), + TCM_SPACE_ALLOCATION_FAILED = R(0x24), #undef R };