From: Johannes Berg <johannes@sipsolutions.net>
To: Pravin B Shelar <pshelar@nicira.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
Jesse Gross <jesse@nicira.com>
Subject: Re: [PATCH 1/2] genl: Fix genl dumpit() locking.
Date: Fri, 23 Aug 2013 09:20:32 +0200 [thread overview]
Message-ID: <1377242432.14021.2.camel@jlt4.sipsolutions.net> (raw)
In-Reply-To: <1377206736-18357-1-git-send-email-pshelar@nicira.com>
> @@ -572,15 +594,29 @@ static int genl_family_rcv_msg(struct
> genl_family *family,
> return -EPERM;
>
> if ((nlh->nlmsg_flags & NLM_F_DUMP) == NLM_F_DUMP) {
> - struct netlink_dump_control c = {
> - .dump = ops->dumpit,
> - .done = ops->done,
> - };
> + struct netlink_dump_control c;
> + int rc;
>
> if (ops->dumpit == NULL)
> return -EOPNOTSUPP;
>
> - return netlink_dump_start(net->genl_sock, skb, nlh,
> &c);
> + memset(&c, 0, sizeof(c));
> + if (!family->parallel_ops) {
> + genl_unlock();
> + c.data = ops;
> + c.dump = genl_lock_dumpit;
> + if (ops->done)
> + c.done = genl_lock_done;
> + } else {
> + c.dump = ops->dumpit;
> + c.done = ops->done;
> + }
> +
> + rc = netlink_dump_start(net->genl_sock, skb, nlh, &c);
> + if (!family->parallel_ops)
> + genl_lock();
> + return rc;
> +
I think this piece would be easier to read if you call
netlink_dump_start() separately in the two branches. If you also move
the "c" variable into the branches then you can keep initializing it
with an explicit initializer which would also be more readable IMHO.
Either way, this seems fine. I still think that not assigning cb_mutex
wasn't the smartest idea, but I'll reply over in the other thread.
johannes
next prev parent reply other threads:[~2013-08-23 7:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-22 21:25 [PATCH 1/2] genl: Fix genl dumpit() locking Pravin B Shelar
2013-08-23 7:20 ` Johannes Berg [this message]
2013-08-23 17:05 ` Pravin Shelar
-- strict thread matches above, loose matches on Subject: below --
2013-08-22 3:58 Pravin B Shelar
2013-08-22 7:36 ` Johannes Berg
2013-08-22 17:42 ` Pravin Shelar
2013-08-22 17:51 ` Johannes Berg
2013-08-22 17:51 ` Johannes Berg
2013-08-22 18:10 ` Pravin Shelar
2013-08-22 18:18 ` Johannes Berg
2013-08-22 20:31 ` Pravin Shelar
2013-08-23 7:29 ` Johannes Berg
2013-08-23 9:51 ` Johannes Berg
2013-08-23 20:52 ` Pravin Shelar
2013-08-26 6:06 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1377242432.14021.2.camel@jlt4.sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=jesse@nicira.com \
--cc=netdev@vger.kernel.org \
--cc=pshelar@nicira.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).