All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bart.vanassche@sandisk.com>
To: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: <target-devel@vger.kernel.org>,
	Bart Van Assche <bart.vanassche@sandisk.com>,
	Hannes Reinecke <hare@suse.com>, "Christoph Hellwig" <hch@lst.de>,
	Andy Grover <agrover@redhat.com>,
	David Disseldorp <ddiss@suse.de>, <stable@vger.kernel.org>
Subject: [PATCH 04/19] target/fileio: Avoid that zero-length READ and WRITE commands hang
Date: Thu, 4 May 2017 15:50:47 -0700	[thread overview]
Message-ID: <20170504225102.8931-5-bart.vanassche@sandisk.com> (raw)
In-Reply-To: <20170504225102.8931-1-bart.vanassche@sandisk.com>

>From __target_execute_cmd() (simplified):

	ret = cmd->execute_cmd(cmd);
	if (ret != 0)
		transport_generic_request_failure(cmd, ret);

>From sbc_execute_rw():

	return ops->execute_rw(cmd, cmd->t_data_sg, cmd->t_data_nents,
			       cmd->data_direction);

This means that sbc_ops.execute_rw() must either return a non-zero
value or call target_complete_cmd() and return zero or command
execution stalls. Make sure that fd_execute_rw() calls
target_complete_cmd() even for zero-length commands.

Fixes: commit c66ac9db8d4a ("[SCSI] target: Add LIO target core v4.0.0-rc6")
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Andy Grover <agrover@redhat.com>
Cc: David Disseldorp <ddiss@suse.de>
Cc: <stable@vger.kernel.org>
---
 drivers/target/target_core_file.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
index 1bf6c31e4c21..73b8f93a5fef 100644
--- a/drivers/target/target_core_file.c
+++ b/drivers/target/target_core_file.c
@@ -608,8 +608,7 @@ fd_execute_rw(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
 	if (ret < 0)
 		return TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
 
-	if (ret)
-		target_complete_cmd(cmd, SAM_STAT_GOOD);
+	target_complete_cmd(cmd, SAM_STAT_GOOD);
 	return 0;
 }
 
-- 
2.12.2

  parent reply	other threads:[~2017-05-04 22:51 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170504225102.8931-1-bart.vanassche@sandisk.com>
2017-05-04 22:50 ` [PATCH 03/19] target: Avoid that aborting a command sporadically hangs Bart Van Assche
2017-05-05  6:12   ` Hannes Reinecke
2017-05-05  8:53   ` Christoph Hellwig
2017-05-05 15:00     ` Bart Van Assche
2017-05-11  0:23     ` Bart Van Assche
2017-05-07 22:20   ` Nicholas A. Bellinger
2017-05-08 21:25     ` Bart Van Assche
2017-05-10  4:48       ` Nicholas A. Bellinger
2017-05-04 22:50 ` Bart Van Assche [this message]
2017-05-05  6:14   ` [PATCH 04/19] target/fileio: Avoid that zero-length READ and WRITE commands hang Hannes Reinecke
2017-05-05  8:54   ` Christoph Hellwig
2017-05-07 22:28   ` Nicholas A. Bellinger
2017-05-04 22:50 ` [PATCH 05/19] target: Allocate sg-list correctly Bart Van Assche
2017-05-05  6:15   ` Hannes Reinecke
2017-05-05  9:06   ` Christoph Hellwig
2017-05-05 15:49     ` Bart Van Assche
2017-05-07 22:45   ` Nicholas A. Bellinger
2017-05-08 17:46     ` Bart Van Assche
2017-05-10  4:03       ` Nicholas A. Bellinger
2017-05-10  6:12         ` Nicholas A. Bellinger
2017-05-10 20:31         ` Bart Van Assche
2017-05-11  5:28           ` Nicholas A. Bellinger
2017-05-04 22:50 ` [PATCH 06/19] target: Fix data buffer size for VERIFY and WRITE AND VERIFY commands Bart Van Assche
2017-05-05  9:42   ` Christoph Hellwig
2017-05-05 15:51     ` Bart Van Assche
2017-05-07 22:49   ` Nicholas A. Bellinger
2017-05-08 18:07     ` Bart Van Assche
2017-05-10  4:28       ` Nicholas A. Bellinger
2017-05-10 15:16         ` Bart Van Assche
2017-05-11  5:09           ` Nicholas A. Bellinger
2017-05-04 22:51 ` [PATCH 17/19] target/iscsi: Simplify timer manipulation code Bart Van Assche
2017-05-05 11:24   ` Hannes Reinecke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170504225102.8931-5-bart.vanassche@sandisk.com \
    --to=bart.vanassche@sandisk.com \
    --cc=agrover@redhat.com \
    --cc=ddiss@suse.de \
    --cc=hare@suse.com \
    --cc=hch@lst.de \
    --cc=nab@linux-iscsi.org \
    --cc=stable@vger.kernel.org \
    --cc=target-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.