From owner-svn-src-all@freebsd.org Mon May 21 08:02:42 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7258EE77CE; Mon, 21 May 2018 08:02:41 +0000 (UTC) (envelope-from mmacy@freebsd.org) Received: from smtp.freebsd.org (unknown [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 858D2727E6; Mon, 21 May 2018 08:02:41 +0000 (UTC) (envelope-from mmacy@freebsd.org) Received: from mail-io0-f178.google.com (mail-io0-f178.google.com [209.85.223.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) (Authenticated sender: mmacy) by smtp.freebsd.org (Postfix) with ESMTPSA id 507181404B; Mon, 21 May 2018 08:02:41 +0000 (UTC) (envelope-from mmacy@freebsd.org) Received: by mail-io0-f178.google.com with SMTP id a10-v6so13328577ioc.9; Mon, 21 May 2018 01:02:41 -0700 (PDT) X-Gm-Message-State: ALKqPwfnqcUxeTd79uwbtsChGVKx0FMOD33o8tiHAPTxwwl/wfI7c78u NVj04ncH6Y9z/q1nRuhqSkDROT4q+wbcuvF+3MM= X-Google-Smtp-Source: AB8JxZr+TuSzbMeYoOf1kPZ2f0dqdjkV2En+8ljNyXjzJ3hzpHoIN+z3Pmcumtt1ZrgLiAcABNwnE9aXDeBrrKj3qBU= X-Received: by 2002:a6b:a712:: with SMTP id q18-v6mr20050398ioe.237.1526889760614; Mon, 21 May 2018 01:02:40 -0700 (PDT) MIME-Version: 1.0 References: <201805210712.w4L7C62h081191@repo.freebsd.org> <20180521094734.3270cccb@x23.koncar-institut.local> In-Reply-To: <20180521094734.3270cccb@x23.koncar-institut.local> From: Matthew Macy Date: Mon, 21 May 2018 01:02:29 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r333967 - head/sys/netinet To: Marko Zec Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.26 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 May 2018 08:02:42 -0000 Thanks On Mon, May 21, 2018 at 00:47 Marko Zec wrote: > On Mon, 21 May 2018 07:12:06 +0000 > Matt Macy wrote: > > > Author: mmacy > > Date: Mon May 21 07:12:06 2018 > > New Revision: 333967 > > URL: https://svnweb.freebsd.org/changeset/base/333967 > > > > Log: > > ensure that vnet is set when doing in_leavegroup > > > > Modified: > > head/sys/netinet/in_mcast.c > > > > Modified: head/sys/netinet/in_mcast.c > > > ============================================================================== > > --- head/sys/netinet/in_mcast.c Mon May 21 05:20:23 > > 2018 (r333966) +++ head/sys/netinet/in_mcast.c Mon May > > 21 07:12:06 2018 (r333967) @@ -1664,6 +1664,8 @@ > > inp_gcmoptions(epoch_context_t ctx) { > > struct ip_moptions *imo; > > struct in_mfilter *imf; > > + struct in_multi *inm; > > + struct ifnet *ifp; > > size_t idx, nmships; > > > > imo = __containerof(ctx, struct ip_moptions, imo_epoch_ctx); > > @@ -1673,7 +1675,13 @@ inp_gcmoptions(epoch_context_t ctx) > > imf = imo->imo_mfilters ? &imo->imo_mfilters[idx] : > > NULL; if (imf) > > imf_leave(imf); > > - (void)in_leavegroup(imo->imo_membership[idx], imf); > > + inm = imo->imo_membership[idx]; > > + ifp = inm->inm_ifp; > > + if (ifp) > > + CURVNET_SET(ifp->if_vnet); > > Unfortunately, this won't work because CURVNET_SET() expands to a > sequence of declarations and assignments which are NOT enclosed in a > single block. Instead, only the first statement in CURVNET_SET() > sequence, which is an assert, will be executed conditionally only if > ifp != NULL, while the rest of the CURVNET_SET() body will fall out of > the scope of the if (ifp) conditional. > > I'd recommend backing out this patch, and instead extending the struct > ip_moptions with an struct vnet * entry, which would be populated > before scheduling inp_gcmoptions(). Then CURVNET_SET(imo->imo_vnet) > could be called only once (and unconditionally) in gcmoptions(), > instead of (attempts at) doing this multiple times in a for loop. > > Marko > > > > + (void)in_leavegroup(inm, imf); > > + if (ifp) > > + CURVNET_RESTORE(); > > if (imf) > > imf_purge(imf); > > } > > > >