From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85773C433EF for ; Tue, 17 May 2022 22:33:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231400AbiEQWdh (ORCPT ); Tue, 17 May 2022 18:33:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231336AbiEQWdc (ORCPT ); Tue, 17 May 2022 18:33:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 727483EABD; Tue, 17 May 2022 15:33:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C93356132C; Tue, 17 May 2022 22:33:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E060AC385B8; Tue, 17 May 2022 22:33:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652826808; bh=fMWd8B6Azz1Yz4Q3JOgMXGVN+v5a30E1TxzHvyasM/E=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Ef8kauu7i4yL96jbmNJ8mid/7sgRdte2U9SyhJ5bRw/wbmgD6shB6YPtkZAwhJda8 kWpfVmxQ/tGMgicfnMaqkXz0BG9a6U50A+Kc8UNDkr3tvKoJ18kv9fh9Fd0d7pzrzR KKB02cmMlYDKFukiBLCIrmoGs+YJhn6qPkeV2o6MjdnnrbfN/ljm6z2ecXCcgxfcsQ g4AF/UcVvryB9rTWbMzG6gW+ptOVJEs0YM68i2XRuZS+uO1CKCF8QLRL/5C/wmCUuf o+FpdZ4UJaQyLJGhqP83LlE0FhD/QxuCXZfgxHpazA5Y8D51KLXcFCGhaxKScObtUZ TJ4oWJB74GTSg== Date: Tue, 17 May 2022 15:33:26 -0700 From: Jakub Kicinski To: Jay Vosburgh Cc: Jonathan Toppins , netdev@vger.kernel.org, Veaceslav Falico , Andy Gospodarek , "David S. Miller" , Eric Dumazet , Paolo Abeni , linux-kernel@vger.kernel.org Subject: Re: [RFC net-next] bonding: netlink error message support for options Message-ID: <20220517153326.1fbbe2cc@kernel.org> In-Reply-To: <2125.1652821874@famine> References: <5a6ba6f14b0fad6d4ba077a5230ee71cbf970934.1652819479.git.jtoppins@redhat.com> <2125.1652821874@famine> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, 17 May 2022 14:11:14 -0700 Jay Vosburgh wrote: > If I'm reading the code correctly, rtnl isn't held that long. > Once the ->doit() returns, rtnl is dropped, but the copy happens later: > > rtnetlink_rcv() > netlink_rcv_skb(skb, &rtnetlink_rcv_msg) > rtnetlink_rcv_msg() [ as cb(skb, nlh, &extack) ] > rtnl_lock() > link->doit() [ rtnl_setlink, rtnl_newlink, et al ] > rtnl_unlock() > netlink_ack() > > inside netlink_ack(): > > if (nlk_has_extack && extack) { > if (extack->_msg) { > WARN_ON(nla_put_string(skb, NLMSGERR_ATTR_MSG, > extack->_msg)); > } Indeed. > Even if the strings have to be constant (via NL_SET_ERR_MSG), > adding extack messages is likely still an improvement. At a quick glance it seems like the major use of the printf here is to point at a particular option. If options are carried in individual attributes pointing at the right attribute with NL_SET_ERR_MSG_ATTR() should also be helpful. Maybe that's stating the obvious.