|
From: <vl...@us...> - 2013-10-02 04:53:15
|
Revision: 5014
http://sourceforge.net/p/scst/svn/5014
Author: vlnb
Date: 2013-10-02 04:53:12 +0000 (Wed, 02 Oct 2013)
Log Message:
-----------
Change write residual underflow handling
Now it writes only supplied amount of data.
Reported by Klaus Hochlehnert <Mai...@kh...>
Modified Paths:
--------------
trunk/scst/src/scst_targ.c
Modified: trunk/scst/src/scst_targ.c
===================================================================
--- trunk/scst/src/scst_targ.c 2013-10-01 06:21:38 UTC (rev 5013)
+++ trunk/scst/src/scst_targ.c 2013-10-02 04:53:12 UTC (rev 5014)
@@ -1588,19 +1588,23 @@
if (unlikely(cmd->resid_possible)) {
if (cmd->data_direction & SCST_DATA_WRITE) {
- bool do_zero = false;
+ bool remainder = false;
if (cmd->data_direction & SCST_DATA_READ) {
if (cmd->write_len != cmd->out_bufflen)
- do_zero = true;
+ remainder = true;
} else {
if (cmd->write_len != cmd->bufflen)
- do_zero = true;
+ remainder = true;
}
- if (do_zero) {
+ if (remainder) {
if (!(cmd->op_flags & SCST_TRANSFER_LEN_TYPE_FIXED) ||
(cmd->write_len & ((1 << cmd->dev->block_shift) - 1)) == 0) {
+#if 0 /* dangerous, because can override valid data by zeros */
scst_check_restore_sg_buff(cmd);
scst_zero_write_rest(cmd);
+#else
+ /* do nothing */
+#endif
} else {
/*
* Looks like it's safer in this case to
@@ -3109,6 +3113,8 @@
cmd->sense = NULL;
scst_check_restore_sg_buff(cmd);
+ if (cmd->data_direction & SCST_DATA_WRITE)
+ scst_set_write_len(cmd);
sBUG_ON(cmd->dbl_ua_orig_resp_data_len < 0);
cmd->data_direction =
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|