From: Milan Broz <mbroz@redhat.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: device-mapper development <dm-devel@redhat.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Kay Sievers <kay.sievers@vrfy.org>,
"David S. Miller" <davem@davemloft.net>,
containers@lists.osdl.org
Subject: Re: [dm-devel] clone() with CLONE_NEWNET breaks kobject_uevent_env()
Date: Fri, 19 Aug 2011 22:41:01 +0200 [thread overview]
Message-ID: <4E4ECA5D.1020907@redhat.com> (raw)
In-Reply-To: <m1vctt2qlj.fsf@fess.ebiederm.org>
On 08/19/2011 08:39 PM, Eric W. Biederman wrote:
> But Kay's suggestion to use netlink_has_listeners() seems like good
> idea. IOW if there is no listener, it should skip quietly and not
> fail the whole call...
> In the case of ESRCH I completely agree.
>
> We are currently ignoring errors in the semantically more interesting
> case when netlink_broadcast does not deliver the packet to one of the
> listening netlink sockets.
>
> How does this patch look?
Well, your version still returns -ESRCH, so it is not helping much :-)
If you meant to handle it like I fixed in patch below (ignore ESRCH)
then I am ok with that approach, patch below fixes the problem
we have.
Thanks,
Milan
diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index 70af0a7..04b2ed2 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -139,6 +139,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
u64 seq;
int i = 0;
int retval = 0;
+ bool delivery_failure;
#ifdef CONFIG_NET
struct uevent_sock *ue_sk;
#endif
@@ -251,6 +252,7 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
if (retval)
goto exit;
+ delivery_failure = false;
#if defined(CONFIG_NET)
/* send netlink message */
mutex_lock(&uevent_sock_mutex);
@@ -281,14 +283,17 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
0, 1, GFP_KERNEL,
kobj_bcast_filter,
kobj);
- /* ENOBUFS should be handled in userspace */
- if (retval == -ENOBUFS)
+ if (retval == -ESRCH)
retval = 0;
+ else if (retval)
+ delivery_failure = true;
} else
- retval = -ENOMEM;
+ delivery_failure = true;
}
mutex_unlock(&uevent_sock_mutex);
#endif
+ if (delivery_failure)
+ retval = -ENOBUFS;
/* call uevent_helper, usually only enabled during early boot */
if (uevent_helper[0] && !kobj_usermode_filter(kobj)) {
next prev parent reply other threads:[~2011-08-19 20:41 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-18 9:45 clone() with CLONE_NEWNET breaks kobject_uevent_env() Milan Broz
2011-08-19 7:52 ` Milan Broz
2011-08-19 9:13 ` [dm-devel] " Eric W. Biederman
2011-08-19 9:13 ` Eric W. Biederman
2011-08-19 10:22 ` Milan Broz
2011-08-19 11:43 ` Eric W. Biederman
2011-08-19 11:59 ` Milan Broz
2011-08-19 18:39 ` Eric W. Biederman
2011-08-19 20:41 ` Milan Broz [this message]
2011-08-22 13:51 ` [PATCH] kobj_uevent: Ignore if some listeners cannot handle message Milan Broz
2011-08-22 16:24 ` Kay Sievers
2011-08-22 19:49 ` Eric W. Biederman
2011-08-22 20:05 ` Milan Broz
2011-08-19 10:26 ` [dm-devel] clone() with CLONE_NEWNET breaks kobject_uevent_env() Kay Sievers
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=4E4ECA5D.1020907@redhat.com \
--to=mbroz@redhat.com \
--cc=containers@lists.osdl.org \
--cc=davem@davemloft.net \
--cc=dm-devel@redhat.com \
--cc=ebiederm@xmission.com \
--cc=kay.sievers@vrfy.org \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.