[Stgt-devel] [PATCH] bidi quiet warning
Pete Wyckoff
pw
Tue Sep 4 22:03:51 CEST 2007
Always zero out task->len for write commands. They do not send data
back to the initiator. For reads and bidirectional commands, the backing
store will set task->len to the read result size, which must be within
the size the initiator requested at the transport layer.
Signed-off-by: Pete Wyckoff <pw at osc.edu>
---
usr/iscsi/iscsid.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/usr/iscsi/iscsid.c b/usr/iscsi/iscsid.c
index 079c878..41d5cad 100644
--- a/usr/iscsi/iscsid.c
+++ b/usr/iscsi/iscsid.c
@@ -1034,9 +1034,11 @@ static int iscsi_scsi_cmd_done(uint64_t nid, int result, struct scsi_cmd *scmd)
task->len = scmd->len;
task->rw = scmd->rw;
- if (task->len > task->read_len) {
- dprintf("shrinking target len %d to initiator len %d\n",
- task->len, task->read_len);
+ if (task->dir == WRITE)
+ task->len = 0; /* no read result */
+ else if (task->len > task->read_len) {
+ dprintf("shrunk too big device read len %d > %u\n",
+ task->len, task->read_len);
task->len = task->read_len;
}
--
1.5.2.5
More information about the stgt
mailing list