Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2439300ybz; Sun, 26 Apr 2020 19:28:59 -0700 (PDT) X-Google-Smtp-Source: APiQypI0L5yoT2GybWRRzMxqPehCLWXGbHDPUYdN7F63k64SrGUUPhljcIkOrCztvGZCPp34B4H1 X-Received: by 2002:a17:906:680b:: with SMTP id k11mr18054295ejr.46.1587954539431; Sun, 26 Apr 2020 19:28:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587954539; cv=none; d=google.com; s=arc-20160816; b=jTV+x6F/M8DdSxigDfkWJ4BcFwwT0fe0CdspfnMHrKQh7LB4acHcehgRydCxxCQY+i 7tUpPDsbAXRwjDM1A6mjkKZ7+5yJUnIZtVwiHC6/Egh4ZLTEz+PgpwA8r87EA9LAoNQu tKgOj0GaxhEMcPJLC2zCW91mhP18tYjGVKpGrpQ+iz2sSzXU+ek4MDj5gCQrIpD+evnI WnQBVHFJkuXpcPzVYlv13rcLvkc+1R3DjDQLWH/7/+2Gr8bpFUXpB09lIfCxOsJzSTff KION5jHnBsUqOCEF5/41kh5SUOLnjuIIH2xXf5RCDAjtgLCCazjwcWQI1OKSjF3t2ITI OYug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=lkYMdUgOBBsPGCRNshgJKYrdhx2uwJtnDVj2cMLRFB8=; b=vh1qgmC03LpRkL59bYLg9nrrG7Iv4qy4zgMgA7md0GusqiecaQt2SbjszoCDmpdBnx TrdgV+yIFnr1EPZRXL2tinWz4FGsUK6fVvVnXueaXQU9djHE1ULPACUy2gfsBL9jgofn HyBr42F9Xt/JyRDZZhxVVzPV249uIO9u9DWdHxrfq3r/49i0fx1oOi9xHYQBBP7/l+iK GvrF8sZdH5L36o2VolhBpPQXAkAZzQJr62I22gAj2OJB6ZrfuGIpbkeJem3OEhtK5VKc cs93kvbMiwiQ+T4npuh7QancTRrDto1QsY0rIfdX1WSYptCG0sinV5ISdMk0C+OMmJT7 ANog== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d89si7599928edd.216.2020.04.26.19.28.34; Sun, 26 Apr 2020 19:28:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726378AbgD0C1Q (ORCPT + 99 others); Sun, 26 Apr 2020 22:27:16 -0400 Received: from mail104.syd.optusnet.com.au ([211.29.132.246]:44773 "EHLO mail104.syd.optusnet.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726296AbgD0C1Q (ORCPT ); Sun, 26 Apr 2020 22:27:16 -0400 Received: from dread.disaster.area (pa49-195-157-175.pa.nsw.optusnet.com.au [49.195.157.175]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id B80CF82167F; Mon, 27 Apr 2020 12:27:10 +1000 (AEST) Received: from dave by dread.disaster.area with local (Exim 4.92.3) (envelope-from ) id 1jStUD-0001QJ-Af; Mon, 27 Apr 2020 12:27:09 +1000 Date: Mon, 27 Apr 2020 12:27:09 +1000 From: Dave Chinner To: Matthew Wilcox Cc: Guoqing Jiang , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, hch@infradead.org, Mike Marshall , Martin Brandenburg , devel@lists.orangefs.org Subject: Re: [RFC PATCH 8/9] orangefs: use set/clear_fs_page_private Message-ID: <20200427022709.GC2005@dread.disaster.area> References: <20200426214925.10970-1-guoqing.jiang@cloud.ionos.com> <20200426214925.10970-9-guoqing.jiang@cloud.ionos.com> <20200426222455.GB2005@dread.disaster.area> <20200427001234.GB29705@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200427001234.GB29705@bombadil.infradead.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.3 cv=X6os11be c=1 sm=1 tr=0 a=ONQRW0k9raierNYdzxQi9Q==:117 a=ONQRW0k9raierNYdzxQi9Q==:17 a=kj9zAlcOel0A:10 a=cl8xLZFz6L8A:10 a=7-415B0cAAAA:8 a=_ZLPnNw1jSjQLjkGmAoA:9 a=CjuIK1q_8ugA:10 a=igBNqPyMv6gA:10 a=biEYGPWJfzWAr4FL6Ov7:22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Apr 26, 2020 at 05:12:34PM -0700, Matthew Wilcox wrote: > On Mon, Apr 27, 2020 at 08:24:55AM +1000, Dave Chinner wrote: > > > @@ -460,17 +456,13 @@ static void orangefs_invalidatepage(struct page *page, > > > > > > if (offset == 0 && length == PAGE_SIZE) { > > > kfree((struct orangefs_write_range *)page_private(page)); > > > - set_page_private(page, 0); > > > - ClearPagePrivate(page); > > > - put_page(page); > > > + clear_fs_page_private(page); > > > > Ditto: > > wr = clear_fs_page_private(page); > > kfree(wr); > > You don't want to be as succinct as the btrfs change you suggested? > > kfree(clear_fs_page_private(page)); That could be done, yes. I was really just trying to point out the use after free that was occurring here rather than write compact code... Cheers, Dave. -- Dave Chinner david@fromorbit.com