diff mbox series

[v2,01/14] drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep()

Message ID 20230315181902.4177819-1-joel@joelfernandes.org (mailing list archive)
State New, archived
Headers show
Series [v2,01/14] drbd: Rename kvfree_rcu() to kvfree_rcu_mightsleep() | expand

Commit Message

Joel Fernandes March 15, 2023, 6:18 p.m. UTC
From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>

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 <axboe@kernel.dk>
Cc: Philipp Reisner <philipp.reisner@linbit.com>
Cc: Lars Ellenberg <lars.ellenberg@linbit.com>
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
 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(-)

Comments

Joel Fernandes March 26, 2023, 12:27 p.m. UTC | #1
On Wed, Mar 15, 2023 at 2:19 PM Joel Fernandes (Google)
<joel@joelfernandes.org> wrote:
>
> From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
>
> 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 <axboe@kernel.dk>
> Cc: Philipp Reisner <philipp.reisner@linbit.com>
> Cc: Lars Ellenberg <lars.ellenberg@linbit.com>

Jens/Others, any chance for an Ack here?

 - Joel

> Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
> ---
>  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) {
> --
> 2.40.0.rc1.284.g88254d51c5-goog
>
Jens Axboe March 27, 2023, 7:26 p.m. UTC | #2
On 3/26/23 6:27 AM, Joel Fernandes wrote:
> On Wed, Mar 15, 2023 at 2:19 PM Joel Fernandes (Google)
> <joel@joelfernandes.org> wrote:
>>
>> From: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
>>
>> 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 <axboe@kernel.dk>
>> Cc: Philipp Reisner <philipp.reisner@linbit.com>
>> Cc: Lars Ellenberg <lars.ellenberg@linbit.com>
> 
> Jens/Others, any chance for an Ack here?

Begrudgingly-acked-by: Jens Axboe <axboe@kernel.dk>
diff mbox series

Patch

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) {