* [1/1] connector: Bugfix for cn_call_callback()
@ 2007-03-07 12:10 Evgeniy Polyakov
2007-03-07 20:55 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Evgeniy Polyakov @ 2007-03-07 12:10 UTC (permalink / raw)
To: David Miller; +Cc: Philipp Reisner, Lars Ellenberg, netdev
When system under heavy stress and must allocate new work
instead of reusing old one, new work must use correct
completion callback.
Patch is based on Philipp's and Lars' work.
I only cleaned small stuff (and removed spaces instead of tabs).
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index a44db75..a905f78 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -128,7 +128,7 @@ EXPORT_SYMBOL_GPL(cn_netlink_send);
*/
static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), void *data)
{
- struct cn_callback_entry *__cbq;
+ struct cn_callback_entry *__cbq, *__new_cbq;
struct cn_dev *dev = &cdev;
int err = -ENODEV;
@@ -148,27 +148,27 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v
} else {
struct cn_callback_data *d;
- __cbq = kzalloc(sizeof(*__cbq), GFP_ATOMIC);
- if (__cbq) {
- d = &__cbq->data;
+ err = -ENOMEM;
+ __new_cbq = kzalloc(sizeof(struct cn_callback_entry), GFP_ATOMIC);
+ if (__new_cbq) {
+ d = &__new_cbq->data;
d->callback_priv = msg;
d->callback = __cbq->data.callback;
d->ddata = data;
d->destruct_data = destruct_data;
- d->free = __cbq;
+ d->free = __new_cbq;
- INIT_WORK(&__cbq->work,
+ INIT_WORK(&__new_cbq->work,
&cn_queue_wrapper);
-
+
if (queue_work(dev->cbdev->cn_queue,
- &__cbq->work))
+ &__new_cbq->work))
err = 0;
else {
- kfree(__cbq);
+ kfree(__new_cbq);
err = -EINVAL;
}
- } else
- err = -ENOMEM;
+ }
}
break;
}
--
Evgeniy Polyakov
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [1/1] connector: Bugfix for cn_call_callback()
2007-03-07 12:10 [1/1] connector: Bugfix for cn_call_callback() Evgeniy Polyakov
@ 2007-03-07 20:55 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2007-03-07 20:55 UTC (permalink / raw)
To: johnpol; +Cc: philipp.reisner, lars.ellenberg, netdev
From: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Date: Wed, 7 Mar 2007 15:10:30 +0300
> When system under heavy stress and must allocate new work
> instead of reusing old one, new work must use correct
> completion callback.
>
> Patch is based on Philipp's and Lars' work.
> I only cleaned small stuff (and removed spaces instead of tabs).
>
> Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
> Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Applied, thank you.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-03-07 20:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-07 12:10 [1/1] connector: Bugfix for cn_call_callback() Evgeniy Polyakov
2007-03-07 20:55 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).