diff mbox

iscsi: Use GFP_ATOMIC in iscsi_offload_mesg().

Message ID 1248893392.16148.262.camel@HP1
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Michael Chan July 29, 2009, 6:49 p.m. UTC
Changing to GFP_ATOMIC because the only caller in cnic/bnx2i may
be calling this function while holding spin_lock.

This problem was discovered by Mike Christie.

Signed-off-by: Michael Chan <mchan@broadcom.com>
---
 drivers/scsi/scsi_transport_iscsi.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Comments

Mike Christie July 30, 2009, 1:40 a.m. UTC | #1
On 07/29/2009 01:49 PM, Michael Chan wrote:
> Changing to GFP_ATOMIC because the only caller in cnic/bnx2i may
> be calling this function while holding spin_lock.
>
> This problem was discovered by Mike Christie.
>
> Signed-off-by: Michael Chan<mchan@broadcom.com>
> ---
>   drivers/scsi/scsi_transport_iscsi.c |    4 ++--
>   1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
> index 783e33c..b47240c 100644
> --- a/drivers/scsi/scsi_transport_iscsi.c
> +++ b/drivers/scsi/scsi_transport_iscsi.c
> @@ -990,7 +990,7 @@ int iscsi_offload_mesg(struct Scsi_Host *shost,
>   	struct iscsi_uevent *ev;
>   	int len = NLMSG_SPACE(sizeof(*ev) + data_size);
>
> -	skb = alloc_skb(len, GFP_NOIO);
> +	skb = alloc_skb(len, GFP_ATOMIC);
>   	if (!skb) {
>   		printk(KERN_ERR "can not deliver iscsi offload message:OOM\n");
>   		return -ENOMEM;
> @@ -1012,7 +1012,7 @@ int iscsi_offload_mesg(struct Scsi_Host *shost,
>
>   	memcpy((char *)ev + sizeof(*ev), data, data_size);
>
> -	return iscsi_multicast_skb(skb, ISCSI_NL_GRP_UIP, GFP_NOIO);
> +	return iscsi_multicast_skb(skb, ISCSI_NL_GRP_UIP, GFP_ATOMIC);
>   }
>   EXPORT_SYMBOL_GPL(iscsi_offload_mesg);
>

Using GFP_NOIO and changing the locking is my preference normally,  but 
if the locking changes are going to be a problem, then this is ok with 
me since we can fail allocations in other parts of the code.

Acked-by: Mike Christie <michaelc@cs.wisc.edu>

Dave Miller probably wants to take this in his tree since it fixes a bug 
with this patch
http://git.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commit;h=6d7760a88c25057c2c2243e5dfe2d731064bd31d
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller July 30, 2009, 6:04 p.m. UTC | #2
From: Mike Christie <michaelc@cs.wisc.edu>
Date: Wed, 29 Jul 2009 20:40:50 -0500

> On 07/29/2009 01:49 PM, Michael Chan wrote:
>> Changing to GFP_ATOMIC because the only caller in cnic/bnx2i may
>> be calling this function while holding spin_lock.
>>
>> This problem was discovered by Mike Christie.
>>
>> Signed-off-by: Michael Chan<mchan@broadcom.com>
 ...
> Acked-by: Mike Christie <michaelc@cs.wisc.edu>
> 
> Dave Miller probably wants to take this in his tree since it fixes a
> bug with this patch
> http://git.kernel.org/?p=linux/kernel/git/davem/net-2.6.git;a=commit;h=6d7760a88c25057c2c2243e5dfe2d731064bd31d

Yep I'll take it, thanks everyone.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 783e33c..b47240c 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -990,7 +990,7 @@  int iscsi_offload_mesg(struct Scsi_Host *shost,
 	struct iscsi_uevent *ev;
 	int len = NLMSG_SPACE(sizeof(*ev) + data_size);
 
-	skb = alloc_skb(len, GFP_NOIO);
+	skb = alloc_skb(len, GFP_ATOMIC);
 	if (!skb) {
 		printk(KERN_ERR "can not deliver iscsi offload message:OOM\n");
 		return -ENOMEM;
@@ -1012,7 +1012,7 @@  int iscsi_offload_mesg(struct Scsi_Host *shost,
 
 	memcpy((char *)ev + sizeof(*ev), data, data_size);
 
-	return iscsi_multicast_skb(skb, ISCSI_NL_GRP_UIP, GFP_NOIO);
+	return iscsi_multicast_skb(skb, ISCSI_NL_GRP_UIP, GFP_ATOMIC);
 }
 EXPORT_SYMBOL_GPL(iscsi_offload_mesg);