All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] scsi: target: iblock: Report space allocation errors
@ 2021-10-20 18:43 Konstantin Shelekhin
  2021-10-20 18:43 ` [PATCH 1/2] scsi: target: core: Add sense reason for " Konstantin Shelekhin
  2021-10-20 18:43 ` [PATCH 2/2] scsi: target: iblock: Report " Konstantin Shelekhin
  0 siblings, 2 replies; 16+ messages in thread
From: Konstantin Shelekhin @ 2021-10-20 18:43 UTC (permalink / raw)
  To: Martin Petersen, Mike Christie, target-devel
  Cc: linux-scsi, linux, Konstantin Shelekhin

Currently iblock terminates failed requests with TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE
regardless of the reason. It makes it impossible to distinguish the lack of
free LBA from a hardware failure on thin provisioned devices without analyzing
target logs. This series teaches iblock to report the appropriate sense reason
according to the failed bio's status.

Konstantin Shelekhin (2):
  scsi: target: core: Add sense reason for space allocation errors
  scsi: target: iblock: Report space allocation errors

 drivers/target/target_core_iblock.c    | 24 ++++++++++++++++++++----
 drivers/target/target_core_iblock.h    |  2 +-
 drivers/target/target_core_transport.c |  6 ++++++
 include/target/target_core_base.h      |  1 +
 4 files changed, 28 insertions(+), 5 deletions(-)

-- 
2.33.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/2] scsi: target: core: Add sense reason for space allocation errors
  2021-10-20 18:43 [PATCH 0/2] scsi: target: iblock: Report space allocation errors Konstantin Shelekhin
@ 2021-10-20 18:43 ` Konstantin Shelekhin
  2021-10-21  3:21   ` Martin K. Petersen
  2021-10-20 18:43 ` [PATCH 2/2] scsi: target: iblock: Report " Konstantin Shelekhin
  1 sibling, 1 reply; 16+ messages in thread
From: Konstantin Shelekhin @ 2021-10-20 18:43 UTC (permalink / raw)
  To: Martin Petersen, Mike Christie, target-devel
  Cc: linux-scsi, linux, Konstantin Shelekhin, Dmitry Bogdanov

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.

Signed-off-by: Konstantin Shelekhin <k.shelekhin@yadro.com>
Reviewed-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
---
 drivers/target/target_core_transport.c | 6 ++++++
 include/target/target_core_base.h      | 1 +
 2 files changed, 7 insertions(+)

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
 };
 
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 2/2] scsi: target: iblock: Report space allocation errors
  2021-10-20 18:43 [PATCH 0/2] scsi: target: iblock: Report space allocation errors Konstantin Shelekhin
  2021-10-20 18:43 ` [PATCH 1/2] scsi: target: core: Add sense reason for " Konstantin Shelekhin
@ 2021-10-20 18:43 ` Konstantin Shelekhin
  2021-10-22  5:27     ` kernel test robot
                     ` (4 more replies)
  1 sibling, 5 replies; 16+ messages in thread
From: Konstantin Shelekhin @ 2021-10-20 18:43 UTC (permalink / raw)
  To: Martin Petersen, Mike Christie, target-devel
  Cc: linux-scsi, linux, Konstantin Shelekhin, Dmitry Bogdanov

When a thin provisioned block device lacks free LBA it ends bio requests
with BLK_STS_NOSPC. Currently iblock treats bio status as a boolean and
terminates failed requests with LOGICAL UNIT COMMUNICATION FAILURE if
the status is non-zero. Thus, initiators see space allocation errors as
I/O errors.

This commit modifies the iblock_req structure to store the status of the
first failed bio instead of the total number of failed bios. The status
is then used to set the specific sense reason.

For BLK_STS_NOSPC the sense reason is set to TCM_SPACE_ALLOCATION_FAILED
as per SBC-3 4.7.3.6.

On Linux initiators:

old:

  $ dd if=/dev/zero of=/dev/sda oflag=direct bs=4k count=1
  dd: error writing '/dev/sda': I/O error

new:

  $ dd if=/dev/zero of=/dev/sda oflag=direct bs=4k count=1
  dd: error writing '/dev/sda': No space left on device

Signed-off-by: Konstantin Shelekhin <k.shelekhin@yadro.com>
Reviewed-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
---
 drivers/target/target_core_iblock.c | 24 ++++++++++++++++++++----
 drivers/target/target_core_iblock.h |  2 +-
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
index 4069a1edcfa3..b4c12584906b 100644
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c
@@ -305,20 +305,35 @@ static unsigned long long iblock_emulate_read_cap_with_block_size(
 	return blocks_long;
 }
 
+static sense_reason_t iblock_blk_status_to_reason(blk_status_t status)
+{
+       switch (status) {
+       case BLK_STS_OK:
+               return TCM_NO_SENSE;
+       case BLK_STS_NOSPC:
+               return TCM_SPACE_ALLOCATION_FAILED;
+       default:
+               return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
+       }
+}
+
 static void iblock_complete_cmd(struct se_cmd *cmd)
 {
 	struct iblock_req *ibr = cmd->priv;
 	u8 status;
+	sense_reason_t reason;
 
 	if (!refcount_dec_and_test(&ibr->pending))
 		return;
 
-	if (atomic_read(&ibr->ib_bio_err_cnt))
+	reason = iblock_blk_status_to_reason(atomic_read(&ibr->status));
+
+	if (reason != TCM_NO_SENSE)
 		status = SAM_STAT_CHECK_CONDITION;
 	else
 		status = SAM_STAT_GOOD;
 
-	target_complete_cmd(cmd, status);
+	target_complete_cmd_with_sense(cmd, status, reason);
 	kfree(ibr);
 }
 
@@ -330,9 +345,10 @@ static void iblock_bio_done(struct bio *bio)
 	if (bio->bi_status) {
 		pr_err("bio error: %p,  err: %d\n", bio, bio->bi_status);
 		/*
-		 * Bump the ib_bio_err_cnt and release bio.
+		 * Set the error status of the iblock request to the error
+		 * status of the first failed bio.
 		 */
-		atomic_inc(&ibr->ib_bio_err_cnt);
+		atomic_cmpxchg(&ibr->status, BLK_STS_OK, bio->bi_status);
 		smp_mb__after_atomic();
 	}
 
diff --git a/drivers/target/target_core_iblock.h b/drivers/target/target_core_iblock.h
index 8c55375d2f75..fda2e41b2e74 100644
--- a/drivers/target/target_core_iblock.h
+++ b/drivers/target/target_core_iblock.h
@@ -13,7 +13,7 @@
 
 struct iblock_req {
 	refcount_t pending;
-	atomic_t ib_bio_err_cnt;
+	atomic_t status;
 } ____cacheline_aligned;
 
 #define IBDF_HAS_UDEV_PATH		0x01
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] scsi: target: core: Add sense reason for space allocation errors
  2021-10-20 18:43 ` [PATCH 1/2] scsi: target: core: Add sense reason for " Konstantin Shelekhin
@ 2021-10-21  3:21   ` Martin K. Petersen
  2021-10-21  8:55     ` Konstantin Shelekhin
  0 siblings, 1 reply; 16+ messages in thread
From: Martin K. Petersen @ 2021-10-21  3:21 UTC (permalink / raw)
  To: Konstantin Shelekhin
  Cc: Martin Petersen, Mike Christie, target-devel, linux-scsi, linux,
	Dmitry Bogdanov


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?

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/2] scsi: target: core: Add sense reason for space allocation errors
  2021-10-21  3:21   ` Martin K. Petersen
@ 2021-10-21  8:55     ` Konstantin Shelekhin
  0 siblings, 0 replies; 16+ messages in thread
From: Konstantin Shelekhin @ 2021-10-21  8:55 UTC (permalink / raw)
  To: Martin K. Petersen
  Cc: Mike Christie, target-devel, linux-scsi, linux, Dmitry Bogdanov

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.

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/2] scsi: target: iblock: Report space allocation errors
  2021-10-20 18:43 ` [PATCH 2/2] scsi: target: iblock: Report " Konstantin Shelekhin
@ 2021-10-22  5:27     ` kernel test robot
  2021-11-08  9:59     ` kernel test robot
                       ` (3 subsequent siblings)
  4 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2021-10-22  5:27 UTC (permalink / raw)
  To: Konstantin Shelekhin, Martin Petersen, Mike Christie, target-devel
  Cc: kbuild-all, linux-scsi, linux, Konstantin Shelekhin, Dmitry Bogdanov

[-- Attachment #1: Type: text/plain, Size: 3463 bytes --]

Hi Konstantin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on v5.15-rc6 next-20211021]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Konstantin-Shelekhin/scsi-target-iblock-Report-space-allocation-errors/20211021-024526
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: i386-randconfig-s001-20211021 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://github.com/0day-ci/linux/commit/15d4d8f9601b04ee21f8f6042481828c4c34f6b7
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Konstantin-Shelekhin/scsi-target-iblock-Report-space-allocation-errors/20211021-024526
        git checkout 15d4d8f9601b04ee21f8f6042481828c4c34f6b7
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
>> drivers/target/target_core_iblock.c:329:57: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected restricted blk_status_t [usertype] status @@     got int @@
   drivers/target/target_core_iblock.c:329:57: sparse:     expected restricted blk_status_t [usertype] status
   drivers/target/target_core_iblock.c:329:57: sparse:     got int
>> drivers/target/target_core_iblock.c:351:61: sparse: sparse: incorrect type in argument 3 (different base types) @@     expected int new @@     got restricted blk_status_t [usertype] bi_status @@
   drivers/target/target_core_iblock.c:351:61: sparse:     expected int new
   drivers/target/target_core_iblock.c:351:61: sparse:     got restricted blk_status_t [usertype] bi_status

vim +329 drivers/target/target_core_iblock.c

   319	
   320	static void iblock_complete_cmd(struct se_cmd *cmd)
   321	{
   322		struct iblock_req *ibr = cmd->priv;
   323		u8 status;
   324		sense_reason_t reason;
   325	
   326		if (!refcount_dec_and_test(&ibr->pending))
   327			return;
   328	
 > 329		reason = iblock_blk_status_to_reason(atomic_read(&ibr->status));
   330	
   331		if (reason != TCM_NO_SENSE)
   332			status = SAM_STAT_CHECK_CONDITION;
   333		else
   334			status = SAM_STAT_GOOD;
   335	
   336		target_complete_cmd_with_sense(cmd, status, reason);
   337		kfree(ibr);
   338	}
   339	
   340	static void iblock_bio_done(struct bio *bio)
   341	{
   342		struct se_cmd *cmd = bio->bi_private;
   343		struct iblock_req *ibr = cmd->priv;
   344	
   345		if (bio->bi_status) {
   346			pr_err("bio error: %p,  err: %d\n", bio, bio->bi_status);
   347			/*
   348			 * Set the error status of the iblock request to the error
   349			 * status of the first failed bio.
   350			 */
 > 351			atomic_cmpxchg(&ibr->status, BLK_STS_OK, bio->bi_status);
   352			smp_mb__after_atomic();
   353		}
   354	
   355		bio_put(bio);
   356	
   357		iblock_complete_cmd(cmd);
   358	}
   359	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33974 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/2] scsi: target: iblock: Report space allocation errors
@ 2021-10-22  5:27     ` kernel test robot
  0 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2021-10-22  5:27 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3548 bytes --]

Hi Konstantin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on v5.15-rc6 next-20211021]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Konstantin-Shelekhin/scsi-target-iblock-Report-space-allocation-errors/20211021-024526
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: i386-randconfig-s001-20211021 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://github.com/0day-ci/linux/commit/15d4d8f9601b04ee21f8f6042481828c4c34f6b7
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Konstantin-Shelekhin/scsi-target-iblock-Report-space-allocation-errors/20211021-024526
        git checkout 15d4d8f9601b04ee21f8f6042481828c4c34f6b7
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
>> drivers/target/target_core_iblock.c:329:57: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected restricted blk_status_t [usertype] status @@     got int @@
   drivers/target/target_core_iblock.c:329:57: sparse:     expected restricted blk_status_t [usertype] status
   drivers/target/target_core_iblock.c:329:57: sparse:     got int
>> drivers/target/target_core_iblock.c:351:61: sparse: sparse: incorrect type in argument 3 (different base types) @@     expected int new @@     got restricted blk_status_t [usertype] bi_status @@
   drivers/target/target_core_iblock.c:351:61: sparse:     expected int new
   drivers/target/target_core_iblock.c:351:61: sparse:     got restricted blk_status_t [usertype] bi_status

vim +329 drivers/target/target_core_iblock.c

   319	
   320	static void iblock_complete_cmd(struct se_cmd *cmd)
   321	{
   322		struct iblock_req *ibr = cmd->priv;
   323		u8 status;
   324		sense_reason_t reason;
   325	
   326		if (!refcount_dec_and_test(&ibr->pending))
   327			return;
   328	
 > 329		reason = iblock_blk_status_to_reason(atomic_read(&ibr->status));
   330	
   331		if (reason != TCM_NO_SENSE)
   332			status = SAM_STAT_CHECK_CONDITION;
   333		else
   334			status = SAM_STAT_GOOD;
   335	
   336		target_complete_cmd_with_sense(cmd, status, reason);
   337		kfree(ibr);
   338	}
   339	
   340	static void iblock_bio_done(struct bio *bio)
   341	{
   342		struct se_cmd *cmd = bio->bi_private;
   343		struct iblock_req *ibr = cmd->priv;
   344	
   345		if (bio->bi_status) {
   346			pr_err("bio error: %p,  err: %d\n", bio, bio->bi_status);
   347			/*
   348			 * Set the error status of the iblock request to the error
   349			 * status of the first failed bio.
   350			 */
 > 351			atomic_cmpxchg(&ibr->status, BLK_STS_OK, bio->bi_status);
   352			smp_mb__after_atomic();
   353		}
   354	
   355		bio_put(bio);
   356	
   357		iblock_complete_cmd(cmd);
   358	}
   359	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 33974 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/2] scsi: target: iblock: Report space allocation errors
  2021-10-20 18:43 ` [PATCH 2/2] scsi: target: iblock: Report " Konstantin Shelekhin
@ 2021-11-08  9:59     ` kernel test robot
  2021-11-08  9:59     ` kernel test robot
                       ` (3 subsequent siblings)
  4 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2021-11-08  9:59 UTC (permalink / raw)
  To: Konstantin Shelekhin, Martin Petersen, Mike Christie, target-devel
  Cc: kbuild-all, linux-scsi, linux, Konstantin Shelekhin, Dmitry Bogdanov

[-- Attachment #1: Type: text/plain, Size: 3459 bytes --]

Hi Konstantin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on v5.15 next-20211108]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Konstantin-Shelekhin/scsi-target-iblock-Report-space-allocation-errors/20211021-024526
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: i386-randconfig-s001-20211021 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://github.com/0day-ci/linux/commit/15d4d8f9601b04ee21f8f6042481828c4c34f6b7
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Konstantin-Shelekhin/scsi-target-iblock-Report-space-allocation-errors/20211021-024526
        git checkout 15d4d8f9601b04ee21f8f6042481828c4c34f6b7
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
>> drivers/target/target_core_iblock.c:329:57: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected restricted blk_status_t [usertype] status @@     got int @@
   drivers/target/target_core_iblock.c:329:57: sparse:     expected restricted blk_status_t [usertype] status
   drivers/target/target_core_iblock.c:329:57: sparse:     got int
>> drivers/target/target_core_iblock.c:351:61: sparse: sparse: incorrect type in argument 3 (different base types) @@     expected int new @@     got restricted blk_status_t [usertype] bi_status @@
   drivers/target/target_core_iblock.c:351:61: sparse:     expected int new
   drivers/target/target_core_iblock.c:351:61: sparse:     got restricted blk_status_t [usertype] bi_status

vim +329 drivers/target/target_core_iblock.c

   319	
   320	static void iblock_complete_cmd(struct se_cmd *cmd)
   321	{
   322		struct iblock_req *ibr = cmd->priv;
   323		u8 status;
   324		sense_reason_t reason;
   325	
   326		if (!refcount_dec_and_test(&ibr->pending))
   327			return;
   328	
 > 329		reason = iblock_blk_status_to_reason(atomic_read(&ibr->status));
   330	
   331		if (reason != TCM_NO_SENSE)
   332			status = SAM_STAT_CHECK_CONDITION;
   333		else
   334			status = SAM_STAT_GOOD;
   335	
   336		target_complete_cmd_with_sense(cmd, status, reason);
   337		kfree(ibr);
   338	}
   339	
   340	static void iblock_bio_done(struct bio *bio)
   341	{
   342		struct se_cmd *cmd = bio->bi_private;
   343		struct iblock_req *ibr = cmd->priv;
   344	
   345		if (bio->bi_status) {
   346			pr_err("bio error: %p,  err: %d\n", bio, bio->bi_status);
   347			/*
   348			 * Set the error status of the iblock request to the error
   349			 * status of the first failed bio.
   350			 */
 > 351			atomic_cmpxchg(&ibr->status, BLK_STS_OK, bio->bi_status);
   352			smp_mb__after_atomic();
   353		}
   354	
   355		bio_put(bio);
   356	
   357		iblock_complete_cmd(cmd);
   358	}
   359	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33972 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/2] scsi: target: iblock: Report space allocation errors
@ 2021-11-08  9:59     ` kernel test robot
  0 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2021-11-08  9:59 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3544 bytes --]

Hi Konstantin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on v5.15 next-20211108]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Konstantin-Shelekhin/scsi-target-iblock-Report-space-allocation-errors/20211021-024526
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: i386-randconfig-s001-20211021 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://github.com/0day-ci/linux/commit/15d4d8f9601b04ee21f8f6042481828c4c34f6b7
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Konstantin-Shelekhin/scsi-target-iblock-Report-space-allocation-errors/20211021-024526
        git checkout 15d4d8f9601b04ee21f8f6042481828c4c34f6b7
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
>> drivers/target/target_core_iblock.c:329:57: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected restricted blk_status_t [usertype] status @@     got int @@
   drivers/target/target_core_iblock.c:329:57: sparse:     expected restricted blk_status_t [usertype] status
   drivers/target/target_core_iblock.c:329:57: sparse:     got int
>> drivers/target/target_core_iblock.c:351:61: sparse: sparse: incorrect type in argument 3 (different base types) @@     expected int new @@     got restricted blk_status_t [usertype] bi_status @@
   drivers/target/target_core_iblock.c:351:61: sparse:     expected int new
   drivers/target/target_core_iblock.c:351:61: sparse:     got restricted blk_status_t [usertype] bi_status

vim +329 drivers/target/target_core_iblock.c

   319	
   320	static void iblock_complete_cmd(struct se_cmd *cmd)
   321	{
   322		struct iblock_req *ibr = cmd->priv;
   323		u8 status;
   324		sense_reason_t reason;
   325	
   326		if (!refcount_dec_and_test(&ibr->pending))
   327			return;
   328	
 > 329		reason = iblock_blk_status_to_reason(atomic_read(&ibr->status));
   330	
   331		if (reason != TCM_NO_SENSE)
   332			status = SAM_STAT_CHECK_CONDITION;
   333		else
   334			status = SAM_STAT_GOOD;
   335	
   336		target_complete_cmd_with_sense(cmd, status, reason);
   337		kfree(ibr);
   338	}
   339	
   340	static void iblock_bio_done(struct bio *bio)
   341	{
   342		struct se_cmd *cmd = bio->bi_private;
   343		struct iblock_req *ibr = cmd->priv;
   344	
   345		if (bio->bi_status) {
   346			pr_err("bio error: %p,  err: %d\n", bio, bio->bi_status);
   347			/*
   348			 * Set the error status of the iblock request to the error
   349			 * status of the first failed bio.
   350			 */
 > 351			atomic_cmpxchg(&ibr->status, BLK_STS_OK, bio->bi_status);
   352			smp_mb__after_atomic();
   353		}
   354	
   355		bio_put(bio);
   356	
   357		iblock_complete_cmd(cmd);
   358	}
   359	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 33972 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/2] scsi: target: iblock: Report space allocation errors
  2021-10-20 18:43 ` [PATCH 2/2] scsi: target: iblock: Report " Konstantin Shelekhin
@ 2021-11-23 13:29     ` kernel test robot
  2021-11-08  9:59     ` kernel test robot
                       ` (3 subsequent siblings)
  4 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2021-11-23 13:29 UTC (permalink / raw)
  To: Konstantin Shelekhin, Martin Petersen, Mike Christie, target-devel
  Cc: kbuild-all, linux-scsi, linux, Konstantin Shelekhin, Dmitry Bogdanov

Hi Konstantin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on v5.16-rc2 next-20211123]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Konstantin-Shelekhin/scsi-target-iblock-Report-space-allocation-errors/20211021-024526
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: i386-randconfig-s001-20211021 (https://download.01.org/0day-ci/archive/20211123/202111232117.VwHDjjtU-lkp@intel.com/config.gz)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://github.com/0day-ci/linux/commit/15d4d8f9601b04ee21f8f6042481828c4c34f6b7
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Konstantin-Shelekhin/scsi-target-iblock-Report-space-allocation-errors/20211021-024526
        git checkout 15d4d8f9601b04ee21f8f6042481828c4c34f6b7
        # save the config file to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
>> drivers/target/target_core_iblock.c:329:57: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected restricted blk_status_t [usertype] status @@     got int @@
   drivers/target/target_core_iblock.c:329:57: sparse:     expected restricted blk_status_t [usertype] status
   drivers/target/target_core_iblock.c:329:57: sparse:     got int
>> drivers/target/target_core_iblock.c:351:61: sparse: sparse: incorrect type in argument 3 (different base types) @@     expected int new @@     got restricted blk_status_t [usertype] bi_status @@
   drivers/target/target_core_iblock.c:351:61: sparse:     expected int new
   drivers/target/target_core_iblock.c:351:61: sparse:     got restricted blk_status_t [usertype] bi_status

vim +329 drivers/target/target_core_iblock.c

   319	
   320	static void iblock_complete_cmd(struct se_cmd *cmd)
   321	{
   322		struct iblock_req *ibr = cmd->priv;
   323		u8 status;
   324		sense_reason_t reason;
   325	
   326		if (!refcount_dec_and_test(&ibr->pending))
   327			return;
   328	
 > 329		reason = iblock_blk_status_to_reason(atomic_read(&ibr->status));
   330	
   331		if (reason != TCM_NO_SENSE)
   332			status = SAM_STAT_CHECK_CONDITION;
   333		else
   334			status = SAM_STAT_GOOD;
   335	
   336		target_complete_cmd_with_sense(cmd, status, reason);
   337		kfree(ibr);
   338	}
   339	
   340	static void iblock_bio_done(struct bio *bio)
   341	{
   342		struct se_cmd *cmd = bio->bi_private;
   343		struct iblock_req *ibr = cmd->priv;
   344	
   345		if (bio->bi_status) {
   346			pr_err("bio error: %p,  err: %d\n", bio, bio->bi_status);
   347			/*
   348			 * Set the error status of the iblock request to the error
   349			 * status of the first failed bio.
   350			 */
 > 351			atomic_cmpxchg(&ibr->status, BLK_STS_OK, bio->bi_status);
   352			smp_mb__after_atomic();
   353		}
   354	
   355		bio_put(bio);
   356	
   357		iblock_complete_cmd(cmd);
   358	}
   359	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/2] scsi: target: iblock: Report space allocation errors
@ 2021-11-23 13:29     ` kernel test robot
  0 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2021-11-23 13:29 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3618 bytes --]

Hi Konstantin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on v5.16-rc2 next-20211123]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Konstantin-Shelekhin/scsi-target-iblock-Report-space-allocation-errors/20211021-024526
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: i386-randconfig-s001-20211021 (https://download.01.org/0day-ci/archive/20211123/202111232117.VwHDjjtU-lkp(a)intel.com/config.gz)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://github.com/0day-ci/linux/commit/15d4d8f9601b04ee21f8f6042481828c4c34f6b7
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Konstantin-Shelekhin/scsi-target-iblock-Report-space-allocation-errors/20211021-024526
        git checkout 15d4d8f9601b04ee21f8f6042481828c4c34f6b7
        # save the config file to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
>> drivers/target/target_core_iblock.c:329:57: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected restricted blk_status_t [usertype] status @@     got int @@
   drivers/target/target_core_iblock.c:329:57: sparse:     expected restricted blk_status_t [usertype] status
   drivers/target/target_core_iblock.c:329:57: sparse:     got int
>> drivers/target/target_core_iblock.c:351:61: sparse: sparse: incorrect type in argument 3 (different base types) @@     expected int new @@     got restricted blk_status_t [usertype] bi_status @@
   drivers/target/target_core_iblock.c:351:61: sparse:     expected int new
   drivers/target/target_core_iblock.c:351:61: sparse:     got restricted blk_status_t [usertype] bi_status

vim +329 drivers/target/target_core_iblock.c

   319	
   320	static void iblock_complete_cmd(struct se_cmd *cmd)
   321	{
   322		struct iblock_req *ibr = cmd->priv;
   323		u8 status;
   324		sense_reason_t reason;
   325	
   326		if (!refcount_dec_and_test(&ibr->pending))
   327			return;
   328	
 > 329		reason = iblock_blk_status_to_reason(atomic_read(&ibr->status));
   330	
   331		if (reason != TCM_NO_SENSE)
   332			status = SAM_STAT_CHECK_CONDITION;
   333		else
   334			status = SAM_STAT_GOOD;
   335	
   336		target_complete_cmd_with_sense(cmd, status, reason);
   337		kfree(ibr);
   338	}
   339	
   340	static void iblock_bio_done(struct bio *bio)
   341	{
   342		struct se_cmd *cmd = bio->bi_private;
   343		struct iblock_req *ibr = cmd->priv;
   344	
   345		if (bio->bi_status) {
   346			pr_err("bio error: %p,  err: %d\n", bio, bio->bi_status);
   347			/*
   348			 * Set the error status of the iblock request to the error
   349			 * status of the first failed bio.
   350			 */
 > 351			atomic_cmpxchg(&ibr->status, BLK_STS_OK, bio->bi_status);
   352			smp_mb__after_atomic();
   353		}
   354	
   355		bio_put(bio);
   356	
   357		iblock_complete_cmd(cmd);
   358	}
   359	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/2] scsi: target: iblock: Report space allocation errors
  2021-10-20 18:43 ` [PATCH 2/2] scsi: target: iblock: Report " Konstantin Shelekhin
@ 2021-11-25  2:36     ` kernel test robot
  2021-11-08  9:59     ` kernel test robot
                       ` (3 subsequent siblings)
  4 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2021-11-25  2:36 UTC (permalink / raw)
  To: Konstantin Shelekhin, Martin Petersen, Mike Christie, target-devel
  Cc: kbuild-all, linux-scsi, linux, Konstantin Shelekhin, Dmitry Bogdanov

Hi Konstantin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on v5.16-rc2 next-20211124]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Konstantin-Shelekhin/scsi-target-iblock-Report-space-allocation-errors/20211021-024526
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: i386-randconfig-s001-20211021 (https://download.01.org/0day-ci/archive/20211125/202111251031.jac0fCTW-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://github.com/0day-ci/linux/commit/15d4d8f9601b04ee21f8f6042481828c4c34f6b7
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Konstantin-Shelekhin/scsi-target-iblock-Report-space-allocation-errors/20211021-024526
        git checkout 15d4d8f9601b04ee21f8f6042481828c4c34f6b7
        # save the config file to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
>> drivers/target/target_core_iblock.c:329:57: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected restricted blk_status_t [usertype] status @@     got int @@
   drivers/target/target_core_iblock.c:329:57: sparse:     expected restricted blk_status_t [usertype] status
   drivers/target/target_core_iblock.c:329:57: sparse:     got int
>> drivers/target/target_core_iblock.c:351:61: sparse: sparse: incorrect type in argument 3 (different base types) @@     expected int new @@     got restricted blk_status_t [usertype] bi_status @@
   drivers/target/target_core_iblock.c:351:61: sparse:     expected int new
   drivers/target/target_core_iblock.c:351:61: sparse:     got restricted blk_status_t [usertype] bi_status

vim +329 drivers/target/target_core_iblock.c

   319	
   320	static void iblock_complete_cmd(struct se_cmd *cmd)
   321	{
   322		struct iblock_req *ibr = cmd->priv;
   323		u8 status;
   324		sense_reason_t reason;
   325	
   326		if (!refcount_dec_and_test(&ibr->pending))
   327			return;
   328	
 > 329		reason = iblock_blk_status_to_reason(atomic_read(&ibr->status));
   330	
   331		if (reason != TCM_NO_SENSE)
   332			status = SAM_STAT_CHECK_CONDITION;
   333		else
   334			status = SAM_STAT_GOOD;
   335	
   336		target_complete_cmd_with_sense(cmd, status, reason);
   337		kfree(ibr);
   338	}
   339	
   340	static void iblock_bio_done(struct bio *bio)
   341	{
   342		struct se_cmd *cmd = bio->bi_private;
   343		struct iblock_req *ibr = cmd->priv;
   344	
   345		if (bio->bi_status) {
   346			pr_err("bio error: %p,  err: %d\n", bio, bio->bi_status);
   347			/*
   348			 * Set the error status of the iblock request to the error
   349			 * status of the first failed bio.
   350			 */
 > 351			atomic_cmpxchg(&ibr->status, BLK_STS_OK, bio->bi_status);
   352			smp_mb__after_atomic();
   353		}
   354	
   355		bio_put(bio);
   356	
   357		iblock_complete_cmd(cmd);
   358	}
   359	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/2] scsi: target: iblock: Report space allocation errors
@ 2021-11-25  2:36     ` kernel test robot
  0 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2021-11-25  2:36 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3615 bytes --]

Hi Konstantin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on v5.16-rc2 next-20211124]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Konstantin-Shelekhin/scsi-target-iblock-Report-space-allocation-errors/20211021-024526
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: i386-randconfig-s001-20211021 (https://download.01.org/0day-ci/archive/20211125/202111251031.jac0fCTW-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://github.com/0day-ci/linux/commit/15d4d8f9601b04ee21f8f6042481828c4c34f6b7
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Konstantin-Shelekhin/scsi-target-iblock-Report-space-allocation-errors/20211021-024526
        git checkout 15d4d8f9601b04ee21f8f6042481828c4c34f6b7
        # save the config file to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
>> drivers/target/target_core_iblock.c:329:57: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected restricted blk_status_t [usertype] status @@     got int @@
   drivers/target/target_core_iblock.c:329:57: sparse:     expected restricted blk_status_t [usertype] status
   drivers/target/target_core_iblock.c:329:57: sparse:     got int
>> drivers/target/target_core_iblock.c:351:61: sparse: sparse: incorrect type in argument 3 (different base types) @@     expected int new @@     got restricted blk_status_t [usertype] bi_status @@
   drivers/target/target_core_iblock.c:351:61: sparse:     expected int new
   drivers/target/target_core_iblock.c:351:61: sparse:     got restricted blk_status_t [usertype] bi_status

vim +329 drivers/target/target_core_iblock.c

   319	
   320	static void iblock_complete_cmd(struct se_cmd *cmd)
   321	{
   322		struct iblock_req *ibr = cmd->priv;
   323		u8 status;
   324		sense_reason_t reason;
   325	
   326		if (!refcount_dec_and_test(&ibr->pending))
   327			return;
   328	
 > 329		reason = iblock_blk_status_to_reason(atomic_read(&ibr->status));
   330	
   331		if (reason != TCM_NO_SENSE)
   332			status = SAM_STAT_CHECK_CONDITION;
   333		else
   334			status = SAM_STAT_GOOD;
   335	
   336		target_complete_cmd_with_sense(cmd, status, reason);
   337		kfree(ibr);
   338	}
   339	
   340	static void iblock_bio_done(struct bio *bio)
   341	{
   342		struct se_cmd *cmd = bio->bi_private;
   343		struct iblock_req *ibr = cmd->priv;
   344	
   345		if (bio->bi_status) {
   346			pr_err("bio error: %p,  err: %d\n", bio, bio->bi_status);
   347			/*
   348			 * Set the error status of the iblock request to the error
   349			 * status of the first failed bio.
   350			 */
 > 351			atomic_cmpxchg(&ibr->status, BLK_STS_OK, bio->bi_status);
   352			smp_mb__after_atomic();
   353		}
   354	
   355		bio_put(bio);
   356	
   357		iblock_complete_cmd(cmd);
   358	}
   359	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/2] scsi: target: iblock: Report space allocation errors
  2021-10-20 18:43 ` [PATCH 2/2] scsi: target: iblock: Report " Konstantin Shelekhin
@ 2021-11-25  7:26     ` kernel test robot
  2021-11-08  9:59     ` kernel test robot
                       ` (3 subsequent siblings)
  4 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2021-11-25  7:26 UTC (permalink / raw)
  To: Konstantin Shelekhin, Martin Petersen, Mike Christie, target-devel
  Cc: kbuild-all, linux-scsi, linux, Konstantin Shelekhin, Dmitry Bogdanov

Hi Konstantin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on v5.16-rc2 next-20211125]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Konstantin-Shelekhin/scsi-target-iblock-Report-space-allocation-errors/20211021-024526
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: i386-randconfig-s001-20211021 (https://download.01.org/0day-ci/archive/20211125/202111251517.Xys8GZym-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://github.com/0day-ci/linux/commit/15d4d8f9601b04ee21f8f6042481828c4c34f6b7
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Konstantin-Shelekhin/scsi-target-iblock-Report-space-allocation-errors/20211021-024526
        git checkout 15d4d8f9601b04ee21f8f6042481828c4c34f6b7
        # save the config file to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
>> drivers/target/target_core_iblock.c:329:57: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected restricted blk_status_t [usertype] status @@     got int @@
   drivers/target/target_core_iblock.c:329:57: sparse:     expected restricted blk_status_t [usertype] status
   drivers/target/target_core_iblock.c:329:57: sparse:     got int
>> drivers/target/target_core_iblock.c:351:61: sparse: sparse: incorrect type in argument 3 (different base types) @@     expected int new @@     got restricted blk_status_t [usertype] bi_status @@
   drivers/target/target_core_iblock.c:351:61: sparse:     expected int new
   drivers/target/target_core_iblock.c:351:61: sparse:     got restricted blk_status_t [usertype] bi_status

vim +329 drivers/target/target_core_iblock.c

   319	
   320	static void iblock_complete_cmd(struct se_cmd *cmd)
   321	{
   322		struct iblock_req *ibr = cmd->priv;
   323		u8 status;
   324		sense_reason_t reason;
   325	
   326		if (!refcount_dec_and_test(&ibr->pending))
   327			return;
   328	
 > 329		reason = iblock_blk_status_to_reason(atomic_read(&ibr->status));
   330	
   331		if (reason != TCM_NO_SENSE)
   332			status = SAM_STAT_CHECK_CONDITION;
   333		else
   334			status = SAM_STAT_GOOD;
   335	
   336		target_complete_cmd_with_sense(cmd, status, reason);
   337		kfree(ibr);
   338	}
   339	
   340	static void iblock_bio_done(struct bio *bio)
   341	{
   342		struct se_cmd *cmd = bio->bi_private;
   343		struct iblock_req *ibr = cmd->priv;
   344	
   345		if (bio->bi_status) {
   346			pr_err("bio error: %p,  err: %d\n", bio, bio->bi_status);
   347			/*
   348			 * Set the error status of the iblock request to the error
   349			 * status of the first failed bio.
   350			 */
 > 351			atomic_cmpxchg(&ibr->status, BLK_STS_OK, bio->bi_status);
   352			smp_mb__after_atomic();
   353		}
   354	
   355		bio_put(bio);
   356	
   357		iblock_complete_cmd(cmd);
   358	}
   359	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/2] scsi: target: iblock: Report space allocation errors
@ 2021-11-25  7:26     ` kernel test robot
  0 siblings, 0 replies; 16+ messages in thread
From: kernel test robot @ 2021-11-25  7:26 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3615 bytes --]

Hi Konstantin,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on v5.16-rc2 next-20211125]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Konstantin-Shelekhin/scsi-target-iblock-Report-space-allocation-errors/20211021-024526
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: i386-randconfig-s001-20211021 (https://download.01.org/0day-ci/archive/20211125/202111251517.Xys8GZym-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://github.com/0day-ci/linux/commit/15d4d8f9601b04ee21f8f6042481828c4c34f6b7
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Konstantin-Shelekhin/scsi-target-iblock-Report-space-allocation-errors/20211021-024526
        git checkout 15d4d8f9601b04ee21f8f6042481828c4c34f6b7
        # save the config file to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
>> drivers/target/target_core_iblock.c:329:57: sparse: sparse: incorrect type in argument 1 (different base types) @@     expected restricted blk_status_t [usertype] status @@     got int @@
   drivers/target/target_core_iblock.c:329:57: sparse:     expected restricted blk_status_t [usertype] status
   drivers/target/target_core_iblock.c:329:57: sparse:     got int
>> drivers/target/target_core_iblock.c:351:61: sparse: sparse: incorrect type in argument 3 (different base types) @@     expected int new @@     got restricted blk_status_t [usertype] bi_status @@
   drivers/target/target_core_iblock.c:351:61: sparse:     expected int new
   drivers/target/target_core_iblock.c:351:61: sparse:     got restricted blk_status_t [usertype] bi_status

vim +329 drivers/target/target_core_iblock.c

   319	
   320	static void iblock_complete_cmd(struct se_cmd *cmd)
   321	{
   322		struct iblock_req *ibr = cmd->priv;
   323		u8 status;
   324		sense_reason_t reason;
   325	
   326		if (!refcount_dec_and_test(&ibr->pending))
   327			return;
   328	
 > 329		reason = iblock_blk_status_to_reason(atomic_read(&ibr->status));
   330	
   331		if (reason != TCM_NO_SENSE)
   332			status = SAM_STAT_CHECK_CONDITION;
   333		else
   334			status = SAM_STAT_GOOD;
   335	
   336		target_complete_cmd_with_sense(cmd, status, reason);
   337		kfree(ibr);
   338	}
   339	
   340	static void iblock_bio_done(struct bio *bio)
   341	{
   342		struct se_cmd *cmd = bio->bi_private;
   343		struct iblock_req *ibr = cmd->priv;
   344	
   345		if (bio->bi_status) {
   346			pr_err("bio error: %p,  err: %d\n", bio, bio->bi_status);
   347			/*
   348			 * Set the error status of the iblock request to the error
   349			 * status of the first failed bio.
   350			 */
 > 351			atomic_cmpxchg(&ibr->status, BLK_STS_OK, bio->bi_status);
   352			smp_mb__after_atomic();
   353		}
   354	
   355		bio_put(bio);
   356	
   357		iblock_complete_cmd(cmd);
   358	}
   359	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/2] scsi: target: core: Add sense reason for space allocation errors
  2023-05-17 14:15 [PATCH 0/2] " Konstantin Shelekhin
@ 2023-05-17 14:15 ` Konstantin Shelekhin
  0 siblings, 0 replies; 16+ messages in thread
From: Konstantin Shelekhin @ 2023-05-17 14:15 UTC (permalink / raw)
  To: Martin Petersen
  Cc: target-devel, linux-scsi, linux, Konstantin Shelekhin, Dmitry Bogdanov

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.

Signed-off-by: Konstantin Shelekhin <k.shelekhin@yadro.com>
Reviewed-by: Dmitry Bogdanov <d.bogdanov@yadro.com>
---
 drivers/target/target_core_transport.c | 6 ++++++
 include/target/target_core_base.h      | 1 +
 2 files changed, 7 insertions(+)

diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index 86adff2a86ed..9b41d2d78e98 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -2072,6 +2072,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;
@@ -3474,6 +3475,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 5f8e96f1516f..aac475a9184e 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -194,6 +194,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
 };
 
-- 
2.40.1



^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-05-17 14:16 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-20 18:43 [PATCH 0/2] scsi: target: iblock: Report space allocation errors Konstantin Shelekhin
2021-10-20 18:43 ` [PATCH 1/2] scsi: target: core: Add sense reason for " Konstantin Shelekhin
2021-10-21  3:21   ` Martin K. Petersen
2021-10-21  8:55     ` Konstantin Shelekhin
2021-10-20 18:43 ` [PATCH 2/2] scsi: target: iblock: Report " Konstantin Shelekhin
2021-10-22  5:27   ` kernel test robot
2021-10-22  5:27     ` kernel test robot
2021-11-08  9:59   ` kernel test robot
2021-11-08  9:59     ` kernel test robot
2021-11-23 13:29   ` kernel test robot
2021-11-23 13:29     ` kernel test robot
2021-11-25  2:36   ` kernel test robot
2021-11-25  2:36     ` kernel test robot
2021-11-25  7:26   ` kernel test robot
2021-11-25  7:26     ` kernel test robot
2023-05-17 14:15 [PATCH 0/2] " Konstantin Shelekhin
2023-05-17 14:15 ` [PATCH 1/2] scsi: target: core: Add sense reason for " Konstantin Shelekhin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.