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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4FEFCC3404C for ; Thu, 20 Feb 2020 04:52:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2B7D324656 for ; Thu, 20 Feb 2020 04:52:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728010AbgBTEwm (ORCPT ); Wed, 19 Feb 2020 23:52:42 -0500 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:41359 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727806AbgBTEwl (ORCPT ); Wed, 19 Feb 2020 23:52:41 -0500 Received: from callcc.thunk.org (guestnat-104-133-8-109.corp.google.com [104.133.8.109] (may be forged)) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 01K4qYUN024408 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Feb 2020 23:52:35 -0500 Received: by callcc.thunk.org (Postfix, from userid 15806) id CD0DC4211EF; Wed, 19 Feb 2020 23:52:33 -0500 (EST) Date: Wed, 19 Feb 2020 23:52:33 -0500 From: "Theodore Y. Ts'o" To: Uladzislau Rezki Cc: "Paul E. McKenney" , Joel Fernandes , Ext4 Developers List , Suraj Jitindar Singh , LKML Subject: Re: [PATCH RFC] ext4: fix potential race between online resizing and write operations Message-ID: <20200220045233.GC476845@mit.edu> References: <20200215233817.GA670792@mit.edu> <20200216121246.GG2935@paulmck-ThinkPad-P72> <20200217160827.GA5685@pc636> <20200217193314.GA12604@mit.edu> <20200218170857.GA28774@pc636> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200218170857.GA28774@pc636> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 18, 2020 at 06:08:57PM +0100, Uladzislau Rezki wrote: > now it becomes possible to use it like: > ... > void *p = kvmalloc(PAGE_SIZE); > kvfree_rcu(p); > ... > also have a look at the example in the mm/list_lru.c diff. I certainly like the interface, thanks! I'm going to be pushing patches to fix this using ext4_kvfree_array_rcu() since there are a number of bugs in ext4's online resizing which appear to be hitting multiple cloud providers (with reports from both AWS and GCP) and I want something which can be easily backported to stable kernels. But once kvfree_rcu() hits mainline, I'll switch ext4 to use it, since your kvfree_rcu() is definitely more efficient than my expedient jury-rig. I don't feel entirely competent to review the implementation, but I do have one question. It looks like the rcutiny implementation of kfree_call_rcu() isn't going to do the right thing with kvfree_rcu(p). Am I missing something? > diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h > index 045c28b71f4f..a12ecc1645fa 100644 > --- a/include/linux/rcutiny.h > +++ b/include/linux/rcutiny.h > @@ -34,7 +34,7 @@ static inline void synchronize_rcu_expedited(void) > synchronize_rcu(); > } > > -static inline void kfree_call_rcu(struct rcu_head *head, rcu_callback_t func) > +static inline void kfree_call_rcu(struct rcu_head *head, rcu_callback_t func, void *ptr) > { > call_rcu(head, func); > } Thanks, - Ted