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=-0.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 55AFAC433E0 for ; Thu, 18 Jun 2020 12:46:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 192502067D for ; Thu, 18 Jun 2020 12:46:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="h7Ftdw1W" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 192502067D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 78F606B0099; Thu, 18 Jun 2020 08:46:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 717CA8D000E; Thu, 18 Jun 2020 08:46:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5DEBB6B009B; Thu, 18 Jun 2020 08:46:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0166.hostedemail.com [216.40.44.166]) by kanga.kvack.org (Postfix) with ESMTP id 43BD76B0099 for ; Thu, 18 Jun 2020 08:46:19 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id AD3E42C96 for ; Thu, 18 Jun 2020 12:46:18 +0000 (UTC) X-FDA: 76942305636.05.bird34_280e0ff26e10 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin05.hostedemail.com (Postfix) with ESMTP id 7A97318017BC4 for ; Thu, 18 Jun 2020 12:46:18 +0000 (UTC) X-HE-Tag: bird34_280e0ff26e10 X-Filterd-Recvd-Size: 6545 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Thu, 18 Jun 2020 12:46:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592484377; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Jx2chy+DXXXPslp3yfr/ExQZEB8p36U9cp+dBBsmha4=; b=h7Ftdw1WTmPytI2eIit/SWPmSzK6eAJPPK5WnFzNeImRDPOgmU4UbF07fZMqn28Lgn/Isn f1tAGW+XUov5PUGD9D5FdA5ppKS3t8F5l4neaqCFjA5VCGCdQbWQcCOi4OdZYxKX9WIuBg 7IQc4CeH4+El7k8T/bQC/sUyYwm2eN0= Received: from mail-ot1-f70.google.com (mail-ot1-f70.google.com [209.85.210.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-380-NvsC1vFXMIaQ9VL8t1wLKw-1; Thu, 18 Jun 2020 08:46:15 -0400 X-MC-Unique: NvsC1vFXMIaQ9VL8t1wLKw-1 Received: by mail-ot1-f70.google.com with SMTP id z6so2549765otq.8 for ; Thu, 18 Jun 2020 05:46:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Jx2chy+DXXXPslp3yfr/ExQZEB8p36U9cp+dBBsmha4=; b=moTaB/d9z/7HraDGrb/vZ8GlzxxSAugVdzXMFA2a4COilOrgTMLSJ8YCZG8y6aJuV4 pw9Ogj5EflS3LaKIrCt0wHT9sllTSuhvo1pKW/sk7e2OHnO2r4m0vpVoATnsffFyNjiU ZvdDMDc3JNDmrVmDgMTMK/2GIpGC2DxSjVgQuajvvPIrXFK89HXQTKLEyf4A0iwTcBpL pLigQJsPeyH8QoFvN6iJtfvh03sGcGOYhccFOpTILhTopPSF1MU0jDulLCv2zItAB6PK Xdgqn2wLKGqw4rYUB1YiRQGQYvkIFI2OBHTZ94yf94atYaJRZIBnVmADCQaDarFHMh/Y QMKA== X-Gm-Message-State: AOAM5325MR6nTEsvNSuxYDGYB8L5+yZIrORD3zkR8GR4+VijgFnyFp8J Hrb2/qlCE384wDaNxEY8ZYgsuDCXnX0ouT++zHXmdnT600lufY1ZoYIm8rg6KY4zbZXuPeWh5HW z0DPF2RSavIjJatwz1sn6Q025Lwo= X-Received: by 2002:a05:6830:10c8:: with SMTP id z8mr3014461oto.95.1592484374653; Thu, 18 Jun 2020 05:46:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOwYhxZwvrmXCEEJ4lNIcITT1uhrr+sNqXkjoRh5QLgqAWYsSVfGAkiWuBNYfSRh2ekFx49DQ8VN9O2a7lFfU= X-Received: by 2002:a05:6830:10c8:: with SMTP id z8mr3014426oto.95.1592484374383; Thu, 18 Jun 2020 05:46:14 -0700 (PDT) MIME-Version: 1.0 References: <20200414150233.24495-1-willy@infradead.org> <20200414150233.24495-17-willy@infradead.org> <20200617003216.GC8681@bombadil.infradead.org> <20200617022157.GF8681@bombadil.infradead.org> In-Reply-To: <20200617022157.GF8681@bombadil.infradead.org> From: Andreas Gruenbacher Date: Thu, 18 Jun 2020 14:46:03 +0200 Message-ID: Subject: Re: [Cluster-devel] [PATCH v11 16/25] fs: Convert mpage_readpages to mpage_readahead To: Matthew Wilcox Cc: =?UTF-8?Q?Andreas_Gr=C3=BCnbacher?= , Andrew Morton , linux-xfs , Junxiao Bi , William Kucharski , Joseph Qi , John Hubbard , LKML , linux-f2fs-devel@lists.sourceforge.net, cluster-devel , Linux-MM , ocfs2-devel@oss.oracle.com, linux-fsdevel , linux-ext4 , linux-erofs@lists.ozlabs.org, Christoph Hellwig , linux-btrfs@vger.kernel.org, Steven Whitehouse , Bob Peterson X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 7A97318017BC4 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Jun 17, 2020 at 4:22 AM Matthew Wilcox wrote: > On Wed, Jun 17, 2020 at 02:57:14AM +0200, Andreas Gr=C3=BCnbacher wrote: > > Am Mi., 17. Juni 2020 um 02:33 Uhr schrieb Matthew Wilcox : > > > > > > On Wed, Jun 17, 2020 at 12:36:13AM +0200, Andreas Gruenbacher wrote: > > > > Am Mi., 15. Apr. 2020 um 23:39 Uhr schrieb Matthew Wilcox : > > > > > From: "Matthew Wilcox (Oracle)" > > > > > > > > > > Implement the new readahead aop and convert all callers (block_de= v, > > > > > exfat, ext2, fat, gfs2, hpfs, isofs, jfs, nilfs2, ocfs2, omfs, qn= x6, > > > > > reiserfs & udf). The callers are all trivial except for GFS2 & O= CFS2. > > > > > > > > This patch leads to an ABBA deadlock in xfstest generic/095 on gfs2= . > > > > > > > > Our lock hierarchy is such that the inode cluster lock ("inode gloc= k") > > > > for an inode needs to be taken before any page locks in that inode'= s > > > > address space. > > > > > > How does that work for ... > > > > > > writepage: yes, unlocks (see below) > > > readpage: yes, unlocks > > > invalidatepage: yes > > > releasepage: yes > > > freepage: yes > > > isolate_page: yes > > > migratepage: yes (both) > > > putback_page: yes > > > launder_page: yes > > > is_partially_uptodate: yes > > > error_remove_page: yes > > > > > > Is there a reason that you don't take the glock in the higher level > > > ops which are called before readhead gets called? I'm looking at XFS= , > > > and it takes the xfs_ilock SHARED in xfs_file_buffered_aio_read() > > > (called from xfs_file_read_iter). > > > > Right, the approach from the following thread might fix this: > > > > https://lore.kernel.org/linux-fsdevel/20191122235324.17245-1-agruenba@r= edhat.com/T/#t > > In general, I think this is a sound approach. > > Specifically, I think FAULT_FLAG_CACHED can go away. map_pages() > will bring in the pages which are in the page cache, so when we get to > gfs2_fault(), we know there's a reason to acquire the glock. We'd still be grabbing a glock while holding a dependent page lock. Another process could be holding the glock and could try to grab the same page lock (i.e., a concurrent writer), leading to the same kind of deadlock. Andreas