Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2505365rwb; Mon, 3 Oct 2022 01:30:57 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4ly9IECwVaxkBq3BTxz6WNANO8aZTW6IVtkSbLqKPM7L4iVPpJk2wgbZFXicqHYwZQvbe1 X-Received: by 2002:a17:902:ccc4:b0:17c:7cc1:a401 with SMTP id z4-20020a170902ccc400b0017c7cc1a401mr15212386ple.58.1664785857269; Mon, 03 Oct 2022 01:30:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664785857; cv=none; d=google.com; s=arc-20160816; b=a0q4FT/83yoj5VQ1q6Lvo48Nri0yUQpMts899s9hO418zsACRmAd09VG0wnDXSTygy kAOn6RzFiBNOc35K8azPlRkJqOhBbUrg51SJH1uAUl3p2x/J6DO0rfZt+ACE0K3CNd1Y Ku7Odpmai589zcnDFTrpCrvYCf7gzd+/Jzz54NxtBNcRFoJaW1LrVnLXOl3QVzlT/xBR jM+D4QHGy/cbj2EYMexwQKdg54cfCZ3duE6f1hLpzMjg1AZKiTS9+MuXMknGRWUHwubT QgXH0yyXdh/2+gwx/Yn4lbGgQwmWEbqrjllRMwqTN1odC0340nI2MaJcGh+DC3I4FPrH EvOw== 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 :dkim-signature; bh=Dwt0M+3sS5jciWoEfZ361h/7J8CUArjkqTvOekaboQM=; b=Z3MpzW66cL77FH4UkEWGVJqSiuWLtHVKrN9iTqrYQ3bPoD8kLhs/v8FwlnysbmHR2b bFiVsRZ6Dj2im6TUxPoF1CVh+w3Rq7bvdgxJ+TmR19T5BDXUISzchBL5SZ3+ETp/GgH5 6aLWZYXsgFK1V+rusTvEGSF1W8IWCUCj2CEJLvTlTlLX9kNzSN3awThZOr9cfMRHmnMY aPhRF3H8ZMViogHWcE4ulAuDV0nfiP2hRA5wdVd4j+14k3NZWBQust+B3hfTV28mGmdX hOv3bYi2QAdk9XCP2o8N3j/rJr2iYvZ3NIwzJCSJ1E4bMJwunaQ1hlDBcbwBe6AlGeCK CCCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=zkThJ2TF; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 31-20020a630f5f000000b003fea0415b5asi9846345pgp.834.2022.10.03.01.30.35; Mon, 03 Oct 2022 01:30:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=zkThJ2TF; dkim=neutral (no key) header.i=@suse.cz; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230270AbiJCIWJ (ORCPT + 99 others); Mon, 3 Oct 2022 04:22:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229751AbiJCIVu (ORCPT ); Mon, 3 Oct 2022 04:21:50 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6972A7AC15; Mon, 3 Oct 2022 00:56:11 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 03A3B2199D; Mon, 3 Oct 2022 07:55:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1664783704; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Dwt0M+3sS5jciWoEfZ361h/7J8CUArjkqTvOekaboQM=; b=zkThJ2TFJKFUEK3VylwDrcuP3qR0r+8zOoVjqqSHzXOI6usNom6OffXeZGMpe/GynYzi73 sQWnjyKxPucXtNlJ0gwCXCDOSp3Mxit3ZmYug0ZB8d6NdYAHk5apFRG/smhDgljnOMnWl0 oXPm/fEAi0u86y4+Bd97IzG2zIrXUoc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1664783704; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Dwt0M+3sS5jciWoEfZ361h/7J8CUArjkqTvOekaboQM=; b=Ka3lq+tWamkJuoOp3to1B+06t8Js1FGSUPVxo2WCOJ4jJRaSTRqb4l+c0nHC3luZKW2MOy L7hngvV2S5HeraCg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E61881332F; Mon, 3 Oct 2022 07:55:03 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 3yUiOFeVOmODUgAAMHmgww (envelope-from ); Mon, 03 Oct 2022 07:55:03 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 7768DA06E6; Mon, 3 Oct 2022 09:55:03 +0200 (CEST) Date: Mon, 3 Oct 2022 09:55:03 +0200 From: Jan Kara To: Jason Gunthorpe Cc: Dan Williams , Jan Kara , Dave Chinner , akpm@linux-foundation.org, Matthew Wilcox , "Darrick J. Wong" , Christoph Hellwig , John Hubbard , linux-fsdevel@vger.kernel.org, nvdimm@lists.linux.dev, linux-xfs@vger.kernel.org, linux-mm@kvack.org, linux-ext4@vger.kernel.org Subject: Re: [PATCH v2 05/18] xfs: Add xfs_break_layouts() to the inode eviction path Message-ID: <20221003075503.k7h6aqvlnoi5bo52@quack3> References: <20220923001846.GX3600936@dread.disaster.area> <632d00a491d0d_4a67429488@dwillia2-xfh.jf.intel.com.notmuch> <20220923021012.GZ3600936@dread.disaster.area> <20220923093803.nroajmvn7twuptez@quack3> <20220925235407.GA3600936@dread.disaster.area> <20220926141055.sdlm3hkfepa7azf2@quack3> <63362b4781294_795a6294f0@dwillia2-xfh.jf.intel.com.notmuch> <20220930134144.pd67rbgahzcb62mf@quack3> <63372dcbc7f13_739029490@dwillia2-mobl3.amr.corp.intel.com.notmuch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Fri 30-09-22 15:06:47, Jason Gunthorpe wrote: > On Fri, Sep 30, 2022 at 10:56:27AM -0700, Dan Williams wrote: > > Jan Kara wrote: > > [..] > > > I agree this is doable but there's the nasty sideeffect that inode reclaim > > > may block for abitrary time waiting for page pinning. If the application > > > that has pinned the page requires __GFP_FS memory allocation to get to a > > > point where it releases the page, we even have a deadlock possibility. > > > So it's better than the UAF issue but still not ideal. > > > > I expect VMA pinning would have similar deadlock exposure if pinning a > > VMA keeps the inode allocated. Anything that puts a page-pin release > > dependency in the inode freeing path can potentially deadlock a reclaim > > event that depends on that inode being freed. > > I think the desire would be to go from the VMA to an inode_get and > hold the inode reference for the from the pin_user_pages() to the > unpin_user_page(), ie prevent it from being freed in the first place. Yes, that was the idea how to avoid UAF problems. > It is a fine idea, the trouble is just the high complexity to get > there. > > However, I wonder if the trucate/hole punch paths have the same > deadlock problem? Do you mean someone requiring say truncate(2) to complete on file F in order to unpin pages of F? That is certainly a deadlock but it has always worked this way for DAX so at least applications knowingly targetted at DAX will quickly notice and avoid such unwise dependency ;). Honza -- Jan Kara SUSE Labs, CR