Merge branch 'svn-trunk'

This commit is contained in:
Bart Van Assche
2017-04-20 20:10:40 -07:00
7 changed files with 33 additions and 11 deletions

View File

@@ -1095,7 +1095,7 @@ out:
return res;
}
static long ioctl(struct file *file, unsigned int cmd, unsigned long arg)
static long iscsi_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
long err;
@@ -1172,7 +1172,7 @@ out:
return err;
}
static int open(struct inode *inode, struct file *file)
static int iscsi_open(struct inode *inode, struct file *file)
{
bool already;
@@ -1190,7 +1190,7 @@ static int open(struct inode *inode, struct file *file)
return 0;
}
static int release(struct inode *inode, struct file *filp)
static int iscsi_release(struct inode *inode, struct file *filp)
{
#ifndef CONFIG_SCST_PROC
struct iscsi_attr *attr, *t;
@@ -1222,10 +1222,10 @@ static int release(struct inode *inode, struct file *filp)
const struct file_operations ctr_fops = {
.owner = THIS_MODULE,
.unlocked_ioctl = ioctl,
.compat_ioctl = ioctl,
.open = open,
.release = release,
.unlocked_ioctl = iscsi_ioctl,
.compat_ioctl = iscsi_ioctl,
.open = iscsi_open,
.release = iscsi_release,
};
#ifdef CONFIG_SCST_DEBUG

View File

@@ -397,7 +397,7 @@ struct iscsi_conn *conn_lookup(struct iscsi_session *session, u16 cid)
*/
list_for_each_entry_reverse(conn, &session->conn_list,
conn_list_entry) {
if (conn->cid == cid)
if (conn->cid == cid && !conn->closing)
return conn;
}
return NULL;

View File

@@ -2154,6 +2154,9 @@ static int scsi_cmnd_start(struct iscsi_cmnd *req)
req->scst_state = ISCSI_CMD_STATE_RX_CMD;
conn->rx_task = current;
scst_cmd_init_stage1_done(scst_cmd, SCST_CONTEXT_DIRECT, 0);
#ifdef CONFIG_SCST_EXTRACHECKS
conn->rx_task = NULL;
#endif
if (req->scst_state != ISCSI_CMD_STATE_RX_CMD)
res = req->conn->transport->iscsit_receive_cmnd_data(req);
@@ -4237,7 +4240,7 @@ create:
if (p == NULL) {
PRINT_ERROR("Unable to allocate iSCSI thread pool (size %zd)",
sizeof(*p));
res = -ENOMEM;
res = 0;
if (!list_empty(&iscsi_thread_pools_list)) {
PRINT_WARNING("%s", "Using global iSCSI thread pool "
"instead");

View File

@@ -1066,6 +1066,15 @@ retry:
goto retry;
log_error("read netlink fd (%d) failed: %s", fd, strerror(errno));
exit(1);
} else if (rc == 0) {
/*
* EOF on nl_fd --
* We arrive here after the kernel module closes the other end
* of nl_fd during shutdown of the kernel modules. The daemon
* thread is expected to exit when this happens.
*/
log_info("kernel module shutdown -- daemon exits");
exit(1);
}
log_debug(1, "target %u, session %#" PRIx64 ", conn %u, code %u, cookie %d",

View File

@@ -846,8 +846,13 @@ int main(int argc, char **argv)
/*
* Otherwise we could die in some later write() during the event_loop()
* instead of getting EPIPE!
*
* The effects of signal(2) in a multithreaded process are unspecified,
* so use sigaction(2) instead.
*/
signal(SIGPIPE, SIG_IGN);
struct sigaction act = (struct sigaction) { .sa_handler = SIG_IGN };
int rc = sigaction(SIGPIPE, &act, NULL);
assert(rc == 0);
while ((ch = getopt_long(argc, argv, "c:fd:s:u:g:a:p:vh", long_options, &longindex)) >= 0) {
switch (ch) {

View File

@@ -1700,6 +1700,11 @@ next:
dev->dev_rd_only = virt_dev->rd_only;
#ifdef CONFIG_SCST_PROC
if (virt_dev->nullio && !virt_dev->file_size)
virt_dev->file_size = VDISK_NULLIO_SIZE;
#endif
res = vdisk_reexamine(virt_dev);
if (res < 0)
goto out;

View File

@@ -747,7 +747,7 @@ static int process_cmd(struct vdisk_cmd *vcmd)
case SCST_USER_TASK_MGMT_DONE:
res = do_tm(vcmd, 1);
#if DEBUG_TM_FN_IGNORE
#ifdef DEBUG_TM_FN_IGNORE
if (dev->debug_tm_ignore) {
sleep(15);
}