Bufflen can be changed after scst_get_cdb_info(), so for bufflen = 0 data_direction...
authorvlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Tue, 3 Mar 2009 17:04:12 +0000 (17:04 +0000)
committervlnb <vlnb@d57e44dd-8a1f-0410-8b47-8ef2f437770f>
Tue, 3 Mar 2009 17:04:12 +0000 (17:04 +0000)
git-svn-id: https://scst.svn.sourceforge.net/svnroot/scst/trunk@683 d57e44dd-8a1f-0410-8b47-8ef2f437770f

scst/src/scst_lib.c
scst/src/scst_targ.c

index 5d6a800..bf8d0d2 100644 (file)
@@ -2020,14 +2020,6 @@ int scst_get_cdb_info(struct scst_cmd *cmd)
        cmd->op_flags = ptr->flags;
        res = (*ptr->get_trans_len)(cmd, ptr->off);
 
-       if (cmd->bufflen == 0) {
-               /*
-                * According to SPC bufflen 0 for data transfer commands isn't
-                * an error, so we need to fix the transfer direction.
-                */
-               cmd->data_direction = SCST_DATA_NONE;
-       }
-
 out:
        TRACE_EXIT();
        return res;
index 17daad9..b4c4e48 100644 (file)
@@ -526,6 +526,14 @@ static int scst_parse_cmd(struct scst_cmd *cmd)
        if (cmd->data_len == -1)
                cmd->data_len = cmd->bufflen;
 
+       if (cmd->bufflen == 0) {
+               /*
+                * According to SPC bufflen 0 for data transfer commands isn't
+                * an error, so we need to fix the transfer direction.
+                */
+               cmd->data_direction = SCST_DATA_NONE;
+       }
+
        if (cmd->dh_data_buf_alloced &&
            unlikely((orig_bufflen > cmd->bufflen))) {
                PRINT_ERROR("Dev handler supplied data buffer (size %d), "