Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1150723pxu; Wed, 2 Dec 2020 12:20:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJztTtehIOORJKylDIOoQdhPoFrTd3m0LMo4iKxJmnDGZTz5CIQnwJDsNzHmtr+xRs0Ma9Rq X-Received: by 2002:a17:906:3c04:: with SMTP id h4mr1467561ejg.220.1606940427954; Wed, 02 Dec 2020 12:20:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606940427; cv=none; d=google.com; s=arc-20160816; b=A/RhyAR+1D8hzmO19NnEEe5fTJ5YGy8hpqDiQy28EowIn/XUKHQBMKWsf4obbcQXBV YvAY27FISYrQUr3QT/FWtvIdmRL6Jw1qpKxRjgGkZm/G4MmyzYrC3cDIBPborklecRr2 DYku9dPM1Z0mBQskSF76ryuT9QKumL7g/WhC4p3x6acM1yxMki1Ch6MWi6tGATgFqUDg fWpol5u1OOJsDp5sp1Lg6wVyKtCUqjiUVLtuBfbpTFRwbFCGW4UqiEG9vSlGfFK68E+j 6xKPAN/4KDlSuuFO7MXcgukU9SqJx/TUijAF7ot5VDBq7bGkGTFwREnPNGU9ucl4Ki2A LggA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:content-transfer-encoding :content-id:mime-version:comments:references:in-reply-to:subject:cc :to:from; bh=go7LGOTgJwDJ8hrATBMvE3Zj4mDCY9pD6v2VfU9xw5Y=; b=zvTmF7Ayayr+7Oakh92XHg0C+Wj/CRD+y4UqNoVyLhwKBXDYNzqwGi0/oyq9OYRcpo EpchkuhkaSaWkzjZ7xoBY0WH6XHakwWPix4SaZTXE69hDJJzQyfym6kfg4qw2bltRi1Y zOx+zAxkhh3ozFMvnqLNsXeDTMZTzIFpC7ItrrGMsKXBsyqZfs8lz03dPuyrjlrCTtYT 8/ZumUyc68m1xVxhlHIocYsRjrazwRA1hlneh0R8oxXG2gAgwccYLhfPAWZUeF6sQWu1 fiK3zlai0LRdUZH8QjGJIn5UNoqECR3QM1DM3V6OWRaUR7+rel03OEk1x5g82n0BsPLZ vj9A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t17si613523ejj.562.2020.12.02.12.20.01; Wed, 02 Dec 2020 12:20:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388083AbgLBUSP convert rfc822-to-8bit (ORCPT + 99 others); Wed, 2 Dec 2020 15:18:15 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:54630 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387412AbgLBUSO (ORCPT ); Wed, 2 Dec 2020 15:18:14 -0500 Received: from 1.general.jvosburgh.uk.vpn ([10.172.196.206] helo=famine.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kkYZ6-0001rP-14; Wed, 02 Dec 2020 20:17:28 +0000 Received: by famine.localdomain (Postfix, from userid 1000) id 657595FEE8; Wed, 2 Dec 2020 12:17:26 -0800 (PST) Received: from famine (localhost [127.0.0.1]) by famine.localdomain (Postfix) with ESMTP id 5F9249FAB0; Wed, 2 Dec 2020 12:17:26 -0800 (PST) From: Jay Vosburgh To: Jarod Wilson cc: LKML , Ivan Vecera , Veaceslav Falico , Andy Gospodarek , "David S. Miller" , Jakub Kicinski , Thomas Davis , Netdev Subject: Re: [PATCH net v2] bonding: fix feature flag setting at init time In-reply-to: References: <20201123031716.6179-1-jarod@redhat.com> <20201202173053.13800-1-jarod@redhat.com> <14711.1606931728@famine> Comments: In-reply-to Jarod Wilson message dated "Wed, 02 Dec 2020 14:23:00 -0500." X-Mailer: MH-E 8.6+git; nmh 1.6; GNU Emacs 27.0.50 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <21152.1606940246.1@famine> Content-Transfer-Encoding: 8BIT Date: Wed, 02 Dec 2020 12:17:26 -0800 Message-ID: <21153.1606940246@famine> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jarod Wilson wrote: >On Wed, Dec 2, 2020 at 12:55 PM Jay Vosburgh wrote: >> >> Jarod Wilson wrote: >> >> >Don't try to adjust XFRM support flags if the bond device isn't yet >> >registered. Bad things can currently happen when netdev_change_features() >> >is called without having wanted_features fully filled in yet. Basically, >> >this code was racing against register_netdevice() filling in >> >wanted_features, and when it got there first, the empty wanted_features >> >led to features also getting emptied out, which was definitely not the >> >intended behavior, so prevent that from happening. >> >> Is this an actual race? Reading Ivan's prior message, it sounds >> like it's an ordering problem (in that bond_newlink calls >> register_netdevice after bond_changelink). > >Sorry, yeah, this is not actually a race condition, just an ordering >issue, bond_check_params() gets called at init time, which leads to >bond_option_mode_set() being called, and does so prior to >bond_create() running, which is where we actually call >register_netdevice(). So this only happens if there's a "mode" module parameter? That doesn't sound like the call path that Ivan described (coming in via bond_newlink). -J >> The change to bond_option_mode_set tests against reg_state, so >> presumably it wants to skip the first(?) time through, before the >> register_netdevice call; is that right? > >Correct. Later on, when the bonding driver is already loaded, and >parameter changes are made, bond_option_mode_set() gets called and if >the mode changes to or from active-backup, we do need/want this code >to run to update wanted and features flags properly. > > >-- >Jarod Wilson >jarod@redhat.com --- -Jay Vosburgh, jay.vosburgh@canonical.com