Skip to content

Commit ef0a599

Browse files
committed
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI fixes from James Bottomley: "This is a set of two small fixes, both to code which went in during the merge window: cxgb4i has a scheduling in atomic bug in its new ipv6 code and uas fails to work properly with the new scsi-mq code" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: [SCSI] uas: disable use of blk-mq I/O path [SCSI] cxgb4i: avoid holding mutex in interrupt context
2 parents 7b6ea43 + 2c2d831 commit ef0a599

4 files changed

Lines changed: 62 additions & 7 deletions

File tree

‎drivers/scsi/cxgbi/cxgb4i/cxgb4i.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1647,7 +1647,7 @@ static int cxgbi_inet6addr_handler(struct notifier_block *this,
16471647
if (event_dev->priv_flags & IFF_802_1Q_VLAN)
16481648
event_dev = vlan_dev_real_dev(event_dev);
16491649

1650-
cdev = cxgbi_device_find_by_netdev(event_dev, NULL);
1650+
cdev = cxgbi_device_find_by_netdev_rcu(event_dev, NULL);
16511651

16521652
if (!cdev)
16531653
return ret;

‎drivers/scsi/cxgbi/libcxgbi.c‎

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ MODULE_PARM_DESC(dbg_level, "libiscsi debug level (default=0)");
5757
static LIST_HEAD(cdev_list);
5858
static DEFINE_MUTEX(cdev_mutex);
5959

60+
static LIST_HEAD(cdev_rcu_list);
61+
static DEFINE_SPINLOCK(cdev_rcu_lock);
62+
6063
int cxgbi_device_portmap_create(struct cxgbi_device *cdev, unsigned int base,
6164
unsigned int max_conn)
6265
{
@@ -142,6 +145,10 @@ struct cxgbi_device *cxgbi_device_register(unsigned int extra,
142145
list_add_tail(&cdev->list_head, &cdev_list);
143146
mutex_unlock(&cdev_mutex);
144147

148+
spin_lock(&cdev_rcu_lock);
149+
list_add_tail_rcu(&cdev->rcu_node, &cdev_rcu_list);
150+
spin_unlock(&cdev_rcu_lock);
151+
145152
log_debug(1 << CXGBI_DBG_DEV,
146153
"cdev 0x%p, p# %u.\n", cdev, nports);
147154
return cdev;
@@ -153,9 +160,16 @@ void cxgbi_device_unregister(struct cxgbi_device *cdev)
153160
log_debug(1 << CXGBI_DBG_DEV,
154161
"cdev 0x%p, p# %u,%s.\n",
155162
cdev, cdev->nports, cdev->nports ? cdev->ports[0]->name : "");
163+
156164
mutex_lock(&cdev_mutex);
157165
list_del(&cdev->list_head);
158166
mutex_unlock(&cdev_mutex);
167+
168+
spin_lock(&cdev_rcu_lock);
169+
list_del_rcu(&cdev->rcu_node);
170+
spin_unlock(&cdev_rcu_lock);
171+
synchronize_rcu();
172+
159173
cxgbi_device_destroy(cdev);
160174
}
161175
EXPORT_SYMBOL_GPL(cxgbi_device_unregister);
@@ -167,12 +181,9 @@ void cxgbi_device_unregister_all(unsigned int flag)
167181
mutex_lock(&cdev_mutex);
168182
list_for_each_entry_safe(cdev, tmp, &cdev_list, list_head) {
169183
if ((cdev->flags & flag) == flag) {
170-
log_debug(1 << CXGBI_DBG_DEV,
171-
"cdev 0x%p, p# %u,%s.\n",
172-
cdev, cdev->nports, cdev->nports ?
173-
cdev->ports[0]->name : "");
174-
list_del(&cdev->list_head);
175-
cxgbi_device_destroy(cdev);
184+
mutex_unlock(&cdev_mutex);
185+
cxgbi_device_unregister(cdev);
186+
mutex_lock(&cdev_mutex);
176187
}
177188
}
178189
mutex_unlock(&cdev_mutex);
@@ -191,6 +202,7 @@ struct cxgbi_device *cxgbi_device_find_by_lldev(void *lldev)
191202
}
192203
}
193204
mutex_unlock(&cdev_mutex);
205+
194206
log_debug(1 << CXGBI_DBG_DEV,
195207
"lldev 0x%p, NO match found.\n", lldev);
196208
return NULL;
@@ -230,6 +242,39 @@ struct cxgbi_device *cxgbi_device_find_by_netdev(struct net_device *ndev,
230242
}
231243
EXPORT_SYMBOL_GPL(cxgbi_device_find_by_netdev);
232244

245+
struct cxgbi_device *cxgbi_device_find_by_netdev_rcu(struct net_device *ndev,
246+
int *port)
247+
{
248+
struct net_device *vdev = NULL;
249+
struct cxgbi_device *cdev;
250+
int i;
251+
252+
if (ndev->priv_flags & IFF_802_1Q_VLAN) {
253+
vdev = ndev;
254+
ndev = vlan_dev_real_dev(ndev);
255+
pr_info("vlan dev %s -> %s.\n", vdev->name, ndev->name);
256+
}
257+
258+
rcu_read_lock();
259+
list_for_each_entry_rcu(cdev, &cdev_rcu_list, rcu_node) {
260+
for (i = 0; i < cdev->nports; i++) {
261+
if (ndev == cdev->ports[i]) {
262+
cdev->hbas[i]->vdev = vdev;
263+
rcu_read_unlock();
264+
if (port)
265+
*port = i;
266+
return cdev;
267+
}
268+
}
269+
}
270+
rcu_read_unlock();
271+
272+
log_debug(1 << CXGBI_DBG_DEV,
273+
"ndev 0x%p, %s, NO match found.\n", ndev, ndev->name);
274+
return NULL;
275+
}
276+
EXPORT_SYMBOL_GPL(cxgbi_device_find_by_netdev_rcu);
277+
233278
static struct cxgbi_device *cxgbi_device_find_by_mac(struct net_device *ndev,
234279
int *port)
235280
{

‎drivers/scsi/cxgbi/libcxgbi.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ struct cxgbi_ports_map {
527527
#define CXGBI_FLAG_IPV4_SET 0x10
528528
struct cxgbi_device {
529529
struct list_head list_head;
530+
struct list_head rcu_node;
530531
unsigned int flags;
531532
struct net_device **ports;
532533
void *lldev;
@@ -709,6 +710,8 @@ void cxgbi_device_unregister(struct cxgbi_device *);
709710
void cxgbi_device_unregister_all(unsigned int flag);
710711
struct cxgbi_device *cxgbi_device_find_by_lldev(void *);
711712
struct cxgbi_device *cxgbi_device_find_by_netdev(struct net_device *, int *);
713+
struct cxgbi_device *cxgbi_device_find_by_netdev_rcu(struct net_device *,
714+
int *);
712715
int cxgbi_hbas_add(struct cxgbi_device *, u64, unsigned int,
713716
struct scsi_host_template *,
714717
struct scsi_transport_template *);

‎drivers/usb/storage/uas.c‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -970,6 +970,13 @@ static struct scsi_host_template uas_host_template = {
970970
.cmd_per_lun = 1, /* until we override it */
971971
.skip_settle_delay = 1,
972972
.ordered_tag = 1,
973+
974+
/*
975+
* The uas drivers expects tags not to be bigger than the maximum
976+
* per-device queue depth, which is not true with the blk-mq tag
977+
* allocator.
978+
*/
979+
.disable_blk_mq = true,
973980
};
974981

975982
#define UNUSUAL_DEV(id_vendor, id_product, bcdDeviceMin, bcdDeviceMax, \

0 commit comments

Comments
 (0)