Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF2CD39D6FC for ; Fri, 15 May 2026 08:35:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778834103; cv=none; b=LhAyL2RK59v9wfaM2LCSC1RJbBqf7vXOYhHamkzcF8ONUDYGD4bK+B1Db+bxI8qTozAtM0dR5H/NEchu0AE8RE3Dyj83vpi8qZsW3TWmV6AV2ce5NHESq7v3lh60xvPfB/yFv5iMizj8dH5ZuHyTPNkbaRskjgH4J++jdQEKUdc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778834103; c=relaxed/simple; bh=J+YfgonHj3/xD9IJ4zrqETVg7kXEqUkH6/d/z1scO9o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TKxf8OH90AMKPghn+3alDe+E07TNPZKpPFlFZ26Yq2zRnVF+xuvxlQ+xOWOjiri4FTkc0Jzf1hOguDDxd3owB3uHu8wbeMD3ZDgOw3BdTzW66tVL3yA6j1JqrbDLX3BTnfrfzJtlZktnwBSM8T1TdjE599LIcJf739XsmHybnVY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=INWcgTWY; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=VLtsEzkq; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="INWcgTWY"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="VLtsEzkq" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778834100; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=f4ozBn+0rPODjqtQvXUj7u7B9iwrcNai0ZrheJfjpbE=; b=INWcgTWYUCTXQ1WoRo1kuKOJtWQg+TriPfC3vM0+cfKy3CqaGJZU+01ZwG4PrRNcwUGjhW U8NVPkXv+pPaYLrSRrgXlbNGPHVyx43uvbqiNTOFghqb3WHC5WrHnnGadER23xcscujJyU 2S1QRgWOojNL7uMeQmtihcEjrVEBvFA= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-454-k-V74CdgONuqFftvAwNKOQ-1; Fri, 15 May 2026 04:34:59 -0400 X-MC-Unique: k-V74CdgONuqFftvAwNKOQ-1 X-Mimecast-MFC-AGG-ID: k-V74CdgONuqFftvAwNKOQ_1778834098 Received: by mail-ej1-f70.google.com with SMTP id a640c23a62f3a-bcf70e19516so573082166b.2 for ; Fri, 15 May 2026 01:34:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1778834098; x=1779438898; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=f4ozBn+0rPODjqtQvXUj7u7B9iwrcNai0ZrheJfjpbE=; b=VLtsEzkqUahlpDqmOI75ub/q4K1F9qxpO0lkn6QFZc8Ee1Mn9eVbGZy/tUTEwcpsIq s2at3UUk/tCyKN5n8XrZM/d8qIkVH9orKe+CM6cUXwyf1DCSyfFQuEM8OvqDL9d+hChv lkWF7FIGSpMd8qmeNL4x+PecefWhPqzM9e2Nc7rvN4CllJIsnqY9vRvJuAhtc5DFBJtm zxxOvWWTycvaz8821QjSvF0c0JgBy93q0yBIrJseiuB00+3H6MaMdn6JVHMY5RA6yUlx efopwLmCVlYOj02Fs8gkRYjD0d8ThekJ89taexyE5Z8EDxNFYruMpTsNhUAIeL/DdyWX mikQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778834098; x=1779438898; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=f4ozBn+0rPODjqtQvXUj7u7B9iwrcNai0ZrheJfjpbE=; b=iy5JGCmZbT0EB3nHjLX58I9nKNo0rFfoSkQisVov4aHUiIuCR0PsIBcxALsYdrm0uQ 3dASQNWtdn+xV7eAN4UyiUijK/vjNtNH1jB4lRPYCdfrBGNu8Q7fQDjMiq8cC21yFSea YO6KQRdWmLS45ywK2mbarWWK7dPneRxd/yIScVE0FX2THPDFVG5/CTlVlFRQgfbDu5Zi Cd8hmTI8YmfJubddyWm7h9RQSnBLfVY6DH5YlR6sjgqhpdhVdDhzkl2BK3ZttPdcygFD A3gy2x6ByXdfi3AcNelfGSc1aMMchtaRs1ih8IQR00QFTSKG90/Z+8hSl6XYFiOII3HV zmgA== X-Forwarded-Encrypted: i=1; AFNElJ+9VGhWNm0/UXPdaYXwah1qe/AsRdNp6Wh9FiZqGrsEw89+Imln68/hd/r83awQK/Fpt1jHgVFEWltxQh4=@vger.kernel.org X-Gm-Message-State: AOJu0Ywp0gZ7NFVMt8kShw+/Nz7Kec5P6sUwRjmB2NvQ9kK6zYsRYqsX yzMvplLHWH4hDs12aap62IWVcTbzFAVRUeqiU+VDCBgPpTZYolrzup+Mb1pJriztqAFsuHbX4um GVl+nNoCuoVDk3oTWDpGHzwrF9FqNOVjH48yGRAEMIhc8JHsI5dWGmrvd5zNX7HiMYQ== X-Gm-Gg: Acq92OGqG95Iai/VodSy4NCn6vNAmJzBMB4HKqZVf1keEK2Bo0tN5tg0+Yi4In9ZOL2 J9VE7eDNp9BQ89HjQHhubffwPyLG50KKFrCSLy2k+rv6Ct/h7CRRUz1eQrWGYJ9ngaZLndFe4/f ZqqEFE7lNl/g6lQl983kSYeM2RdJpXmgHoK3zeXA9ms7+N9nv8hP9d7yNYbU0UHjD14pxVV6SKI Jv5l5SRep0u6cyiPiRnbcK88zk8AynB6yBH4RtLtFSFq76Cq7c+rDPruWiTxZN9a6hve1N3OXme jCgsLLZJIixT2sE+8CBva7z3oAUBTHJ/ryxPoNKJzWT6nemrQeKzKOinfO1jCFBxPQIpUmc+gB8 WDTkH6Wj2cGjV76wcISBvuf+VVXFVVPEdE/JM1o4sIsUQ2t/tB8eVd+X8Xmpytg7CAWD/DA== X-Received: by 2002:a17:907:1b27:b0:bd4:e62e:d399 with SMTP id a640c23a62f3a-bd51797a024mr149535666b.26.1778834098211; Fri, 15 May 2026 01:34:58 -0700 (PDT) X-Received: by 2002:a17:907:1b27:b0:bd4:e62e:d399 with SMTP id a640c23a62f3a-bd51797a024mr149533466b.26.1778834097666; Fri, 15 May 2026 01:34:57 -0700 (PDT) Received: from [172.16.2.95] (5920ab7b.static.cust.trined.nl. [89.32.171.123]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-bd4f4bce1a4sm193291466b.5.2026.05.15.01.34.56 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 May 2026 01:34:57 -0700 (PDT) From: Eelco Chaudron To: Ilya Maximets Cc: netdev@vger.kernel.org, Aaron Conole , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , dev@openvswitch.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net v2] openvswitch: vport: fix race between linking and the device notifier Date: Fri, 15 May 2026 10:34:56 +0200 X-Mailer: MailMate (2.0r6292) Message-ID: <6181DD15-23BD-4236-9A91-9152BB437183@redhat.com> In-Reply-To: <20260514184702.2461435-1-i.maximets@ovn.org> References: <20260514184702.2461435-1-i.maximets@ovn.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On 14 May 2026, at 20:46, Ilya Maximets wrote: > Sashiko reports that it is technically possible that we got the device > reference, but by the time we're linking it to the OVS datapath, it > may be already in the process of being deleted. In this case if the > notifier wins the race for RTNL, it will see that the device is not > yet in the OVS datapath (ovs_netdev_get_vport() will fail in the > dp_device_event()) and will do nothing. Then the ovs_netdev_link() > will take the RTNL and link the unregistering device to OVS datapath. > > Eventually, netdev_wait_allrefs_any() will re-broadcast the event and > the device will be properly detached, but it will take at least a > second before that happens, so it's not something we should rely on. > > Let's avoid linking the non-registered device in the first place. > > Note: As per documentation, RTNL doesn't protect the reg_state, but > it actually does for all the state transitions we care about here, > so it should not be necessary to use READ_ONCE or taking the instance > lock. We can still do that, but we have a few more places even in > this file where the reg_state is accessed without those while under > RTNL, and many more places like this across the kernel code, so it > might make more sense to change all of them in a more centralized > fashion in the future, if necessary. > > Fixes: ccb1352e76cf ("net: Add Open vSwitch kernel components.") > Signed-off-by: Ilya Maximets Changes look good to me. Acked-by: Eelco Chaudron