Skip to content

Commit 2441500

Browse files
James BottomleyJames Bottomley
authored andcommitted
Merge branch 'fixes' into misc
2 parents a45a1f3 + e6f7754 commit 2441500

File tree

27 files changed

+178
-258
lines changed

27 files changed

+178
-258
lines changed

drivers/scsi/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ config SCSI_NETLINK
4747
default n
4848
depends on NET
4949

50+
config SCSI_MQ_DEFAULT
51+
bool "SCSI: use blk-mq I/O path by default"
52+
depends on SCSI
53+
---help---
54+
This option enables the new blk-mq based I/O path for SCSI
55+
devices by default. With the option the scsi_mod.use_blk_mq
56+
module/boot option defaults to Y, without it to N, but it can
57+
still be overridden either way.
58+
59+
If unsure say N.
60+
5061
config SCSI_PROC_FS
5162
bool "legacy /proc/scsi/ support"
5263
depends on SCSI && PROC_FS

drivers/scsi/aacraid/aachba.c

Lines changed: 32 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,9 @@ static void get_container_name_callback(void *context, struct fib * fibptr)
549549
if ((le32_to_cpu(get_name_reply->status) == CT_OK)
550550
&& (get_name_reply->data[0] != '\0')) {
551551
char *sp = get_name_reply->data;
552-
sp[sizeof(((struct aac_get_name_resp *)NULL)->data)] = '\0';
552+
int data_size = FIELD_SIZEOF(struct aac_get_name_resp, data);
553+
554+
sp[data_size - 1] = '\0';
553555
while (*sp == ' ')
554556
++sp;
555557
if (*sp) {
@@ -579,21 +581,25 @@ static void get_container_name_callback(void *context, struct fib * fibptr)
579581
static int aac_get_container_name(struct scsi_cmnd * scsicmd)
580582
{
581583
int status;
584+
int data_size;
582585
struct aac_get_name *dinfo;
583586
struct fib * cmd_fibcontext;
584587
struct aac_dev * dev;
585588

586589
dev = (struct aac_dev *)scsicmd->device->host->hostdata;
587590

591+
data_size = FIELD_SIZEOF(struct aac_get_name_resp, data);
592+
588593
cmd_fibcontext = aac_fib_alloc_tag(dev, scsicmd);
589594

590595
aac_fib_init(cmd_fibcontext);
591596
dinfo = (struct aac_get_name *) fib_data(cmd_fibcontext);
597+
scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
592598

593599
dinfo->command = cpu_to_le32(VM_ContainerConfig);
594600
dinfo->type = cpu_to_le32(CT_READ_NAME);
595601
dinfo->cid = cpu_to_le32(scmd_id(scsicmd));
596-
dinfo->count = cpu_to_le32(sizeof(((struct aac_get_name_resp *)NULL)->data));
602+
dinfo->count = cpu_to_le32(data_size - 1);
597603

598604
status = aac_fib_send(ContainerCommand,
599605
cmd_fibcontext,
@@ -606,10 +612,8 @@ static int aac_get_container_name(struct scsi_cmnd * scsicmd)
606612
/*
607613
* Check that the command queued to the controller
608614
*/
609-
if (status == -EINPROGRESS) {
610-
scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
615+
if (status == -EINPROGRESS)
611616
return 0;
612-
}
613617

614618
printk(KERN_WARNING "aac_get_container_name: aac_fib_send failed with status: %d.\n", status);
615619
aac_fib_complete(cmd_fibcontext);
@@ -720,6 +724,7 @@ static void _aac_probe_container1(void * context, struct fib * fibptr)
720724

721725
dinfo->count = cpu_to_le32(scmd_id(scsicmd));
722726
dinfo->type = cpu_to_le32(FT_FILESYS);
727+
scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
723728

724729
status = aac_fib_send(ContainerCommand,
725730
fibptr,
@@ -731,9 +736,7 @@ static void _aac_probe_container1(void * context, struct fib * fibptr)
731736
/*
732737
* Check that the command queued to the controller
733738
*/
734-
if (status == -EINPROGRESS)
735-
scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
736-
else if (status < 0) {
739+
if (status < 0 && status != -EINPROGRESS) {
737740
/* Inherit results from VM_NameServe, if any */
738741
dresp->status = cpu_to_le32(ST_OK);
739742
_aac_probe_container2(context, fibptr);
@@ -761,6 +764,7 @@ static int _aac_probe_container(struct scsi_cmnd * scsicmd, int (*callback)(stru
761764
dinfo->count = cpu_to_le32(scmd_id(scsicmd));
762765
dinfo->type = cpu_to_le32(FT_FILESYS);
763766
scsicmd->SCp.ptr = (char *)callback;
767+
scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
764768

765769
status = aac_fib_send(ContainerCommand,
766770
fibptr,
@@ -772,10 +776,9 @@ static int _aac_probe_container(struct scsi_cmnd * scsicmd, int (*callback)(stru
772776
/*
773777
* Check that the command queued to the controller
774778
*/
775-
if (status == -EINPROGRESS) {
776-
scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
779+
if (status == -EINPROGRESS)
777780
return 0;
778-
}
781+
779782
if (status < 0) {
780783
scsicmd->SCp.ptr = NULL;
781784
aac_fib_complete(fibptr);
@@ -1121,6 +1124,7 @@ static int aac_get_container_serial(struct scsi_cmnd * scsicmd)
11211124
dinfo->command = cpu_to_le32(VM_ContainerConfig);
11221125
dinfo->type = cpu_to_le32(CT_CID_TO_32BITS_UID);
11231126
dinfo->cid = cpu_to_le32(scmd_id(scsicmd));
1127+
scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
11241128

11251129
status = aac_fib_send(ContainerCommand,
11261130
cmd_fibcontext,
@@ -1133,10 +1137,8 @@ static int aac_get_container_serial(struct scsi_cmnd * scsicmd)
11331137
/*
11341138
* Check that the command queued to the controller
11351139
*/
1136-
if (status == -EINPROGRESS) {
1137-
scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
1140+
if (status == -EINPROGRESS)
11381141
return 0;
1139-
}
11401142

11411143
printk(KERN_WARNING "aac_get_container_serial: aac_fib_send failed with status: %d.\n", status);
11421144
aac_fib_complete(cmd_fibcontext);
@@ -2330,16 +2332,14 @@ static int aac_read(struct scsi_cmnd * scsicmd)
23302332
* Alocate and initialize a Fib
23312333
*/
23322334
cmd_fibcontext = aac_fib_alloc_tag(dev, scsicmd);
2333-
2335+
scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
23342336
status = aac_adapter_read(cmd_fibcontext, scsicmd, lba, count);
23352337

23362338
/*
23372339
* Check that the command queued to the controller
23382340
*/
2339-
if (status == -EINPROGRESS) {
2340-
scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
2341+
if (status == -EINPROGRESS)
23412342
return 0;
2342-
}
23432343

23442344
printk(KERN_WARNING "aac_read: aac_fib_send failed with status: %d.\n", status);
23452345
/*
@@ -2424,16 +2424,14 @@ static int aac_write(struct scsi_cmnd * scsicmd)
24242424
* Allocate and initialize a Fib then setup a BlockWrite command
24252425
*/
24262426
cmd_fibcontext = aac_fib_alloc_tag(dev, scsicmd);
2427-
2427+
scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
24282428
status = aac_adapter_write(cmd_fibcontext, scsicmd, lba, count, fua);
24292429

24302430
/*
24312431
* Check that the command queued to the controller
24322432
*/
2433-
if (status == -EINPROGRESS) {
2434-
scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
2433+
if (status == -EINPROGRESS)
24352434
return 0;
2436-
}
24372435

24382436
printk(KERN_WARNING "aac_write: aac_fib_send failed with status: %d\n", status);
24392437
/*
@@ -2583,6 +2581,7 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd)
25832581
synchronizecmd->cid = cpu_to_le32(scmd_id(scsicmd));
25842582
synchronizecmd->count =
25852583
cpu_to_le32(sizeof(((struct aac_synchronize_reply *)NULL)->data));
2584+
scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
25862585

25872586
/*
25882587
* Now send the Fib to the adapter
@@ -2598,10 +2597,8 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd)
25982597
/*
25992598
* Check that the command queued to the controller
26002599
*/
2601-
if (status == -EINPROGRESS) {
2602-
scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
2600+
if (status == -EINPROGRESS)
26032601
return 0;
2604-
}
26052602

26062603
printk(KERN_WARNING
26072604
"aac_synchronize: aac_fib_send failed with status: %d.\n", status);
@@ -2661,6 +2658,7 @@ static int aac_start_stop(struct scsi_cmnd *scsicmd)
26612658
pmcmd->cid = cpu_to_le32(sdev_id(sdev));
26622659
pmcmd->parm = (scsicmd->cmnd[1] & 1) ?
26632660
cpu_to_le32(CT_PM_UNIT_IMMEDIATE) : 0;
2661+
scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
26642662

26652663
/*
26662664
* Now send the Fib to the adapter
@@ -2676,10 +2674,8 @@ static int aac_start_stop(struct scsi_cmnd *scsicmd)
26762674
/*
26772675
* Check that the command queued to the controller
26782676
*/
2679-
if (status == -EINPROGRESS) {
2680-
scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
2677+
if (status == -EINPROGRESS)
26812678
return 0;
2682-
}
26832679

26842680
aac_fib_complete(cmd_fibcontext);
26852681
aac_fib_free(cmd_fibcontext);
@@ -3198,10 +3194,11 @@ static int query_disk(struct aac_dev *dev, void __user *arg)
31983194
return -EBUSY;
31993195
if (copy_from_user(&qd, arg, sizeof (struct aac_query_disk)))
32003196
return -EFAULT;
3201-
if (qd.cnum == -1)
3197+
if (qd.cnum == -1) {
3198+
if (qd.id < 0 || qd.id >= dev->maximum_num_containers)
3199+
return -EINVAL;
32023200
qd.cnum = qd.id;
3203-
else if ((qd.bus == -1) && (qd.id == -1) && (qd.lun == -1))
3204-
{
3201+
} else if ((qd.bus == -1) && (qd.id == -1) && (qd.lun == -1)) {
32053202
if (qd.cnum < 0 || qd.cnum >= dev->maximum_num_containers)
32063203
return -EINVAL;
32073204
qd.instance = dev->scsi_host_ptr->host_no;
@@ -3686,16 +3683,14 @@ static int aac_send_srb_fib(struct scsi_cmnd* scsicmd)
36863683
* Allocate and initialize a Fib then setup a BlockWrite command
36873684
*/
36883685
cmd_fibcontext = aac_fib_alloc_tag(dev, scsicmd);
3689-
3686+
scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
36903687
status = aac_adapter_scsi(cmd_fibcontext, scsicmd);
36913688

36923689
/*
36933690
* Check that the command queued to the controller
36943691
*/
3695-
if (status == -EINPROGRESS) {
3696-
scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
3692+
if (status == -EINPROGRESS)
36973693
return 0;
3698-
}
36993694

37003695
printk(KERN_WARNING "aac_srb: aac_fib_send failed with status: %d\n", status);
37013696
aac_fib_complete(cmd_fibcontext);
@@ -3733,15 +3728,14 @@ static int aac_send_hba_fib(struct scsi_cmnd *scsicmd)
37333728
if (!cmd_fibcontext)
37343729
return -1;
37353730

3731+
scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
37363732
status = aac_adapter_hba(cmd_fibcontext, scsicmd);
37373733

37383734
/*
37393735
* Check that the command queued to the controller
37403736
*/
3741-
if (status == -EINPROGRESS) {
3742-
scsicmd->SCp.phase = AAC_OWNER_FIRMWARE;
3737+
if (status == -EINPROGRESS)
37433738
return 0;
3744-
}
37453739

37463740
pr_warn("aac_hba_cmd_req: aac_fib_send failed with status: %d\n",
37473741
status);

drivers/scsi/aacraid/aacraid.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2275,7 +2275,7 @@ struct aac_get_name_resp {
22752275
__le32 parm3;
22762276
__le32 parm4;
22772277
__le32 parm5;
2278-
u8 data[16];
2278+
u8 data[17];
22792279
};
22802280

22812281
#define CT_CID_TO_32BITS_UID 165

drivers/scsi/bnx2fc/bnx2fc_fcoe.c

Lines changed: 15 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2624,12 +2624,11 @@ static struct fcoe_transport bnx2fc_transport = {
26242624
};
26252625

26262626
/**
2627-
* bnx2fc_percpu_thread_create - Create a receive thread for an
2628-
* online CPU
2627+
* bnx2fc_cpu_online - Create a receive thread for an online CPU
26292628
*
26302629
* @cpu: cpu index for the online cpu
26312630
*/
2632-
static void bnx2fc_percpu_thread_create(unsigned int cpu)
2631+
static int bnx2fc_cpu_online(unsigned int cpu)
26332632
{
26342633
struct bnx2fc_percpu_s *p;
26352634
struct task_struct *thread;
@@ -2639,15 +2638,17 @@ static void bnx2fc_percpu_thread_create(unsigned int cpu)
26392638
thread = kthread_create_on_node(bnx2fc_percpu_io_thread,
26402639
(void *)p, cpu_to_node(cpu),
26412640
"bnx2fc_thread/%d", cpu);
2641+
if (IS_ERR(thread))
2642+
return PTR_ERR(thread);
2643+
26422644
/* bind thread to the cpu */
2643-
if (likely(!IS_ERR(thread))) {
2644-
kthread_bind(thread, cpu);
2645-
p->iothread = thread;
2646-
wake_up_process(thread);
2647-
}
2645+
kthread_bind(thread, cpu);
2646+
p->iothread = thread;
2647+
wake_up_process(thread);
2648+
return 0;
26482649
}
26492650

2650-
static void bnx2fc_percpu_thread_destroy(unsigned int cpu)
2651+
static int bnx2fc_cpu_offline(unsigned int cpu)
26512652
{
26522653
struct bnx2fc_percpu_s *p;
26532654
struct task_struct *thread;
@@ -2661,7 +2662,6 @@ static void bnx2fc_percpu_thread_destroy(unsigned int cpu)
26612662
thread = p->iothread;
26622663
p->iothread = NULL;
26632664

2664-
26652665
/* Free all work in the list */
26662666
list_for_each_entry_safe(work, tmp, &p->work_list, list) {
26672667
list_del_init(&work->list);
@@ -2673,20 +2673,6 @@ static void bnx2fc_percpu_thread_destroy(unsigned int cpu)
26732673

26742674
if (thread)
26752675
kthread_stop(thread);
2676-
}
2677-
2678-
2679-
static int bnx2fc_cpu_online(unsigned int cpu)
2680-
{
2681-
printk(PFX "CPU %x online: Create Rx thread\n", cpu);
2682-
bnx2fc_percpu_thread_create(cpu);
2683-
return 0;
2684-
}
2685-
2686-
static int bnx2fc_cpu_dead(unsigned int cpu)
2687-
{
2688-
printk(PFX "CPU %x offline: Remove Rx thread\n", cpu);
2689-
bnx2fc_percpu_thread_destroy(cpu);
26902676
return 0;
26912677
}
26922678

@@ -2761,30 +2747,16 @@ static int __init bnx2fc_mod_init(void)
27612747
spin_lock_init(&p->fp_work_lock);
27622748
}
27632749

2764-
get_online_cpus();
2765-
2766-
for_each_online_cpu(cpu)
2767-
bnx2fc_percpu_thread_create(cpu);
2768-
2769-
rc = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
2770-
"scsi/bnx2fc:online",
2771-
bnx2fc_cpu_online, NULL);
2750+
rc = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "scsi/bnx2fc:online",
2751+
bnx2fc_cpu_online, bnx2fc_cpu_offline);
27722752
if (rc < 0)
2773-
goto stop_threads;
2753+
goto stop_thread;
27742754
bnx2fc_online_state = rc;
27752755

2776-
cpuhp_setup_state_nocalls(CPUHP_SCSI_BNX2FC_DEAD, "scsi/bnx2fc:dead",
2777-
NULL, bnx2fc_cpu_dead);
2778-
put_online_cpus();
2779-
27802756
cnic_register_driver(CNIC_ULP_FCOE, &bnx2fc_cnic_cb);
2781-
27822757
return 0;
27832758

2784-
stop_threads:
2785-
for_each_online_cpu(cpu)
2786-
bnx2fc_percpu_thread_destroy(cpu);
2787-
put_online_cpus();
2759+
stop_thread:
27882760
kthread_stop(l2_thread);
27892761
free_wq:
27902762
destroy_workqueue(bnx2fc_wq);
@@ -2803,7 +2775,6 @@ static void __exit bnx2fc_mod_exit(void)
28032775
struct fcoe_percpu_s *bg;
28042776
struct task_struct *l2_thread;
28052777
struct sk_buff *skb;
2806-
unsigned int cpu = 0;
28072778

28082779
/*
28092780
* NOTE: Since cnic calls register_driver routine rtnl_lock,
@@ -2844,16 +2815,7 @@ static void __exit bnx2fc_mod_exit(void)
28442815
if (l2_thread)
28452816
kthread_stop(l2_thread);
28462817

2847-
get_online_cpus();
2848-
/* Destroy per cpu threads */
2849-
for_each_online_cpu(cpu) {
2850-
bnx2fc_percpu_thread_destroy(cpu);
2851-
}
2852-
2853-
cpuhp_remove_state_nocalls(bnx2fc_online_state);
2854-
cpuhp_remove_state_nocalls(CPUHP_SCSI_BNX2FC_DEAD);
2855-
2856-
put_online_cpus();
2818+
cpuhp_remove_state(bnx2fc_online_state);
28572819

28582820
destroy_workqueue(bnx2fc_wq);
28592821
/*

0 commit comments

Comments
 (0)