Avoid that unknown parameters cause __vdev_load_mode_pages() to
return 0 instead of -EINVAL. Detected by Coverity.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
The bio request type must be set before bio_add_page() is invoked.
See e.g. raid5_mergeable_bvec() for an example of a function that
checks (bi_rw & REQ_WRITE) from inside the bio_add_page() call.
This patch improves performance when using SCST on top of RAID5.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Logically and negative allowed_portal conditions instead of
or-ing these. If both positive and negative conditions match,
the negative condition takes precedence.
This was proposed by Sergej Roytman <spocks.goatee@gmail.com>.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Some storage devices have a block size of 512 bytes and a minimum
I/O size and/or optimal I/O size of 4096 bytes. Improve WRITE SAME
performance for such devices by increasing the I/O granularity from
512 bytes to 4096 bytes.
Based on a patch written by Vishal Tripathi <vishal.tripathi@calsoftinc.com>
and Sushil Sharma <sushil.sharma@calsoftinc.com>.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
The scst_block_generic_dev_done() function parses the READ CAPACITY
response. Add support for parsing the READ CAPACITY(16) response.
Additionally, add a check whether the response buffer is big enough
to hold the sector size.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
The scst_block_generic_dev_done() function parses the READ CAPACITY
response without checking whether the response buffer contains
valid data. This can lead to incorrect block size changes and also
to the following kernel warning:
WARNING: at scst/src/scst_lib.c:7353 scst_calc_block_shift+0x7f/0xb0 [scst]()
1 << 23 != 12595456
[<ffffffff816071e3>] dump_stack+0x19/0x1b
[<ffffffff8106e23d>] warn_slowpath_common+0x7d/0xc0
[<ffffffff8106e336>] warn_slowpath_fmt+0x46/0x50
[<ffffffffa0712e2f>] scst_calc_block_shift+0x7f/0xb0 [scst]
[<ffffffffa072dbd7>] scst_block_generic_dev_done.part.39+0x6a/0x7d [scst]
[<ffffffffa07162a4>] scst_block_generic_dev_done+0x34/0x40 [scst]
[<ffffffffa0066205>] dev_user_disk_done+0x15/0x20 [scst_user]
[<ffffffffa070c119>] scst_dev_done+0x49/0x150 [scst]
[<ffffffffa070e1a0>] scst_process_active_cmd+0x240/0x390 [scst]
[<ffffffffa070e7e1>] scst_process_redirect_cmd+0x121/0x1e0 [scst]
[<ffffffffa070e916>] scst_cmd_done_local+0x76/0x120 [scst]
[<ffffffffa006843a>] dev_user_process_reply_exec+0x8a/0x370 [scst_user]
[<ffffffffa00699e2>] dev_user_process_reply+0x242/0x2e0 [scst_user]
[<ffffffffa0069b80>] dev_user_reply_get_cmd.isra.17+0x100/0x2d0 [scst_user]
[<ffffffffa0069ea7>] dev_user_ioctl+0x157/0x428 [scst_user]
[<ffffffff811d999a>] do_vfs_ioctl+0x7a/0x2e0
[<ffffffff811d9c91>] SyS_ioctl+0x91/0xb0
[<ffffffff8161b269>] system_call_fastpath+0x16/0x1b
Avoid this by calling dev_done() handlers only for completed commands
and not for aborted commands.
Reported-by: Gal Rosen <galr@storone.com>
Reported-by: Abacus Liang <abacusl@hotmail.com>
Reported-by: Shahar Salzman <shahar.salzman@kaminario.com>
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Remove the comment blocks from scst_block_generic_dev_done()
and scst_tape_generic_dev_done() since that comment does
not apply to these functions. Remove the trace statement from
scst_block_generic_dev_done() since it prints values that
are not modified by this function.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Some but not all SCSI LLD drivers set req->errors. Some SCSI
LLD drivers set req->errors to a negative Unix error code and
others assign the result of make_status_bytes() to req->errors.
The SCSI core finishes failed pass-through requests by calling
blk_finish_request(). That function calls req->end_io() without
setting req->errors. Hence check both the error argument and
req->errors before calling sioc->done().
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Make the ib_srpt driver build again on RHEL 5 systems. See also
r6138 / commit ID 940faa9ad4.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Although RHEL 6 is based on the 2.6.32 kernel, for RHEL 6.1 the
argument list for sysfs callback functions follows the style of
kernel 2.6.35.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
With the RHEL 7.0 kernel ib_register_mad_agent() takes eight
arguments. With the RHEL 7.1 kernel the same function takes nine
arguments. Detect at build time how many arguments this function
takes.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Code after BUG() is unreachable both with CONFIG_BUG=y and with
CONFIG_BUG=n. Hence remove such code. Detected by smatch.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
* scst_lib: refuse WRITE SAME commands with UNMAP=0 and ANCHOR=1 or
with UNMAP=0 and no data buffer. SBC-4 requires to respond with
"ILLEGAL REQUEST / INVALID FIELD IN CDB" to such WRITE SAME commands.
* scst_lib: use the WRITE SAME(16) NODB bit to determine the data
buffer length.
* scst_vdisk: test for the ANCHOR bit via mask 0x10 instead of mask 0x01.
* scst_vdisk: print an error message if a WRITE SAME command has been
refused because of an unusual value of NUMBER OF LOGICAL BLOCKS.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
This variable is no longer needed because devices are
removed from the devices list via list_del_init() before
being unregistered. See also trunk r5510 / commit f3820d5bc4.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Introduce a wait event and eliminate the msleep() call that is
used for waiting until an I/O context is ready.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Change the data type of iscsi_conn.read_iov into struct kvec * and
switch from iscsi_conn.read_size to iscsi_conn.read_msg.count for
kernel version 3.19 and later. Cast the return type of
get_zeroed_page() to void * since with this patch the read_iov
data type depends on the kernel version. Remove the (void __force
__user *) casts when assigning to iov_base since for a kvec iov_base
is a kernel pointer instead of a user space pointer. Switch to
iov_iter_kvec() to initialize conn->read_msg.msg_iter.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Rework the iSCSI target driver code such that it becomes easier
to port this code to kernel 3.19.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
The put_page_callback patch only improves performance on single-socket
systems but not on systems with multiple CPU sockets. Hence do not
print a warning if the put_page_callback patch has not been applied.
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Avoid that SRP login can fail as follows:
kernel: ib_srpt: failed to create CQ: cqe 320; c.v. 17; ret -22
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6179 d57e44dd-8a1f-0410-8b47-8ef2f437770f
The T10-PI patch (r6162) increases the time needed to run mkfs.ext4
over iSCSI from less than a second to several minutes. This is a
regression so revert the T10-PI patch until there is sufficient time
to find the root cause of this regression and to fix this regression.
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6171 d57e44dd-8a1f-0410-8b47-8ef2f437770f
Address the following checkpatch complaints:
ERROR:POINTER_LOCATION: "foo * bar" should be "foo *bar"
ERROR:SPACING: space required before the open parenthesis '('
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6169 d57e44dd-8a1f-0410-8b47-8ef2f437770f