Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2019574rwd; Wed, 17 May 2023 04:49:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7N5icLQkc2P63LLo0FJ04jeP8WDw/ygogjqwMEi3Xyxq0FB/WiNDDoUiRV6MjCCuLfwMaS X-Received: by 2002:a05:6a20:7f8f:b0:107:277a:ae29 with SMTP id d15-20020a056a207f8f00b00107277aae29mr5612982pzj.5.1684324180101; Wed, 17 May 2023 04:49:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684324180; cv=none; d=google.com; s=arc-20160816; b=DIzWKjToTPu7yYX6w8mG2/vdxDez9AXVF0tMxGGbV+iKlIzz82XOWk9oLtLCcsB9x/ JwbXPQuzTolkwMd97DABXloRZ5hJF7Qd6khaDE1nmW3w2R2VlmVKaquTncmZs8s6Yed8 oilRBJR+C9G0PZbQoeDXuRYs6IyMeg0Jth9bePc7CzuuAZ9URgyINVi2ueHRblrTedHL uVdA2HGLWvVpTCBcj2wbKeUxHfazqpqZuwlGadCa+khDFBX24WxnVI/z0qYiJbyLN4FH DeQXmvJKs/z5+GvO71YqGcVYZkE+YwffCnl7/fW5kVbxBn4Jct8EEO0Y+YCiZWc3QQXs WDRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:content-transfer-encoding :mime-version:subject:date:dkim-signature:from; bh=cV7qJz1lxpC+YTAEIjhjKr7PTn3Aglb08rbilE8Otjk=; b=vUpCO9n20RJcYmRdCnOeyzult2CsjAeqTyGNIOEEeXq7lc3LUldGN8gCp0DAjeh//T ornXJtNp3cPXLOPII2FuDqirCyyu1On45/2CR2WTWSIBHiv7H9Lub1K6oqRbZJ1T0lPT EG31yywzt//efrfLSwFzXzjezyHi5wtxwnwZNilBV0m7kCc1DrKek84VboAQfOvc8gbt Ueg24UFnFgW3lDJ2liFdxp3DmvPAImQd+Aofpuq3naLZBaUptz+7sUKXTHcp7FhSNMYl 2vpZD+m3QdWdtM3R2275HQI+XM93TaknB13VP3BaJt0n8gk2CL/nt6MAvjDYkXV/Agnp YoGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=hJwrVwFQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c5-20020a6566c5000000b00517ab01bb8fsi19633912pgw.100.2023.05.17.04.49.25; Wed, 17 May 2023 04:49:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@weissschuh.net header.s=mail header.b=hJwrVwFQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229791AbjEQLaZ (ORCPT + 99 others); Wed, 17 May 2023 07:30:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231208AbjEQLaY (ORCPT ); Wed, 17 May 2023 07:30:24 -0400 Received: from todd.t-8ch.de (todd.t-8ch.de [IPv6:2a01:4f8:c010:41de::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF7B44205; Wed, 17 May 2023 04:30:12 -0700 (PDT) From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1684323010; bh=tX5B9YR0enKjdo8Rk63Z+5SJMwlE6xq8HQ4kgSM4ylU=; h=From:Date:Subject:To:Cc:From; b=hJwrVwFQukiU4UMcCJrA5lzxgA8pOX1JdgG5wrs409bquq+cCFhPJaPpOvhUTKiQ6 gAmlRrXeNYLhk4wqqunpw/JNawwyVx+jcl/Yr4AVbIxITF+R7cH4NEwCBko8caCqns db6bMl9bj0XldY4OxYVYl+8dWzQMV/35+rpLtAZE= Date: Wed, 17 May 2023 13:30:05 +0200 Subject: [PATCH v2] nbd: automatically load module on genl access MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20230223-b4-nbd-genl-v2-1-64585d9ce4b9@weissschuh.net> X-B4-Tracking: v=1; b=H4sIALy6ZGQC/zWNQQrCMBBFr1KydkoyqTW48h7iIkmnTSBOJWm1U Hp3g+DyfXjv76JQjlTEtdlFpncsceYKeGqED5YngjhUFihRS0QNrgN2A0zECbS9dN722vSmF9V wthC4bNmH6vCaUh1fmca4/S7uj8pjnp+whEz2H0allJRn7LRpURkDClLkdbt9KJZSfFhDy7SI4 /gC2AiDba8AAAA= To: Josef Bacik , Jens Axboe Cc: linux-block@vger.kernel.org, nbd@other.debian.org, linux-kernel@vger.kernel.org, Wouter Verhelst , "Richard W.M. Jones" , Josh Triplett , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1684323007; l=1278; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=tX5B9YR0enKjdo8Rk63Z+5SJMwlE6xq8HQ4kgSM4ylU=; b=RTZfwn/ytq5xcFdHDR6ZfgqLHr4gAH0UxLUokOjS5rbCOF9JIRK0Cd8dGjOiYbvJOZYg2yayr kkMaoHJCcGmBEw2CS2M5jS/gbBTUajZjw3sB464zeEyofqm7L9U3Cjv X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of forcing the user to manually load the module do it automatically. For example this avoids the following error when using nbd-client: $ nbd-client localhost 10809 /dev/nbd0 ... Error: Couldn't resolve the nbd netlink family, make sure the nbd module is loaded and your nbd driver supports the netlink interface. Signed-off-by: Thomas Weißschuh --- Changes in v2: - Expand Cc list to get some reviews - Add concrete commit example to commit message - Link to v1: https://lore.kernel.org/lkml/20221110052438.2188-1-linux@weissschuh.net/ --- drivers/block/nbd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 65ecde3e2a5b..8632dbacd2ef 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -2335,6 +2335,7 @@ static struct genl_family nbd_genl_family __ro_after_init = { .mcgrps = nbd_mcast_grps, .n_mcgrps = ARRAY_SIZE(nbd_mcast_grps), }; +MODULE_ALIAS_GENL_FAMILY(NBD_GENL_FAMILY_NAME); static int populate_nbd_status(struct nbd_device *nbd, struct sk_buff *reply) { --- base-commit: f1fcbaa18b28dec10281551dfe6ed3a3ed80e3d6 change-id: 20230223-b4-nbd-genl-3a74ca638686 Best regards, -- Thomas Weißschuh