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.9 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 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 1F6C0C433E0 for ; Thu, 18 Jun 2020 16:40:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D3884206E2 for ; Thu, 18 Jun 2020 16:40:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="cdm6RrH1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D3884206E2 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 4EC808D0047; Thu, 18 Jun 2020 12:40:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 49BC58D0018; Thu, 18 Jun 2020 12:40:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 364348D0047; Thu, 18 Jun 2020 12:40:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0152.hostedemail.com [216.40.44.152]) by kanga.kvack.org (Postfix) with ESMTP id 1EACB8D0018 for ; Thu, 18 Jun 2020 12:40:32 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id B2FFAB933D for ; Thu, 18 Jun 2020 16:40:31 +0000 (UTC) X-FDA: 76942895862.28.horn97_04150ce26e11 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id 8825F1B297B for ; Thu, 18 Jun 2020 16:40:31 +0000 (UTC) X-HE-Tag: horn97_04150ce26e11 X-Filterd-Recvd-Size: 6244 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Thu, 18 Jun 2020 16:40:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1592498430; 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=K+ZmXo1VT3DgmlBxctO5wOawFr9Ym28t9PdelfkR48g=; b=cdm6RrH1NpWejVPngNSf517l/h1SpZ+fivdFekEw1Tn2FRtYit2i3cc6VMnszQ5eKnfPOA NlJjO2VVvJU1J0oDvazQ62XrDMo78nqLgdlQrZNYaPAArwfxonJBKCiMb9EJ9D92PshR/h FJ/TUNIXe63syEtT8yes1Gd6caokSI0= Received: from mail-oo1-f70.google.com (mail-oo1-f70.google.com [209.85.161.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-388-fBZPeCjKP5aumtc8eiKM2Q-1; Thu, 18 Jun 2020 12:40:28 -0400 X-MC-Unique: fBZPeCjKP5aumtc8eiKM2Q-1 Received: by mail-oo1-f70.google.com with SMTP id v26so3030370oot.2 for ; Thu, 18 Jun 2020 09:40:28 -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=K+ZmXo1VT3DgmlBxctO5wOawFr9Ym28t9PdelfkR48g=; b=GZ2VlIGX04lAMSaixlhWbz1YtxLhDODvXWyCRDyuEG7eAcV/NTLFERrv04e5Wu5AY0 B65diXpiFhR6ZKSaXE6V4V9XxMbuwO0kUnghtTl0pGTzeMPkOorI1ViNAnLcgQemFY2g 7YrkarROEPPeBwqfHqJhHLUfjr0FlgTjP07xzCfnqlwp1uClJgeg56YkANFjfso/NWEN Ay8+SlheVO1dOOy5p0DGWEyQM7h9/GUeeXqseOinrddta6WxXNctrkzaStHclA075Mix AfgnqRcfKGZavGFOfYgGvotAJVb9LK3FMqow0PGDef7vFiXiTIfgD8pmFywOajVMCWq0 ZmbQ== X-Gm-Message-State: AOAM533NTyvkHWx4A+MhF2z5CtQVRIJ1kbdzj1cBlhI/D3lyp+plB/58 jJ1/rt8gT49T7ES34EJgXsfiMe4CT2HbJe6mwgyRqdbAImOVFd6K/pMD9MY+Gjnd2NguA8EvYKu 0OohKpmoy6v+rv2ct7pr40pplLP8= X-Received: by 2002:a05:6830:10c8:: with SMTP id z8mr4000196oto.95.1592498427405; Thu, 18 Jun 2020 09:40:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzE8nhb2Q0d4GxQpaInRB14NGapvcWpYnTg96Ky3B2ltZU9DxgAABVkj/Ptn9PHhgl8mMoH1G9lpq5ufccfhow= X-Received: by 2002:a05:6830:10c8:: with SMTP id z8mr4000168oto.95.1592498427103; Thu, 18 Jun 2020 09:40:27 -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> <20200618150309.GP8681@bombadil.infradead.org> In-Reply-To: <20200618150309.GP8681@bombadil.infradead.org> From: Andreas Gruenbacher Date: Thu, 18 Jun 2020 18:40:15 +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: 8825F1B297B X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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 Thu, Jun 18, 2020 at 5:03 PM Matthew Wilcox wrote: > > On Thu, Jun 18, 2020 at 02:46:03PM +0200, Andreas Gruenbacher wrote: > > On Wed, Jun 17, 2020 at 4:22 AM Matthew Wilcox wr= ote: > > > On Wed, Jun 17, 2020 at 02:57:14AM +0200, Andreas Gr=C3=83=C2=BCnbach= er wrote: > > > > Right, the approach from the following thread might fix this: > > > > > > > > https://lore.kernel.org/linux-fsdevel/20191122235324.17245-1-agruen= ba@redhat.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 t= o > > > 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. > > What I'm saying is that gfs2_fault should just be: > > +static vm_fault_t gfs2_fault(struct vm_fault *vmf) > +{ > + struct inode *inode =3D file_inode(vmf->vma->vm_file); > + struct gfs2_inode *ip =3D GFS2_I(inode); > + struct gfs2_holder gh; > + vm_fault_t ret; > + int err; > + > + gfs2_holder_init(ip->i_gl, LM_ST_SHARED, 0, &gh); > + err =3D gfs2_glock_nq(&gh); > + if (err) { > + ret =3D block_page_mkwrite_return(err); > + goto out_uninit; > + } > + ret =3D filemap_fault(vmf); > + gfs2_glock_dq(&gh); > +out_uninit: > + gfs2_holder_uninit(&gh); > + return ret; > +} > > because by the time gfs2_fault() is called, map_pages() has already been > called and has failed to insert the necessary page, so we should just > acquire the glock now instead of trying again to look for the page in > the page cache. Okay, that's great. Thanks, Andreas