Commit e322fedf authored by Michael S. Tsirkin's avatar Michael S. Tsirkin Committed by Linus Torvalds

[PATCH] IB/core: use correct gfp_mask in sa_query

Avoid bogus out of memory errors: fix sa_query to actually pass gfp_mask
supplied by the user to idr_pre_get.
Signed-off-by: default avatarMichael S. Tsirkin <mst@mellanox.co.il>
Acked-by: default avatar"Sean Hefty" <mshefty@ichips.intel.com>
Acked-by: default avatar"Roland Dreier" <rdreier@cisco.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent adfaa888
...@@ -488,13 +488,13 @@ static void init_mad(struct ib_sa_mad *mad, struct ib_mad_agent *agent) ...@@ -488,13 +488,13 @@ static void init_mad(struct ib_sa_mad *mad, struct ib_mad_agent *agent)
spin_unlock_irqrestore(&tid_lock, flags); spin_unlock_irqrestore(&tid_lock, flags);
} }
static int send_mad(struct ib_sa_query *query, int timeout_ms) static int send_mad(struct ib_sa_query *query, int timeout_ms, gfp_t gfp_mask)
{ {
unsigned long flags; unsigned long flags;
int ret, id; int ret, id;
retry: retry:
if (!idr_pre_get(&query_idr, GFP_ATOMIC)) if (!idr_pre_get(&query_idr, gfp_mask))
return -ENOMEM; return -ENOMEM;
spin_lock_irqsave(&idr_lock, flags); spin_lock_irqsave(&idr_lock, flags);
ret = idr_get_new(&query_idr, query, &id); ret = idr_get_new(&query_idr, query, &id);
...@@ -630,7 +630,7 @@ int ib_sa_path_rec_get(struct ib_device *device, u8 port_num, ...@@ -630,7 +630,7 @@ int ib_sa_path_rec_get(struct ib_device *device, u8 port_num,
*sa_query = &query->sa_query; *sa_query = &query->sa_query;
ret = send_mad(&query->sa_query, timeout_ms); ret = send_mad(&query->sa_query, timeout_ms, gfp_mask);
if (ret < 0) if (ret < 0)
goto err2; goto err2;
...@@ -752,7 +752,7 @@ int ib_sa_service_rec_query(struct ib_device *device, u8 port_num, u8 method, ...@@ -752,7 +752,7 @@ int ib_sa_service_rec_query(struct ib_device *device, u8 port_num, u8 method,
*sa_query = &query->sa_query; *sa_query = &query->sa_query;
ret = send_mad(&query->sa_query, timeout_ms); ret = send_mad(&query->sa_query, timeout_ms, gfp_mask);
if (ret < 0) if (ret < 0)
goto err2; goto err2;
...@@ -844,7 +844,7 @@ int ib_sa_mcmember_rec_query(struct ib_device *device, u8 port_num, ...@@ -844,7 +844,7 @@ int ib_sa_mcmember_rec_query(struct ib_device *device, u8 port_num,
*sa_query = &query->sa_query; *sa_query = &query->sa_query;
ret = send_mad(&query->sa_query, timeout_ms); ret = send_mad(&query->sa_query, timeout_ms, gfp_mask);
if (ret < 0) if (ret < 0)
goto err2; goto err2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment