Re: [PATCH V2 2/4] scsi: storvsc: Properly support Fibre Channel devices
Hi Srinivasan, [auto build test ERROR on scsi/for-next] [also build test ERROR on v4.4-rc4 next-20151211] url: https://github.com/0day-ci/linux/commits/K-Y-Srinivasan/scsi-storvsc-Properly-support-FC-hosts/20151213-042209 base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next config: x86_64-randconfig-h0-12130933 (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All errors (new ones prefixed by >>): >> ERROR: "fc_release_transport" [drivers/scsi/hv_storvsc.ko] undefined! >> ERROR: "fc_remove_host" [drivers/scsi/hv_storvsc.ko] undefined! >> ERROR: "fc_attach_transport" [drivers/scsi/hv_storvsc.ko] undefined! --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
Re: [PATCH 10/13] IB/srp: use the new CQ API
On Fri, Dec 11, 2015 at 12:59:01PM -0500, Doug Ledford wrote: > On 12/11/2015 09:22 AM, Christoph Hellwig wrote: > > Hi Bart, > > > > thanks for all the reviews. I've updated the git branch with your > > suggestions and reviewed-by tags. I'm going to wait a little bit > > longer for other reviews to come in before reposting the series. > > Indeed, thanks for all the catches Bart. This patchset, with Bart's > fixups, looks good to me. Allright. How do you want to proceed? The current rdma-cq branch has all kinds of dependencies, but I've also prepared a new rdma-cq.2 branch that could go straight on top of your current queue: http://git.infradead.org/users/hch/rdma.git/shortlog/refs/heads/rdma-cq.2 If you're ready to start the 4.5 tree I can send those out as a patch series. > > > -- > Doug Ledford> GPG KeyID: 0E572FDD > > ---end quoted text--- -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/7] iscsi-target: Make a variable initialisation a bit more obvious in iscsi_create_default_params()
>> @@ -200,9 +200,8 @@ free_param: >> int iscsi_create_default_params(struct iscsi_param_list **param_list_ptr) >> { >> struct iscsi_param *param; >> -struct iscsi_param_list *pl; >> +struct iscsi_param_list *pl = kzalloc(sizeof(*pl), GFP_KERNEL); >> >> -pl = kzalloc(sizeof(struct iscsi_param_list), GFP_KERNEL); > > I don't see the benefit of this change, and the pattern assignment -> > failure test becomes more obscure. Are there any more software developers who prefer to specify such a variable initialisation on a single line? Does the proposed small source code reduction matter for you? Regards, Markus -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/7] iSCSI-target: Fine-tuning for three function implementations
From: Markus ElfringDate: Sat, 12 Dec 2015 15:25:20 +0100 Some update suggestions were taken into account from static source code analysis. Markus Elfring (7): Use a variable initialisation in iscsi_set_default_param() directly Less checks in iscsi_set_default_param() after error detection Delete an unnecessary variable initialisation in iscsi_create_default_params() Make a variable initialisation a bit more obvious in iscsi_create_default_params() Rename a jump label in iscsi_create_default_params() Delete unnecessary variable initialisations in iscsi_check_valuelist_for_support() Make two variable initialisations a bit more obvious in iscsi_check_valuelist_for_support() drivers/target/iscsi/iscsi_target_parameters.c | 100 - 1 file changed, 47 insertions(+), 53 deletions(-) -- 2.6.3 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 7/7] iscsi-target: Make two variable initialisations a bit more obvious in iscsi_check_valuelist_for_support()
From: Markus ElfringDate: Sat, 12 Dec 2015 15:04:57 +0100 The variable "acceptor_values" and "proposer_values" were initialized by null pointers and immediately assigned values from input parameters by separate statements. Let us express the desired variable initialisations directly. Signed-off-by: Markus Elfring --- drivers/target/iscsi/iscsi_target_parameters.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target_parameters.c b/drivers/target/iscsi/iscsi_target_parameters.c index 53e3345..fb6fd34 100644 --- a/drivers/target/iscsi/iscsi_target_parameters.c +++ b/drivers/target/iscsi/iscsi_target_parameters.c @@ -921,10 +921,7 @@ static char *iscsi_check_valuelist_for_support( char *value) { char *tmp1, *tmp2; - char *acceptor_values = NULL, *proposer_values = NULL; - - acceptor_values = param->value; - proposer_values = value; + char *acceptor_values = param->value, *proposer_values = value; do { if (!proposer_values) -- 2.6.3 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 6/7] iscsi-target: Delete unnecessary variable initialisations in iscsi_check_valuelist_for_support()
From: Markus ElfringDate: Sat, 12 Dec 2015 14:34:26 +0100 The variables "tmp1" and "tmp2" will eventually be set to appropriate pointers from a call of the strchr() function. Thus let us omit the explicit initialisation at the beginning. Signed-off-by: Markus Elfring --- drivers/target/iscsi/iscsi_target_parameters.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/target/iscsi/iscsi_target_parameters.c b/drivers/target/iscsi/iscsi_target_parameters.c index 29ecf29..53e3345 100644 --- a/drivers/target/iscsi/iscsi_target_parameters.c +++ b/drivers/target/iscsi/iscsi_target_parameters.c @@ -920,7 +920,7 @@ static char *iscsi_check_valuelist_for_support( struct iscsi_param *param, char *value) { - char *tmp1 = NULL, *tmp2 = NULL; + char *tmp1, *tmp2; char *acceptor_values = NULL, *proposer_values = NULL; acceptor_values = param->value; -- 2.6.3 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 7/7] iscsi-target: Make two variable initialisations a bit more obvious in iscsi_check_valuelist_for_support()
Am 12.12.2015 15:45, schrieb SF Markus Elfring: > From: Markus Elfring> Date: Sat, 12 Dec 2015 15:04:57 +0100 > > The variable "acceptor_values" and "proposer_values" were initialized > by null pointers and immediately assigned values from input parameters > by separate statements. > Let us express the desired variable initialisations directly. > > Signed-off-by: Markus Elfring > --- > drivers/target/iscsi/iscsi_target_parameters.c | 5 + > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/drivers/target/iscsi/iscsi_target_parameters.c > b/drivers/target/iscsi/iscsi_target_parameters.c > index 53e3345..fb6fd34 100644 > --- a/drivers/target/iscsi/iscsi_target_parameters.c > +++ b/drivers/target/iscsi/iscsi_target_parameters.c > @@ -921,10 +921,7 @@ static char *iscsi_check_valuelist_for_support( > char *value) > { > char *tmp1, *tmp2; > - char *acceptor_values = NULL, *proposer_values = NULL; > - > - acceptor_values = param->value; > - proposer_values = value; > + char *acceptor_values = param->value, *proposer_values = value; > I do not thing that this is a good idea, i find the first version more readable but you are right the NULL can be removed. just my 2 cents, re, wh > do { > if (!proposer_values) -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/7] iscsi-target: Use a variable initialisation in iscsi_set_default_param() directly
From: Markus ElfringDate: Sat, 12 Dec 2015 11:36:02 +0100 Omit the unnecessary setting to a null pointer for the variable "param" at the beginning of the function "iscsi_set_default_param" because it can be directly initialized with the return value from the function "kzalloc". Signed-off-by: Markus Elfring --- drivers/target/iscsi/iscsi_target_parameters.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target_parameters.c b/drivers/target/iscsi/iscsi_target_parameters.c index 3a1f9a7..0a8bd3f 100644 --- a/drivers/target/iscsi/iscsi_target_parameters.c +++ b/drivers/target/iscsi/iscsi_target_parameters.c @@ -127,9 +127,8 @@ static struct iscsi_param *iscsi_set_default_param(struct iscsi_param_list *para char *name, char *value, u8 phase, u8 scope, u8 sender, u16 type_range, u8 use) { - struct iscsi_param *param = NULL; + struct iscsi_param *param = kzalloc(sizeof(*param), GFP_KERNEL); - param = kzalloc(sizeof(struct iscsi_param), GFP_KERNEL); if (!param) { pr_err("Unable to allocate memory for parameter.\n"); goto out; -- 2.6.3 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/7] iscsi-target: Less checks in iscsi_set_default_param() after error detection
From: Markus ElfringDate: Sat, 12 Dec 2015 12:50:10 +0100 This issue was detected by using the Coccinelle software. A sanity check would be performed by the iscsi_set_default_param() function even if it is known already that the passed variable contained a null pointer. * This implementation detail could be improved by adjustments for jump targets according to the Linux coding style convention. * Let us return directly if a call of the function "kzalloc" failed. Signed-off-by: Markus Elfring --- drivers/target/iscsi/iscsi_target_parameters.c | 21 ++--- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target_parameters.c b/drivers/target/iscsi/iscsi_target_parameters.c index 0a8bd3f..15b2618 100644 --- a/drivers/target/iscsi/iscsi_target_parameters.c +++ b/drivers/target/iscsi/iscsi_target_parameters.c @@ -131,20 +131,20 @@ static struct iscsi_param *iscsi_set_default_param(struct iscsi_param_list *para if (!param) { pr_err("Unable to allocate memory for parameter.\n"); - goto out; + return NULL; } INIT_LIST_HEAD(>p_list); param->name = kstrdup(name, GFP_KERNEL); if (!param->name) { pr_err("Unable to allocate memory for parameter name.\n"); - goto out; + goto free_param; } param->value = kstrdup(value, GFP_KERNEL); if (!param->value) { pr_err("Unable to allocate memory for parameter value.\n"); - goto out; + goto free_name; } param->phase= phase; @@ -182,18 +182,17 @@ static struct iscsi_param *iscsi_set_default_param(struct iscsi_param_list *para default: pr_err("Unknown type_range 0x%02x\n", param->type_range); - goto out; + goto free_value; } list_add_tail(>p_list, _list->param_list); return param; -out: - if (param) { - kfree(param->value); - kfree(param->name); - kfree(param); - } - +free_value: + kfree(param->value); +free_name: + kfree(param->name); +free_param: + kfree(param); return NULL; } -- 2.6.3 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/7] iscsi-target: Make a variable initialisation a bit more obvious in iscsi_create_default_params()
On Sat, 12 Dec 2015, SF Markus Elfring wrote: > From: Markus Elfring> Date: Sat, 12 Dec 2015 13:44:06 +0100 > > The variable "pl" was declared and immediately assigned a return value > from a function call in a separate statement. > > * Let us express the desired variable initialisation directly. > > * Avoid the repetition of the data type specification for the > involved memory allocation according to the Linux coding > style convention. > > Signed-off-by: Markus Elfring > --- > drivers/target/iscsi/iscsi_target_parameters.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/target/iscsi/iscsi_target_parameters.c > b/drivers/target/iscsi/iscsi_target_parameters.c > index e0b173d..3f3842f 100644 > --- a/drivers/target/iscsi/iscsi_target_parameters.c > +++ b/drivers/target/iscsi/iscsi_target_parameters.c > @@ -200,9 +200,8 @@ free_param: > int iscsi_create_default_params(struct iscsi_param_list **param_list_ptr) > { > struct iscsi_param *param; > - struct iscsi_param_list *pl; > + struct iscsi_param_list *pl = kzalloc(sizeof(*pl), GFP_KERNEL); > > - pl = kzalloc(sizeof(struct iscsi_param_list), GFP_KERNEL); I don't see the benefit of this change, and the pattern assignment -> failure test becomes more obscure. julia > if (!pl) { > pr_err("Unable to allocate memory for" > " struct iscsi_param_list.\n"); > -- > 2.6.3 > > -- > To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/7] iscsi-target: Make a variable initialisation a bit more obvious in iscsi_create_default_params()
From: Markus ElfringDate: Sat, 12 Dec 2015 13:44:06 +0100 The variable "pl" was declared and immediately assigned a return value from a function call in a separate statement. * Let us express the desired variable initialisation directly. * Avoid the repetition of the data type specification for the involved memory allocation according to the Linux coding style convention. Signed-off-by: Markus Elfring --- drivers/target/iscsi/iscsi_target_parameters.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target_parameters.c b/drivers/target/iscsi/iscsi_target_parameters.c index e0b173d..3f3842f 100644 --- a/drivers/target/iscsi/iscsi_target_parameters.c +++ b/drivers/target/iscsi/iscsi_target_parameters.c @@ -200,9 +200,8 @@ free_param: int iscsi_create_default_params(struct iscsi_param_list **param_list_ptr) { struct iscsi_param *param; - struct iscsi_param_list *pl; + struct iscsi_param_list *pl = kzalloc(sizeof(*pl), GFP_KERNEL); - pl = kzalloc(sizeof(struct iscsi_param_list), GFP_KERNEL); if (!pl) { pr_err("Unable to allocate memory for" " struct iscsi_param_list.\n"); -- 2.6.3 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/7] iscsi-target: Rename a jump label in iscsi_create_default_params()
From: Markus ElfringDate: Sat, 12 Dec 2015 14:12:50 +0100 This issue was detected by using the Coccinelle software. Choose a jump label according to the current Linux coding style convention. Signed-off-by: Markus Elfring --- drivers/target/iscsi/iscsi_target_parameters.c | 64 +- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target_parameters.c b/drivers/target/iscsi/iscsi_target_parameters.c index 3f3842f..29ecf29 100644 --- a/drivers/target/iscsi/iscsi_target_parameters.c +++ b/drivers/target/iscsi/iscsi_target_parameters.c @@ -225,185 +225,185 @@ int iscsi_create_default_params(struct iscsi_param_list **param_list_ptr) PHASE_SECURITY, SCOPE_CONNECTION_ONLY, SENDER_BOTH, TYPERANGE_AUTH, USE_INITIAL_ONLY); if (!param) - goto out; + goto release_list; param = iscsi_set_default_param(pl, HEADERDIGEST, INITIAL_HEADERDIGEST, PHASE_OPERATIONAL, SCOPE_CONNECTION_ONLY, SENDER_BOTH, TYPERANGE_DIGEST, USE_INITIAL_ONLY); if (!param) - goto out; + goto release_list; param = iscsi_set_default_param(pl, DATADIGEST, INITIAL_DATADIGEST, PHASE_OPERATIONAL, SCOPE_CONNECTION_ONLY, SENDER_BOTH, TYPERANGE_DIGEST, USE_INITIAL_ONLY); if (!param) - goto out; + goto release_list; param = iscsi_set_default_param(pl, MAXCONNECTIONS, INITIAL_MAXCONNECTIONS, PHASE_OPERATIONAL, SCOPE_SESSION_WIDE, SENDER_BOTH, TYPERANGE_1_TO_65535, USE_LEADING_ONLY); if (!param) - goto out; + goto release_list; param = iscsi_set_default_param(pl, SENDTARGETS, INITIAL_SENDTARGETS, PHASE_FFP0, SCOPE_SESSION_WIDE, SENDER_INITIATOR, TYPERANGE_UTF8, 0); if (!param) - goto out; + goto release_list; param = iscsi_set_default_param(pl, TARGETNAME, INITIAL_TARGETNAME, PHASE_DECLARATIVE, SCOPE_SESSION_WIDE, SENDER_BOTH, TYPERANGE_ISCSINAME, USE_ALL); if (!param) - goto out; + goto release_list; param = iscsi_set_default_param(pl, INITIATORNAME, INITIAL_INITIATORNAME, PHASE_DECLARATIVE, SCOPE_SESSION_WIDE, SENDER_INITIATOR, TYPERANGE_ISCSINAME, USE_INITIAL_ONLY); if (!param) - goto out; + goto release_list; param = iscsi_set_default_param(pl, TARGETALIAS, INITIAL_TARGETALIAS, PHASE_DECLARATIVE, SCOPE_SESSION_WIDE, SENDER_TARGET, TYPERANGE_UTF8, USE_ALL); if (!param) - goto out; + goto release_list; param = iscsi_set_default_param(pl, INITIATORALIAS, INITIAL_INITIATORALIAS, PHASE_DECLARATIVE, SCOPE_SESSION_WIDE, SENDER_INITIATOR, TYPERANGE_UTF8, USE_ALL); if (!param) - goto out; + goto release_list; param = iscsi_set_default_param(pl, TARGETADDRESS, INITIAL_TARGETADDRESS, PHASE_DECLARATIVE, SCOPE_SESSION_WIDE, SENDER_TARGET, TYPERANGE_TARGETADDRESS, USE_ALL); if (!param) - goto out; + goto release_list; param = iscsi_set_default_param(pl, TARGETPORTALGROUPTAG, INITIAL_TARGETPORTALGROUPTAG, PHASE_DECLARATIVE, SCOPE_SESSION_WIDE, SENDER_TARGET, TYPERANGE_0_TO_65535, USE_INITIAL_ONLY); if (!param) - goto out; + goto release_list; param = iscsi_set_default_param(pl, INITIALR2T, INITIAL_INITIALR2T, PHASE_OPERATIONAL, SCOPE_SESSION_WIDE, SENDER_BOTH, TYPERANGE_BOOL_OR, USE_LEADING_ONLY); if (!param) - goto out; + goto release_list; param = iscsi_set_default_param(pl, IMMEDIATEDATA, INITIAL_IMMEDIATEDATA, PHASE_OPERATIONAL, SCOPE_SESSION_WIDE, SENDER_BOTH, TYPERANGE_BOOL_AND, USE_LEADING_ONLY); if (!param) - goto out; + goto release_list; param = iscsi_set_default_param(pl, MAXXMITDATASEGMENTLENGTH, INITIAL_MAXXMITDATASEGMENTLENGTH, PHASE_OPERATIONAL, SCOPE_CONNECTION_ONLY, SENDER_BOTH, TYPERANGE_512_TO_16777215,
[PATCH 3/7] iscsi-target: Delete an unnecessary variable initialisation in iscsi_create_default_params()
From: Markus ElfringDate: Sat, 12 Dec 2015 13:20:08 +0100 The variable "param" will eventually be set to an appropriate pointer from a call of the iscsi_set_default_param() function. Thus let us omit the explicit initialisation at the beginning. Signed-off-by: Markus Elfring --- drivers/target/iscsi/iscsi_target_parameters.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/target/iscsi/iscsi_target_parameters.c b/drivers/target/iscsi/iscsi_target_parameters.c index 15b2618..e0b173d 100644 --- a/drivers/target/iscsi/iscsi_target_parameters.c +++ b/drivers/target/iscsi/iscsi_target_parameters.c @@ -199,7 +199,7 @@ free_param: /* #warning Add extension keys */ int iscsi_create_default_params(struct iscsi_param_list **param_list_ptr) { - struct iscsi_param *param = NULL; + struct iscsi_param *param; struct iscsi_param_list *pl; pl = kzalloc(sizeof(struct iscsi_param_list), GFP_KERNEL); -- 2.6.3 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/7] iscsi-target: Use a variable initialisation in iscsi_set_default_param() directly
On Sat, Dec 12, 2015 at 03:34:50PM +0100, SF Markus Elfring wrote: > From: Markus Elfring> Date: Sat, 12 Dec 2015 11:36:02 +0100 > > Omit the unnecessary setting to a null pointer for the variable "param" > at the beginning of the function "iscsi_set_default_param" > because it can be directly initialized with the return value > from the function "kzalloc". > > Signed-off-by: Markus Elfring > --- > drivers/target/iscsi/iscsi_target_parameters.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/target/iscsi/iscsi_target_parameters.c > b/drivers/target/iscsi/iscsi_target_parameters.c > index 3a1f9a7..0a8bd3f 100644 > --- a/drivers/target/iscsi/iscsi_target_parameters.c > +++ b/drivers/target/iscsi/iscsi_target_parameters.c > @@ -127,9 +127,8 @@ static struct iscsi_param *iscsi_set_default_param(struct > iscsi_param_list *para > char *name, char *value, u8 phase, u8 scope, u8 sender, > u16 type_range, u8 use) > { > - struct iscsi_param *param = NULL; > + struct iscsi_param *param = kzalloc(sizeof(*param), GFP_KERNEL); > > - param = kzalloc(sizeof(struct iscsi_param), GFP_KERNEL); > if (!param) { > pr_err("Unable to allocate memory for parameter.\n"); > goto out; It's better to just get rid of the initialization but leave the kzalloc() as-is for two reasons. 1) Initializer code normally contains more bugs per line than other code. I am thinking about dereferencing pointers before checking for NULL or not checking the allocation for failure. 2) It puts a blank line between the allocation and the check for failure. It's like a new paragraph. The allocation and the check should be next to each other. regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V2 2/4] scsi: storvsc: Properly support Fibre Channel devices
For FC devices managed by this driver, atttach the appropriate transport template. This will allow us to create the appropriate sysfs files for these devices. With this we can publish the wwn for both the port and the node. Signed-off-by: K. Y. SrinivasanReviewed-by: Long Li Tested-by: Alex Ng --- V2: Fixed error paths - Dan Carpenter drivers/scsi/storvsc_drv.c | 162 +++- 1 files changed, 115 insertions(+), 47 deletions(-) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 00bb4bd..ab9828c 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -41,6 +41,7 @@ #include #include #include +#include /* * All wire protocol details (storage protocol between the guest and the host) @@ -397,6 +398,7 @@ static int storvsc_timeout = 180; static int msft_blist_flags = BLIST_TRY_VPD_PAGES; +static struct scsi_transport_template *fc_transport_template; static void storvsc_on_channel_callback(void *context); @@ -456,6 +458,11 @@ struct storvsc_device { /* Used for vsc/vsp channel reset process */ struct storvsc_cmd_request init_request; struct storvsc_cmd_request reset_request; + /* +* Currently active port and node names for FC devices. +*/ + u64 node_name; + u64 port_name; }; struct hv_host_device { @@ -695,7 +702,26 @@ static void handle_multichannel_storage(struct hv_device *device, int max_chns) vmbus_are_subchannels_present(device->channel); } -static int storvsc_channel_init(struct hv_device *device) +static void cache_wwn(struct storvsc_device *stor_device, + struct vstor_packet *vstor_packet) +{ + /* +* Cache the currently active port and node ww names. +*/ + if (vstor_packet->wwn_packet.primary_active) { + stor_device->node_name = + wwn_to_u64(vstor_packet->wwn_packet.primary_node_wwn); + stor_device->port_name = + wwn_to_u64(vstor_packet->wwn_packet.primary_port_wwn); + } else { + stor_device->node_name = + wwn_to_u64(vstor_packet->wwn_packet.secondary_node_wwn); + stor_device->port_name = + wwn_to_u64(vstor_packet->wwn_packet.secondary_port_wwn); + } +} + +static int storvsc_channel_init(struct hv_device *device, bool is_fc) { struct storvsc_device *stor_device; struct storvsc_cmd_request *request; @@ -727,19 +753,15 @@ static int storvsc_channel_init(struct hv_device *device) VM_PKT_DATA_INBAND, VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); if (ret != 0) - goto cleanup; + return ret; t = wait_for_completion_timeout(>wait_event, 5*HZ); - if (t == 0) { - ret = -ETIMEDOUT; - goto cleanup; - } + if (t == 0) + return -ETIMEDOUT; if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO || - vstor_packet->status != 0) { - ret = -EINVAL; - goto cleanup; - } + vstor_packet->status != 0) + return -EINVAL; for (i = 0; i < ARRAY_SIZE(vmstor_protocols); i++) { @@ -764,18 +786,14 @@ static int storvsc_channel_init(struct hv_device *device) VM_PKT_DATA_INBAND, VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); if (ret != 0) - goto cleanup; + return ret; t = wait_for_completion_timeout(>wait_event, 5*HZ); - if (t == 0) { - ret = -ETIMEDOUT; - goto cleanup; - } + if (t == 0) + return -ETIMEDOUT; - if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO) { - ret = -EINVAL; - goto cleanup; - } + if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO) + return -EINVAL; if (vstor_packet->status == 0) { vmstor_proto_version = @@ -791,10 +809,8 @@ static int storvsc_channel_init(struct hv_device *device) } } - if (vstor_packet->status != 0) { - ret = -EINVAL; - goto cleanup; - } + if (vstor_packet->status != 0) + return -EINVAL; memset(vstor_packet, 0, sizeof(struct vstor_packet)); @@ -809,19 +825,15 @@ static int storvsc_channel_init(struct hv_device *device) VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); if (ret != 0) - goto
[PATCH V2 3/4] scsi: storvsc: Refactor the code in storvsc_channel_init()
The function storvsc_channel_init() repeatedly interacts with the host to extract various channel properties. Refactor this code to eliminate code repetition. Signed-off-by: K. Y. SrinivasanReviewed-by: Long Li Reviewed-by: Johannes Thumshirn Tested-by: Alex Ng --- V2: Fixed error paths - Dan Carpenter drivers/scsi/storvsc_drv.c | 126 1 files changed, 46 insertions(+), 80 deletions(-) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index ab9828c..947f812 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -721,29 +721,17 @@ static void cache_wwn(struct storvsc_device *stor_device, } } -static int storvsc_channel_init(struct hv_device *device, bool is_fc) + +static int storvsc_execute_vstor_op(struct hv_device *device, + struct storvsc_cmd_request *request, + bool status_check) { - struct storvsc_device *stor_device; - struct storvsc_cmd_request *request; struct vstor_packet *vstor_packet; - int ret, t, i; - int max_chns; - bool process_sub_channels = false; - - stor_device = get_out_stor_device(device); - if (!stor_device) - return -ENODEV; + int ret, t; - request = _device->init_request; vstor_packet = >vstor_packet; - /* -* Now, initiate the vsc/vsp initialization protocol on the open -* channel -*/ - memset(request, 0, sizeof(struct storvsc_cmd_request)); init_completion(>wait_event); - vstor_packet->operation = VSTOR_OPERATION_BEGIN_INITIALIZATION; vstor_packet->flags = REQUEST_COMPLETION_FLAG; ret = vmbus_sendpacket(device->channel, vstor_packet, @@ -759,17 +747,50 @@ static int storvsc_channel_init(struct hv_device *device, bool is_fc) if (t == 0) return -ETIMEDOUT; + if (!status_check) + return ret; + if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO || vstor_packet->status != 0) return -EINVAL; + return ret; +} + +static int storvsc_channel_init(struct hv_device *device, bool is_fc) +{ + struct storvsc_device *stor_device; + struct storvsc_cmd_request *request; + struct vstor_packet *vstor_packet; + int ret, i; + int max_chns; + bool process_sub_channels = false; + + stor_device = get_out_stor_device(device); + if (!stor_device) + return -ENODEV; + + request = _device->init_request; + vstor_packet = >vstor_packet; + + /* +* Now, initiate the vsc/vsp initialization protocol on the open +* channel +*/ + memset(request, 0, sizeof(struct storvsc_cmd_request)); + vstor_packet->operation = VSTOR_OPERATION_BEGIN_INITIALIZATION; + ret = storvsc_execute_vstor_op(device, request, true); + if (ret) + return ret; + /* +* Query host supported protocol version. +*/ for (i = 0; i < ARRAY_SIZE(vmstor_protocols); i++) { /* reuse the packet for version range supported */ memset(vstor_packet, 0, sizeof(struct vstor_packet)); vstor_packet->operation = VSTOR_OPERATION_QUERY_PROTOCOL_VERSION; - vstor_packet->flags = REQUEST_COMPLETION_FLAG; vstor_packet->version.major_minor = vmstor_protocols[i].protocol_version; @@ -778,20 +799,10 @@ static int storvsc_channel_init(struct hv_device *device, bool is_fc) * The revision number is only used in Windows; set it to 0. */ vstor_packet->version.revision = 0; - - ret = vmbus_sendpacket(device->channel, vstor_packet, - (sizeof(struct vstor_packet) - - vmscsi_size_delta), - (unsigned long)request, - VM_PKT_DATA_INBAND, - VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); + ret = storvsc_execute_vstor_op(device, request, false); if (ret != 0) return ret; - t = wait_for_completion_timeout(>wait_event, 5*HZ); - if (t == 0) - return -ETIMEDOUT; - if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO) return -EINVAL; @@ -815,26 +826,10 @@ static int storvsc_channel_init(struct hv_device *device, bool is_fc) memset(vstor_packet, 0, sizeof(struct vstor_packet)); vstor_packet->operation = VSTOR_OPERATION_QUERY_PROPERTIES; - vstor_packet->flags = REQUEST_COMPLETION_FLAG;
[PATCH V2 1/4] scsi: storvsc: Fix a bug in the layout of the hv_fc_wwn_packet
The hv_fc_wwn_packet is exchanged over vmbus. Make the definition in Linux match the Window's definition. Signed-off-by: K. Y. SrinivasanReviewed-by: Johannes Thumshirn Reviewed-by: Long Li Tested-by: Alex Ng --- drivers/scsi/storvsc_drv.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index c41f674..00bb4bd 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -92,9 +92,8 @@ enum vstor_packet_operation { */ struct hv_fc_wwn_packet { - boolprimary_active; - u8 reserved1; - u8 reserved2; + u8 primary_active; + u8 reserved1[3]; u8 primary_port_wwn[8]; u8 primary_node_wwn[8]; u8 secondary_port_wwn[8]; -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V2 4/4] scsi: storvsc: Tighten up the interrupt path
On the interrupt path, we repeatedly establish the pointer to the storvsc_device. Fix this. Signed-off-by: K. Y. SrinivasanReviewed-by: Long Li Reviewed-by: Johannes Thumshirn Tested-by: Alex Ng --- drivers/scsi/storvsc_drv.c | 23 --- 1 files changed, 8 insertions(+), 15 deletions(-) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 947f812..3d3d157 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -943,19 +943,16 @@ static void storvsc_handle_error(struct vmscsi_request *vm_srb, } -static void storvsc_command_completion(struct storvsc_cmd_request *cmd_request) +static void storvsc_command_completion(struct storvsc_cmd_request *cmd_request, + struct storvsc_device *stor_dev) { struct scsi_cmnd *scmnd = cmd_request->cmd; - struct hv_host_device *host_dev = shost_priv(scmnd->device->host); struct scsi_sense_hdr sense_hdr; struct vmscsi_request *vm_srb; struct Scsi_Host *host; - struct storvsc_device *stor_dev; - struct hv_device *dev = host_dev->dev; u32 payload_sz = cmd_request->payload_sz; void *payload = cmd_request->payload; - stor_dev = get_in_stor_device(dev); host = stor_dev->host; vm_srb = _request->vstor_packet.vm_srb; @@ -985,14 +982,13 @@ static void storvsc_command_completion(struct storvsc_cmd_request *cmd_request) kfree(payload); } -static void storvsc_on_io_completion(struct hv_device *device, +static void storvsc_on_io_completion(struct storvsc_device *stor_device, struct vstor_packet *vstor_packet, struct storvsc_cmd_request *request) { - struct storvsc_device *stor_device; struct vstor_packet *stor_pkt; + struct hv_device *device = stor_device->device; - stor_device = hv_get_drvdata(device); stor_pkt = >vstor_packet; /* @@ -1047,7 +1043,7 @@ static void storvsc_on_io_completion(struct hv_device *device, stor_pkt->vm_srb.data_transfer_length = vstor_packet->vm_srb.data_transfer_length; - storvsc_command_completion(request); + storvsc_command_completion(request, stor_device); if (atomic_dec_and_test(_device->num_outstanding_req) && stor_device->drain_notify) @@ -1056,21 +1052,19 @@ static void storvsc_on_io_completion(struct hv_device *device, } -static void storvsc_on_receive(struct hv_device *device, +static void storvsc_on_receive(struct storvsc_device *stor_device, struct vstor_packet *vstor_packet, struct storvsc_cmd_request *request) { struct storvsc_scan_work *work; - struct storvsc_device *stor_device; switch (vstor_packet->operation) { case VSTOR_OPERATION_COMPLETE_IO: - storvsc_on_io_completion(device, vstor_packet, request); + storvsc_on_io_completion(stor_device, vstor_packet, request); break; case VSTOR_OPERATION_REMOVE_DEVICE: case VSTOR_OPERATION_ENUMERATE_BUS: - stor_device = get_in_stor_device(device); work = kmalloc(sizeof(struct storvsc_scan_work), GFP_ATOMIC); if (!work) return; @@ -1081,7 +1075,6 @@ static void storvsc_on_receive(struct hv_device *device, break; case VSTOR_OPERATION_FCHBA_DATA: - stor_device = get_in_stor_device(device); cache_wwn(stor_device, vstor_packet); fc_host_node_name(stor_device->host) = stor_device->node_name; fc_host_port_name(stor_device->host) = stor_device->port_name; @@ -1129,7 +1122,7 @@ static void storvsc_on_channel_callback(void *context) vmscsi_size_delta)); complete(>wait_event); } else { - storvsc_on_receive(device, + storvsc_on_receive(stor_device, (struct vstor_packet *)packet, request); } -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH V2 0/4] scsi: storvsc: Properly support FC hosts
Properly support FC hosts. Additional cleanup patches are also included. In this version I have adddressed comments from Dan Carpenterand from Johannes Thumshirn . K. Y. Srinivasan (4): scsi: storvsc: Fix a bug in the layout of the hv_fc_wwn_packet scsi: storvsc: Properly support Fibre Channel devices scsi: storvsc: Refactor the code in storvsc_channel_init() scsi: storvsc: Tighten up the interrupt path drivers/scsi/storvsc_drv.c | 256 1 files changed, 141 insertions(+), 115 deletions(-) -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 3/9] aacraid: Added EEH support
Hi Raghava, [auto build test ERROR on scsi/for-next] [also build test ERROR on v4.4-rc4 next-20151211] url: https://github.com/0day-ci/linux/commits/Raghava-Aditya-Renukunta/aacraid-Patchset-for-aacraid-driver-version-41052/20151211-094405 base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next config: x86_64-randconfig-r0-12130550 (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All errors (new ones prefixed by >>): drivers/scsi/aacraid/linit.c: In function 'aac_pci_error_detected': >> drivers/scsi/aacraid/linit.c:1546:3: error: implicit declaration of function >> 'aac_release_resources' [-Werror=implicit-function-declaration] aac_release_resources(aac); ^ drivers/scsi/aacraid/linit.c: In function 'aac_pci_resume': >> drivers/scsi/aacraid/linit.c:1617:2: error: implicit declaration of function >> 'aac_acquire_resources' [-Werror=implicit-function-declaration] aac_acquire_resources(aac); ^ cc1: some warnings being treated as errors vim +/aac_release_resources +1546 drivers/scsi/aacraid/linit.c 1540 1541 aac->handle_pci_error = 1; 1542 aac->adapter_shutdown = 1; 1543 1544 scsi_block_requests(aac->scsi_host_ptr); 1545 aac_flush_ios(aac); > 1546 aac_release_resources(aac); 1547 1548 pci_disable_pcie_error_reporting(pdev); 1549 aac_adapter_ioremap(aac, 0); 1550 1551 return PCI_ERS_RESULT_NEED_RESET; 1552 case pci_channel_io_perm_failure: 1553 aac->handle_pci_error = 1; 1554 aac->adapter_shutdown = 1; 1555 1556 aac_flush_ios(aac); 1557 return PCI_ERS_RESULT_DISCONNECT; 1558 } 1559 1560 return PCI_ERS_RESULT_NEED_RESET; 1561 } 1562 1563 static pci_ers_result_t aac_pci_mmio_enabled(struct pci_dev *pdev) 1564 { 1565 dev_err(>dev, "aacraid: PCI error - mmio enabled\n"); 1566 return PCI_ERS_RESULT_NEED_RESET; 1567 } 1568 1569 static pci_ers_result_t aac_pci_slot_reset(struct pci_dev *pdev) 1570 { 1571 dev_err(>dev, "aacraid: PCI error - slot reset\n"); 1572 pci_restore_state(pdev); 1573 if (pci_enable_device(pdev)) { 1574 dev_warn(>dev, 1575 "aacraid: failed to enable slave\n"); 1576 goto fail_device; 1577 } 1578 1579 pci_set_master(pdev); 1580 1581 if (pci_enable_device_mem(pdev)) { 1582 dev_err(>dev, "pci_enable_device_mem failed\n"); 1583 goto fail_device; 1584 } 1585 1586 return PCI_ERS_RESULT_RECOVERED; 1587 1588 fail_device: 1589 dev_err(>dev, "aacraid: PCI error - slot reset failed\n"); 1590 return PCI_ERS_RESULT_DISCONNECT; 1591 } 1592 1593 1594 static void aac_pci_resume(struct pci_dev *pdev) 1595 { 1596 struct Scsi_Host *shost = pci_get_drvdata(pdev); 1597 struct scsi_device *sdev = NULL; 1598 struct aac_dev *aac = (struct aac_dev *)shost_priv(shost); 1599 1600 pci_cleanup_aer_uncorrect_error_status(pdev); 1601 1602 if (aac_adapter_ioremap(aac, aac->base_size)) { 1603 1604 dev_err(>dev, "aacraid: ioremap failed\n"); 1605 /* remap failed, go back ... */ 1606 aac->comm_interface = AAC_COMM_PRODUCER; 1607 if (aac_adapter_ioremap(aac, AAC_MIN_FOOTPRINT_SIZE)) { 1608 dev_warn(>dev, 1609 "aacraid: unable to map adapter.\n"); 1610 1611 return; 1612 } 1613 } 1614 1615 msleep(1); 1616 > 1617 aac_acquire_resources(aac); 1618 1619 /* 1620 * reset this flag to unblock ioctl() as it was set --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
Re: [PATCH 1/7] iscsi-target: Use a variable initialisation in iscsi_set_default_param() directly
>> @@ -127,9 +127,8 @@ static struct iscsi_param >> *iscsi_set_default_param(struct iscsi_param_list *para >> char *name, char *value, u8 phase, u8 scope, u8 sender, >> u16 type_range, u8 use) >> { >> -struct iscsi_param *param = NULL; >> +struct iscsi_param *param = kzalloc(sizeof(*param), GFP_KERNEL); >> >> -param = kzalloc(sizeof(struct iscsi_param), GFP_KERNEL); >> if (!param) { >> pr_err("Unable to allocate memory for parameter.\n"); >> goto out; > > It's better to just get rid of the initialization but leave the > kzalloc() as-is for two reasons. > > 1) Initializer code normally contains more bugs per line than other > code. I am thinking about dereferencing pointers before checking > for NULL or not checking the allocation for failure. I can follow your concerns a bit. > 2) It puts a blank line between the allocation and the check for failure. Is there a target conflict between "convenient" variable initialisation in the declaration section and the function outline that seems to be checked by the script "checkpatch.pl" to some degree while corresponding preferences or recommendations are not mentioned in the document "CodingStyle"? > It's like a new paragraph. I do not see the separation in a strict way so far. > The allocation and the check should be next to each other. I find that these actions are still close enough in the discussed use case. Regards, Markus -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH V2 2/4] scsi: storvsc: Properly support Fibre Channel devices
Hi Srinivasan, [auto build test ERROR on scsi/for-next] [also build test ERROR on v4.4-rc4 next-20151211] url: https://github.com/0day-ci/linux/commits/K-Y-Srinivasan/scsi-storvsc-Properly-support-FC-hosts/20151213-042209 base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next config: x86_64-randconfig-s4-12130552 (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All errors (new ones prefixed by >>): drivers/built-in.o: In function `storvsc_remove': >> storvsc_drv.c:(.text+0x2e3e58): undefined reference to `fc_remove_host' drivers/built-in.o: In function `storvsc_drv_init': >> storvsc_drv.c:(.init.text+0x107bf): undefined reference to >> `fc_attach_transport' >> storvsc_drv.c:(.init.text+0x107f9): undefined reference to >> `fc_release_transport' drivers/built-in.o: In function `storvsc_drv_exit': >> storvsc_drv.c:(.exit.text+0x1eb1): undefined reference to >> `fc_release_transport' --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data