From patchwork Fri Aug 19 20:41:01 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Milan Broz X-Patchwork-Id: 1081782 Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7JKhRAN017521 for ; Fri, 19 Aug 2011 20:43:48 GMT Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p7JKfBsS002033; Fri, 19 Aug 2011 16:41:12 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p7JKf9xX027821 for ; Fri, 19 Aug 2011 16:41:09 -0400 Received: from [10.36.6.186] (vpn1-6-186.ams2.redhat.com [10.36.6.186]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p7JKf2gv001337; Fri, 19 Aug 2011 16:41:02 -0400 Message-ID: <4E4ECA5D.1020907@redhat.com> Date: Fri, 19 Aug 2011 22:41:01 +0200 From: Milan Broz User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20110807 Thunderbird/5.0 MIME-Version: 1.0 To: "Eric W. Biederman" References: <4E4CDF44.5080109@redhat.com> <4E4E395B.7070106@redhat.com> <4E4E503B.3050406@redhat.com> In-Reply-To: X-Enigmail-Version: 1.2.1 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: dm-devel@redhat.com Cc: containers@lists.osdl.org, device-mapper development , Kay Sievers , Linux Kernel Mailing List , "David S. Miller" Subject: Re: [dm-devel] clone() with CLONE_NEWNET breaks kobject_uevent_env() X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 19 Aug 2011 20:43:48 +0000 (UTC) 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 --- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel 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)) {