Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp255722ybv; Wed, 19 Feb 2020 20:53:00 -0800 (PST) X-Google-Smtp-Source: APXvYqzJjdyYvrywsgwVbawC2XwTmcWtvrpwI/CO2bLDXNzRWnqCOS0k+ksDHm2G6IjY616Gq9WF X-Received: by 2002:a05:6830:1e37:: with SMTP id t23mr23033522otr.16.1582174380319; Wed, 19 Feb 2020 20:53:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582174380; cv=none; d=google.com; s=arc-20160816; b=llOUur+kFqPRXL6IHzoFC+24uSoGwNSMtY1sHkmr2FpnhX13x060e9nCvMKOyJ7t8s UwS3cVsKqP6uXVwJITBnC5AA2KUAqhWvZ0hgxNcWEFUTbCoFKNQQf7uqdxCNJqoUzg6A q/DqTdWL1NTu957giwcAVJOejZPsAEUfOHeayemmEwrU09qxO990kfi92iRnNWLBHbgM jWeWLSaKXDFKzHK8Be7n4YXEvT0M3cbtOjPlDQiD7LEJaTOjCjyYHRUWGMzwtaVvaVF3 5Md300REDE2Z4zw++otG14YNVUA1slQRv7cQ9/frFPFlKj0xPTP8gPCd3ouADYwuwCEN GaIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=ODANvf9vuhOQPdYV93+XOoILrYBD9019D9OWTcb7+Tg=; b=xg6c1Qe15Osu5zmgUjFaaMXUXA0PXUTvZA48MAioqYcw7Qu/HZua3h2Ts6lAzcKg/s pXiWTzZ/66smYGMWF9EEc4Okf88Mn8CtxZ3S8tbZHoKXbPGMQBz4LMchIpMAps3SheK6 8zJ2OsABPs7VntYXlF5mDvIgzKXINMm59ug4S1dneC4sOvMO/ftvuNm2UDYKsJJxs1Ru u0paVUENvIa4HdzzfNZmg9K8spAgz+mLU8tZJ/AtRgoApi+SsPCl183SOWMHeJVqiP5y mC7xHKJnVgS+mMfmd0ogX6a3QnlNjUA1mvtGVsfTTONsOOkRULPKsxw9XzNLsGK3djrI A3ag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n14si1083908otk.179.2020.02.19.20.52.43; Wed, 19 Feb 2020 20:53:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727875AbgBTEwm (ORCPT + 99 others); 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-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@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