Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2710071pxb; Tue, 13 Apr 2021 08:22:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8y7Ysyf0cl1uCQq/TWJ78kY49K8KTL9s5SekNRoGkBmo6Pk//kKEMsAWzYMSN9x3fGVy6 X-Received: by 2002:a17:906:4cc6:: with SMTP id q6mr32220892ejt.131.1618327357983; Tue, 13 Apr 2021 08:22:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618327357; cv=none; d=google.com; s=arc-20160816; b=pz/Q492Udm7rMi97CsRDex0c/cB36DWaqlCWG+jAeP7GPp/KeYnglmD8Yf/SFgjhVa L4N8sTNB4jTh634mgv9cHsPxJHU3UjHNu5JlV/A7AR8zvwOa2B91HDvU2AVXjA4yPh6u RTU3BWFPkI2hZmbMBKKYYTJRB6X/deZLzVqfKBLKJn5Xdu7wbmP+MzM7S47wjh7sCaVy aETEB6HzGu019cVx1zv0W4XsQBoqvfYmCSMk1yHTKFbzgqVHL+2Xs0DxS50HWCSElqfJ 1gDxqget1+r72ROCLCAih8xU6GliPCpzMJFhxBn+te6PsMgne/p4CNg9FnsvXe6Ic4eG eRpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=BuV1q5D8V6SIiglztXUsg48fr8choFZCNvloWOYq9/c=; b=B4ViRnaLcTF5NkKLZgPN9B8hNnWml+qcbsMlvlhF2Ep1tkI1xeSHE5BxP7uujSv1MY oFif+S9hZPIEscORHdzTfR4Mm7Oqe6Kpr6ci9YRtSEoSaPd3vxXM2nMoSolziqh2Lhz5 bHvgAfGeielzZe1vC0SrH8dQTpdf1O8h2ZP6xrKvGH2VXo9sEhIbOi2kB1qjEQwRpCJL sc1mb0PRKX3Vn6ciFd7fpJ6UyDWXVCzYjkm4UDjumAKSWKsC1Shvyco7GdTxvk3kayb3 hGUQAq+SCccnrWTPNyxol3cu+huFI/23SaFiY7hRN0VG/8OCe+sY+BTDBaQIaNM1skR4 ubhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=teEZs3C6; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-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 bl4si10955347ejb.17.2021.04.13.08.22.07; Tue, 13 Apr 2021 08:22:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=teEZs3C6; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236781AbhDMM7g (ORCPT + 99 others); Tue, 13 Apr 2021 08:59:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346018AbhDMM7Z (ORCPT ); Tue, 13 Apr 2021 08:59:25 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30CA9C061574; Tue, 13 Apr 2021 05:59:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=BuV1q5D8V6SIiglztXUsg48fr8choFZCNvloWOYq9/c=; b=teEZs3C6B3VrO8PzHFF111v+JU cfSq4JLamao5sBMlrt9N0logJX788lyTt/q1RyarNF5K7ueHWbjwjQGn2N2VuABF4lPUQS9VREbAx 6ZRrKrNW9ipnu8WAzjWH0Kf/c38Ow2CZY5VHvYR+82QOYh7GEXzQVR9ue9AfybdKOnLgRx1HUgNJz T3XrYAJX57e+YSJKQi+0WHaeDXJpDkysu6VAffpyxO0m1vQzXuj7dcc/a+/J2QeUoRh9zdn8PlIhb WMnkdYKhLY2SwGRrBr1v2WGXvixkzll8zVXsOkrr6GlGVyf6G+6jx4Ii2XLdrTQDTFtjLP7QBpemM tty6oxQQ==; Received: from hch by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1lWIby-005kzA-LI; Tue, 13 Apr 2021 12:58:08 +0000 Date: Tue, 13 Apr 2021 13:57:46 +0100 From: Christoph Hellwig To: Jan Kara Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, Ted Tso , Christoph Hellwig , Amir Goldstein , Dave Chinner Subject: Re: [PATCH 2/7] mm: Protect operations adding pages to page cache with i_mapping_lock Message-ID: <20210413125746.GB1366579@infradead.org> References: <20210413105205.3093-1-jack@suse.cz> <20210413112859.32249-2-jack@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210413112859.32249-2-jack@suse.cz> X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org > if (error == AOP_TRUNCATED_PAGE) > put_page(page); > + up_read(&mapping->host->i_mapping_sem); > return error; Please add an unlock_mapping label above this up_read and consolidate most of the other unlocks by jumping there (put_and_wait_on_page_locked probablt can't use it). > truncated: > unlock_page(page); > @@ -2309,6 +2324,7 @@ static int filemap_update_page(struct kiocb *iocb, > return AOP_TRUNCATED_PAGE; The trunated case actually seems to miss the unlock. Similarly I think filemap_fault would benefit from a common unlock path.