Skip to content

Commit

Permalink
target: Fix WRITE_SAME usage with transport_get_size
Browse files Browse the repository at this point in the history
For all flavours of WRITE_SAME, we only expect to handle a single block
of data-out buffer payload, regardless of the number of logical blocks
presented in the CDB.  This patch changes all flavours of WRITE_SAME in
transport_generic_cmd_sequencer() to pass '1' into transport_get_size()
instead of the extracted 'sectors' to properly handle the default usage
of sg_write_same without the --xferlen parameter.

Reported-by: Eric Seppanen <eric@purestorage.com>
Signed-off-by: Nicholas Bellinger <nab@risingtidesystems.com>
  • Loading branch information
Nicholas Bellinger committed Aug 22, 2011
1 parent 706d586 commit 1285062
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/target/target_core_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -3103,7 +3103,7 @@ static int transport_generic_cmd_sequencer(
goto out_unsupported_cdb;

if (sectors)
size = transport_get_size(sectors, cdb, cmd);
size = transport_get_size(1, cdb, cmd);
else {
pr_err("WSNZ=1, WRITE_SAME w/sectors=0 not"
" supported\n");
Expand Down Expand Up @@ -3365,7 +3365,7 @@ static int transport_generic_cmd_sequencer(
goto out_unsupported_cdb;

if (sectors)
size = transport_get_size(sectors, cdb, cmd);
size = transport_get_size(1, cdb, cmd);
else {
pr_err("WSNZ=1, WRITE_SAME w/sectors=0 not supported\n");
goto out_invalid_cdb_field;
Expand All @@ -3383,7 +3383,7 @@ static int transport_generic_cmd_sequencer(
goto out_unsupported_cdb;

if (sectors)
size = transport_get_size(sectors, cdb, cmd);
size = transport_get_size(1, cdb, cmd);
else {
pr_err("WSNZ=1, WRITE_SAME w/sectors=0 not supported\n");
goto out_invalid_cdb_field;
Expand Down

0 comments on commit 1285062

Please sign in to comment.