linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] target: Return an error for WRITE SAME with ANCHOR==1
@ 2013-10-14 22:49 Roland Dreier
  2013-10-16 20:50 ` Nicholas A. Bellinger
  0 siblings, 1 reply; 2+ messages in thread
From: Roland Dreier @ 2013-10-14 22:49 UTC (permalink / raw)
  To: Nicholas A. Bellinger; +Cc: target-devel, linux-scsi, Roland Dreier

From: Roland Dreier <roland@purestorage.com>

Per SBC-3, since we report ANC_SUP==0 in VPD page B2h, we need to return
an error (ILLEGAL REQUEST/INVALID FIELD IN CDB) for all WRITE SAME
requests with ANCHOR==1.

Signed-off-by: Roland Dreier <roland@purestorage.com>
---
 drivers/target/target_core_sbc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c
index 4714c6f8da4b..d9b92b2c524d 100644
--- a/drivers/target/target_core_sbc.c
+++ b/drivers/target/target_core_sbc.c
@@ -263,6 +263,11 @@ sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *o
 			sectors, cmd->se_dev->dev_attrib.max_write_same_len);
 		return TCM_INVALID_CDB_FIELD;
 	}
+	/* We always have ANC_SUP == 0 so setting ANCHOR is always an error */
+	if (flags[0] & 0x10) {
+		pr_warn("WRITE SAME with ANCHOR not supported\n");
+		return TCM_INVALID_CDB_FIELD;
+	}
 	/*
 	 * Special case for WRITE_SAME w/ UNMAP=1 that ends up getting
 	 * translated into block discard requests within backend code.
-- 
1.8.3.2

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

* Re: [PATCH] target: Return an error for WRITE SAME with ANCHOR==1
  2013-10-14 22:49 [PATCH] target: Return an error for WRITE SAME with ANCHOR==1 Roland Dreier
@ 2013-10-16 20:50 ` Nicholas A. Bellinger
  0 siblings, 0 replies; 2+ messages in thread
From: Nicholas A. Bellinger @ 2013-10-16 20:50 UTC (permalink / raw)
  To: Roland Dreier; +Cc: target-devel, linux-scsi, Roland Dreier

On Mon, 2013-10-14 at 15:49 -0700, Roland Dreier wrote:
> From: Roland Dreier <roland@purestorage.com>
> 
> Per SBC-3, since we report ANC_SUP==0 in VPD page B2h, we need to return
> an error (ILLEGAL REQUEST/INVALID FIELD IN CDB) for all WRITE SAME
> requests with ANCHOR==1.
> 
> Signed-off-by: Roland Dreier <roland@purestorage.com>

Applied to target-pending/master.

Thanks Roland!

--nab

> ---
>  drivers/target/target_core_sbc.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c
> index 4714c6f8da4b..d9b92b2c524d 100644
> --- a/drivers/target/target_core_sbc.c
> +++ b/drivers/target/target_core_sbc.c
> @@ -263,6 +263,11 @@ sbc_setup_write_same(struct se_cmd *cmd, unsigned char *flags, struct sbc_ops *o
>  			sectors, cmd->se_dev->dev_attrib.max_write_same_len);
>  		return TCM_INVALID_CDB_FIELD;
>  	}
> +	/* We always have ANC_SUP == 0 so setting ANCHOR is always an error */
> +	if (flags[0] & 0x10) {
> +		pr_warn("WRITE SAME with ANCHOR not supported\n");
> +		return TCM_INVALID_CDB_FIELD;
> +	}
>  	/*
>  	 * Special case for WRITE_SAME w/ UNMAP=1 that ends up getting
>  	 * translated into block discard requests within backend code.



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

end of thread, other threads:[~2013-10-16 20:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-14 22:49 [PATCH] target: Return an error for WRITE SAME with ANCHOR==1 Roland Dreier
2013-10-16 20:50 ` Nicholas A. Bellinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).