Skip to content

Commit 19a61a7

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: "Four small fixes in three drivers. The mptfusion one has actually caused user visible issues in certain kernel configurations" * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: mptfusion: Don't use GFP_ATOMIC for larger DMA allocations scsi: libfc: Skip additional kref updating work event scsi: libfc: Handling of extra kref scsi: qla2xxx: Fix a condition in qla2x00_find_all_fabric_devs()
2 parents 29206c6 + 311950f commit 19a61a7

File tree

3 files changed

+29
-27
lines changed

3 files changed

+29
-27
lines changed

drivers/message/fusion/mptbase.c

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,13 +1324,13 @@ mpt_host_page_alloc(MPT_ADAPTER *ioc, pIOCInit_t ioc_init)
13241324
return 0; /* fw doesn't need any host buffers */
13251325

13261326
/* spin till we get enough memory */
1327-
while(host_page_buffer_sz > 0) {
1328-
1329-
if((ioc->HostPageBuffer = pci_alloc_consistent(
1330-
ioc->pcidev,
1331-
host_page_buffer_sz,
1332-
&ioc->HostPageBuffer_dma)) != NULL) {
1333-
1327+
while (host_page_buffer_sz > 0) {
1328+
ioc->HostPageBuffer =
1329+
dma_alloc_coherent(&ioc->pcidev->dev,
1330+
host_page_buffer_sz,
1331+
&ioc->HostPageBuffer_dma,
1332+
GFP_KERNEL);
1333+
if (ioc->HostPageBuffer) {
13341334
dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT
13351335
"host_page_buffer @ %p, dma @ %x, sz=%d bytes\n",
13361336
ioc->name, ioc->HostPageBuffer,
@@ -2741,8 +2741,8 @@ mpt_adapter_disable(MPT_ADAPTER *ioc)
27412741
sz = ioc->alloc_sz;
27422742
dexitprintk(ioc, printk(MYIOC_s_INFO_FMT "free @ %p, sz=%d bytes\n",
27432743
ioc->name, ioc->alloc, ioc->alloc_sz));
2744-
pci_free_consistent(ioc->pcidev, sz,
2745-
ioc->alloc, ioc->alloc_dma);
2744+
dma_free_coherent(&ioc->pcidev->dev, sz, ioc->alloc,
2745+
ioc->alloc_dma);
27462746
ioc->reply_frames = NULL;
27472747
ioc->req_frames = NULL;
27482748
ioc->alloc = NULL;
@@ -2751,8 +2751,8 @@ mpt_adapter_disable(MPT_ADAPTER *ioc)
27512751

27522752
if (ioc->sense_buf_pool != NULL) {
27532753
sz = (ioc->req_depth * MPT_SENSE_BUFFER_ALLOC);
2754-
pci_free_consistent(ioc->pcidev, sz,
2755-
ioc->sense_buf_pool, ioc->sense_buf_pool_dma);
2754+
dma_free_coherent(&ioc->pcidev->dev, sz, ioc->sense_buf_pool,
2755+
ioc->sense_buf_pool_dma);
27562756
ioc->sense_buf_pool = NULL;
27572757
ioc->alloc_total -= sz;
27582758
}
@@ -2802,7 +2802,7 @@ mpt_adapter_disable(MPT_ADAPTER *ioc)
28022802
"HostPageBuffer free @ %p, sz=%d bytes\n",
28032803
ioc->name, ioc->HostPageBuffer,
28042804
ioc->HostPageBuffer_sz));
2805-
pci_free_consistent(ioc->pcidev, ioc->HostPageBuffer_sz,
2805+
dma_free_coherent(&ioc->pcidev->dev, ioc->HostPageBuffer_sz,
28062806
ioc->HostPageBuffer, ioc->HostPageBuffer_dma);
28072807
ioc->HostPageBuffer = NULL;
28082808
ioc->HostPageBuffer_sz = 0;
@@ -4497,7 +4497,8 @@ PrimeIocFifos(MPT_ADAPTER *ioc)
44974497
ioc->name, sz, sz, num_chain));
44984498

44994499
total_size += sz;
4500-
mem = pci_alloc_consistent(ioc->pcidev, total_size, &alloc_dma);
4500+
mem = dma_alloc_coherent(&ioc->pcidev->dev, total_size,
4501+
&alloc_dma, GFP_KERNEL);
45014502
if (mem == NULL) {
45024503
printk(MYIOC_s_ERR_FMT "Unable to allocate Reply, Request, Chain Buffers!\n",
45034504
ioc->name);
@@ -4574,8 +4575,8 @@ PrimeIocFifos(MPT_ADAPTER *ioc)
45744575
spin_unlock_irqrestore(&ioc->FreeQlock, flags);
45754576

45764577
sz = (ioc->req_depth * MPT_SENSE_BUFFER_ALLOC);
4577-
ioc->sense_buf_pool =
4578-
pci_alloc_consistent(ioc->pcidev, sz, &ioc->sense_buf_pool_dma);
4578+
ioc->sense_buf_pool = dma_alloc_coherent(&ioc->pcidev->dev, sz,
4579+
&ioc->sense_buf_pool_dma, GFP_KERNEL);
45794580
if (ioc->sense_buf_pool == NULL) {
45804581
printk(MYIOC_s_ERR_FMT "Unable to allocate Sense Buffers!\n",
45814582
ioc->name);
@@ -4613,18 +4614,16 @@ PrimeIocFifos(MPT_ADAPTER *ioc)
46134614

46144615
if (ioc->alloc != NULL) {
46154616
sz = ioc->alloc_sz;
4616-
pci_free_consistent(ioc->pcidev,
4617-
sz,
4618-
ioc->alloc, ioc->alloc_dma);
4617+
dma_free_coherent(&ioc->pcidev->dev, sz, ioc->alloc,
4618+
ioc->alloc_dma);
46194619
ioc->reply_frames = NULL;
46204620
ioc->req_frames = NULL;
46214621
ioc->alloc_total -= sz;
46224622
}
46234623
if (ioc->sense_buf_pool != NULL) {
46244624
sz = (ioc->req_depth * MPT_SENSE_BUFFER_ALLOC);
4625-
pci_free_consistent(ioc->pcidev,
4626-
sz,
4627-
ioc->sense_buf_pool, ioc->sense_buf_pool_dma);
4625+
dma_free_coherent(&ioc->pcidev->dev, sz, ioc->sense_buf_pool,
4626+
ioc->sense_buf_pool_dma);
46284627
ioc->sense_buf_pool = NULL;
46294628
}
46304629

drivers/scsi/libfc/fc_rport.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,10 @@ struct fc_rport_priv *fc_rport_create(struct fc_lport *lport, u32 port_id)
133133
lockdep_assert_held(&lport->disc.disc_mutex);
134134

135135
rdata = fc_rport_lookup(lport, port_id);
136-
if (rdata)
136+
if (rdata) {
137+
kref_put(&rdata->kref, fc_rport_destroy);
137138
return rdata;
139+
}
138140

139141
if (lport->rport_priv_size > 0)
140142
rport_priv_size = lport->rport_priv_size;
@@ -481,10 +483,11 @@ static void fc_rport_enter_delete(struct fc_rport_priv *rdata,
481483

482484
fc_rport_state_enter(rdata, RPORT_ST_DELETE);
483485

484-
kref_get(&rdata->kref);
485-
if (rdata->event == RPORT_EV_NONE &&
486-
!queue_work(rport_event_queue, &rdata->event_work))
487-
kref_put(&rdata->kref, fc_rport_destroy);
486+
if (rdata->event == RPORT_EV_NONE) {
487+
kref_get(&rdata->kref);
488+
if (!queue_work(rport_event_queue, &rdata->event_work))
489+
kref_put(&rdata->kref, fc_rport_destroy);
490+
}
488491

489492
rdata->event = event;
490493
}

drivers/scsi/qla2xxx/qla_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5944,7 +5944,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha)
59445944
break;
59455945
}
59465946

5947-
if (NVME_TARGET(vha->hw, fcport)) {
5947+
if (found && NVME_TARGET(vha->hw, fcport)) {
59485948
if (fcport->disc_state == DSC_DELETE_PEND) {
59495949
qla2x00_set_fcport_disc_state(fcport, DSC_GNL);
59505950
vha->fcport_count--;

0 commit comments

Comments
 (0)