From patchwork Wed Mar 15 18:18:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 13176504 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 A6A71C6FD1D for ; Wed, 15 Mar 2023 18:19:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232277AbjCOST2 (ORCPT ); Wed, 15 Mar 2023 14:19:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231748AbjCOST1 (ORCPT ); Wed, 15 Mar 2023 14:19:27 -0400 Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C47B5A6D7 for ; Wed, 15 Mar 2023 11:19:26 -0700 (PDT) Received: by mail-qt1-x834.google.com with SMTP id d7so17151946qtr.12 for ; Wed, 15 Mar 2023 11:19:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1678904365; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=GgzilRrDZzjZzGZPzVxtA7dkKR8Cud+QjJJNSSQFpD0=; b=aeF1GaiTWV2z10A11VbsrsakE7qKYNyoR2nVgFLI3d6N8gJEjje/zzswtN2TGFln6U SlbpWOL++D9xe66W2i+I7sjdmACU7jeLTJNedgxGtjL2iQs0D2V2ErxDWeH77FfhlQ7S B9eXRQAjYlyuksBs4ic13nFMImugk9I19BUXI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678904365; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=GgzilRrDZzjZzGZPzVxtA7dkKR8Cud+QjJJNSSQFpD0=; b=ag+aYroNANTzbX7JHtudKNRRgSXTICHOXLC81RPUGJtTd93hDwFVxNU7EuwwCmKsLa xUKQW2GwjKqyTbYuB7dn7BWduFKyegX+VsWMj/tz7ASQFnQBWRxN/6MUndO0q6qnFzcW SaeMWr9GRPPH6/uNTJLP10zK/hUSCeiQf/a3i9DnFuIzJrxAPGUnrGaRPQSUpHv5emL2 xDVkDA9BobPHMoydEaA7HlRybx5Nm3asTJ9jw1ABnssaMNHsQOtmlWtjZU0spuNfMFXc KUBrFrILlEl1K/Vie7BDlE+hodxhhrlKm64gg6KqzODHMumts4HXRR0WtEbC5zDuqVMW AKlg== X-Gm-Message-State: AO0yUKVcNPaNGC9es7es3SR+XQHUU8b+wzIQBGe1xzRnlAzg7OKqt4np UBg5ldMRLc9fe3rulRPdKdjH9Q== X-Google-Smtp-Source: AK7set8VcYEA2FNHiNt71e1UCyy1BH+LnV/QaaYc7e1fsnQTQLTwiKalxIxHMNkF25qJEH4XWQKcdQ== X-Received: by 2002:ac8:5cce:0:b0:3bf:c266:fa6f with SMTP id s14-20020ac85cce000000b003bfc266fa6fmr1378818qta.46.1678904365367; Wed, 15 Mar 2023 11:19:25 -0700 (PDT) Received: from joelboxx.c.googlers.com.com (129.239.188.35.bc.googleusercontent.com. [35.188.239.129]) by smtp.gmail.com with ESMTPSA id v125-20020a379383000000b007458ae32290sm4113974qkd.128.2023.03.15.11.19.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Mar 2023 11:19:24 -0700 (PDT) From: "Joel Fernandes (Google)" To: Philipp Reisner , Lars Ellenberg , =?utf-8?q?Christoph_B=C3=B6hmwa?= =?utf-8?q?lder?= , Jens Axboe Cc: "Uladzislau Rezki (Sony)" , "Paul E . McKenney" , Joel Fernandes , drbd-dev@lists.linbit.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 01/14] drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep() Date: Wed, 15 Mar 2023 18:18:48 +0000 Message-Id: <20230315181902.4177819-1-joel@joelfernandes.org> X-Mailer: git-send-email 2.40.0.rc1.284.g88254d51c5-goog MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org From: "Uladzislau Rezki (Sony)" The kvfree_rcu() macro's single-argument form is deprecated. Therefore switch to the new kvfree_rcu_mightsleep() variant. The goal is to avoid accidental use of the single-argument forms, which can introduce functionality bugs in atomic contexts and latency bugs in non-atomic contexts. Cc: Jens Axboe Cc: Philipp Reisner Cc: Lars Ellenberg Signed-off-by: Uladzislau Rezki (Sony) Signed-off-by: Paul E. McKenney Signed-off-by: Joel Fernandes (Google) --- drivers/block/drbd/drbd_nl.c | 6 +++--- drivers/block/drbd/drbd_receiver.c | 4 ++-- drivers/block/drbd/drbd_state.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index 60757ac31701..f49f2a5282e1 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c @@ -1615,7 +1615,7 @@ int drbd_adm_disk_opts(struct sk_buff *skb, struct genl_info *info) drbd_send_sync_param(peer_device); } - kvfree_rcu(old_disk_conf); + kvfree_rcu_mightsleep(old_disk_conf); kfree(old_plan); mod_timer(&device->request_timer, jiffies + HZ); goto success; @@ -2446,7 +2446,7 @@ int drbd_adm_net_opts(struct sk_buff *skb, struct genl_info *info) mutex_unlock(&connection->resource->conf_update); mutex_unlock(&connection->data.mutex); - kvfree_rcu(old_net_conf); + kvfree_rcu_mightsleep(old_net_conf); if (connection->cstate >= C_WF_REPORT_PARAMS) { struct drbd_peer_device *peer_device; @@ -2860,7 +2860,7 @@ int drbd_adm_resize(struct sk_buff *skb, struct genl_info *info) new_disk_conf->disk_size = (sector_t)rs.resize_size; rcu_assign_pointer(device->ldev->disk_conf, new_disk_conf); mutex_unlock(&device->resource->conf_update); - kvfree_rcu(old_disk_conf); + kvfree_rcu_mightsleep(old_disk_conf); new_disk_conf = NULL; } diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 757f4692b5bd..e197b2a465d2 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c @@ -3759,7 +3759,7 @@ static int receive_protocol(struct drbd_connection *connection, struct packet_in drbd_info(connection, "peer data-integrity-alg: %s\n", integrity_alg[0] ? integrity_alg : "(none)"); - kvfree_rcu(old_net_conf); + kvfree_rcu_mightsleep(old_net_conf); return 0; disconnect_rcu_unlock: @@ -4127,7 +4127,7 @@ static int receive_sizes(struct drbd_connection *connection, struct packet_info rcu_assign_pointer(device->ldev->disk_conf, new_disk_conf); mutex_unlock(&connection->resource->conf_update); - kvfree_rcu(old_disk_conf); + kvfree_rcu_mightsleep(old_disk_conf); drbd_info(device, "Peer sets u_size to %lu sectors (old: %lu)\n", (unsigned long)p_usize, (unsigned long)my_usize); diff --git a/drivers/block/drbd/drbd_state.c b/drivers/block/drbd/drbd_state.c index 75d13ea0024f..2aeea295fa28 100644 --- a/drivers/block/drbd/drbd_state.c +++ b/drivers/block/drbd/drbd_state.c @@ -2071,7 +2071,7 @@ static int w_after_conn_state_ch(struct drbd_work *w, int unused) conn_free_crypto(connection); mutex_unlock(&connection->resource->conf_update); - kvfree_rcu(old_conf); + kvfree_rcu_mightsleep(old_conf); } if (ns_max.susp_fen) {