Merge branch 'svn-trunk'

This commit is contained in:
Bart Van Assche
2015-08-26 20:39:25 -07:00
4 changed files with 31 additions and 13 deletions

View File

@@ -2072,14 +2072,14 @@ static int dev_user_reply_get_multi(struct file *file, void __user *arg)
goto out;
res = get_user(replies_cnt, (int16_t __user *)
&((struct scst_user_get_multi *)arg)->replies_cnt);
&((struct scst_user_get_multi __user *)arg)->replies_cnt);
if (unlikely(res < 0)) {
PRINT_ERROR("%s", "Unable to get replies_cnt");
goto out;
}
res = get_user(cmds_cnt, (int16_t __user *)
&((struct scst_user_get_multi *)arg)->cmds_cnt);
&((struct scst_user_get_multi __user *)arg)->cmds_cnt);
if (unlikely(res < 0)) {
PRINT_ERROR("%s", "Unable to get cmds_cnt");
goto out;
@@ -2121,7 +2121,7 @@ static int dev_user_reply_get_multi(struct file *file, void __user *arg)
TRACE_DBG("Returning %d replies_done", replies_done);
res = put_user(replies_done, (int16_t __user *)
&((struct scst_user_get_multi *)arg)->replies_done);
&((struct scst_user_get_multi __user *)arg)->replies_done);
if (unlikely(res < 0))
goto out;
@@ -2138,7 +2138,7 @@ get_cmds:
TRACE_DBG("Returning %d cmds_ret", i);
rc = put_user(i, (int16_t __user *)
&((struct scst_user_get_multi *)arg)->cmds_cnt);
&((struct scst_user_get_multi __user *)arg)->cmds_cnt);
if (unlikely(rc < 0)) {
res = rc; /* this error is more important */
goto out;
@@ -2151,9 +2151,9 @@ out:
out_part_replies_done:
TRACE_DBG("Partial returning %d replies_done", replies_done);
put_user(replies_done, (int16_t __user *)
&((struct scst_user_get_multi *)arg)->replies_done);
&((struct scst_user_get_multi __user *)arg)->replies_done);
rc = put_user(0, (int16_t __user *)
&((struct scst_user_get_multi *)arg)->cmds_cnt);
&((struct scst_user_get_multi __user *)arg)->cmds_cnt);
goto out;
}

View File

@@ -3994,13 +3994,7 @@ int scst_alloc_device(gfp_t gfp_mask, struct scst_device **out_dev)
dev->dev_double_ua_possible = 1;
dev->queue_alg = SCST_QUEUE_ALG_1_UNRESTRICTED_REORDER;
mutex_init(&dev->dev_pr_mutex);
dev->pr_generation = 0;
dev->pr_is_set = 0;
dev->pr_holder = NULL;
dev->pr_scope = SCOPE_LU;
dev->pr_type = TYPE_UNSPECIFIED;
INIT_LIST_HEAD(&dev->dev_registrants_list);
scst_pr_init(dev);
BUILD_BUG_ON(SCST_DIF_NO_CHECK_APP_TAG != 0);
dev->dev_dif_static_app_tag = SCST_DIF_NO_CHECK_APP_TAG;
@@ -4033,6 +4027,8 @@ void scst_free_device(struct scst_device *dev)
scst_deinit_threads(&dev->dev_cmd_threads);
scst_pr_cleanup(dev);
kfree(dev->virt_name);
kmem_cache_free(scst_dev_cachep, dev);

View File

@@ -1150,6 +1150,25 @@ out:
return res;
}
/* Initialize the PR members in *dev. */
int scst_pr_init(struct scst_device *dev)
{
mutex_init(&dev->dev_pr_mutex);
dev->pr_generation = 0;
dev->pr_is_set = 0;
dev->pr_holder = NULL;
dev->pr_scope = SCOPE_LU;
dev->pr_type = TYPE_UNSPECIFIED;
INIT_LIST_HEAD(&dev->dev_registrants_list);
return 0;
}
/* Free the resources allocated by scst_pr_init(). */
void scst_pr_cleanup(struct scst_device *dev)
{
}
/* Must be called under dev_pr_mutex or before dev is on the device list. */
int scst_pr_init_dev(struct scst_device *dev)
{

View File

@@ -785,6 +785,9 @@ void scst_unthrottle_cmd(struct scst_cmd *cmd);
int scst_do_internal_parsing(struct scst_cmd *cmd);
int scst_parse_descriptors(struct scst_cmd *cmd);
int scst_pr_init(struct scst_device *dev);
void scst_pr_cleanup(struct scst_device *dev);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
void scst_vfs_unlink_and_put(struct nameidata *nd);
#else