Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp431857iof; Mon, 6 Jun 2022 06:19:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwr27h1nVXqiLKkcnBDzEKE4BsZHPSVxe5V+oBzmSeCQEGgB+7ICXQrwAfxE2IuZ/WwkQyQ X-Received: by 2002:a63:401:0:b0:3fc:8810:f0ae with SMTP id 1-20020a630401000000b003fc8810f0aemr20913838pge.335.1654521542343; Mon, 06 Jun 2022 06:19:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654521542; cv=none; d=google.com; s=arc-20160816; b=icXOQfi98Jm9LJmXmwFL7iNAwJnNe3Hg8hgLzeRh4HZ83vwwPEoGSCPLB/lKdiEYst vO8ys4XBEyT4L7u26VbkfxiUrowGuQZBgxCM7airW6Zw72ovmZp/2C1ekmVf5RZW1XiW X+tPh717h6MYZ+uIHPipPSwKjRfhmNZvWCiFR1hXRfXEZcYG1Y8DHoqC/3C7p3YmNhoI OGhrKXKbwb07sd0F0KGi3hlgNeN7Mpz/z1BB1aqngA/Ixpg8No94lwteiwA4Q3+pRZQw wW/NmYBbzwkLyHM6EMdQ4eSxuiBt2JL5njR5FvivjVG2yOc9qmonbYnNGyxfX8BGEQOs 3M+w== 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=8MN/pjZfKcAO7FTQBAh4+y52Sr75CPrTtBghqpmx7gg=; b=zpkt6TLOsnCvdYEVfkZ43SWh689i+qdu/ZozUI8jdTb7mkERCaHrWsw1X8UuHZ4LHT pmRilDIyKEX//jW6cbg5yg9Yw0hqTgzTQhN8gfEruNsZXCZ9PzPWhKOuGZG7oL0+F98I AeCau8qPrEfVAhhHY/h7RRPgIkW6q9I3gfynmFtY566TUD1vDZ8cLU4CjXUE6ab5rq9A x1u/m6MVTfHDX9D8jA2i8uep9kcM8THGi0eabrPfapvQF0KsrFts+Gd8tzCFijKk7v7b ThYPTXPLn9CW/bXdHioK/WmqoZCW7/bIMl46j4kKksGWNulrb0ik3h1ccUI6KgKDl08u 1pgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="1/iSwJ/4"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=ngi9ih8Q; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id b13-20020a056a000ccd00b0051c2ac96debsi1207370pfv.288.2022.06.06.06.19.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 06:19:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b="1/iSwJ/4"; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=ngi9ih8Q; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8189C93453; Mon, 6 Jun 2022 06:08:24 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238365AbiFFNIP (ORCPT + 99 others); Mon, 6 Jun 2022 09:08:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238366AbiFFNIO (ORCPT ); Mon, 6 Jun 2022 09:08:14 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 702986B00F; Mon, 6 Jun 2022 06:08:11 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id B6D2C21A90; Mon, 6 Jun 2022 13:08:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1654520889; 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=8MN/pjZfKcAO7FTQBAh4+y52Sr75CPrTtBghqpmx7gg=; b=1/iSwJ/4PLELCpyrs8S1HtZHBKST/UvsE1r21I4uGOi/04gs9oJCxUZaUxLSXuAWyL6ssC ZAFXYaFW4OK2b7hGhTLY9z5f1SyM6EE4GHrwHha/yC19zc8BWgCgLKe4zT6QCshBbO9eYO I5qyPNzjC+gHxb/IT40kxTcDC8NyiPc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1654520889; 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=8MN/pjZfKcAO7FTQBAh4+y52Sr75CPrTtBghqpmx7gg=; b=ngi9ih8Qj6gB5/Ajz1UcVipkjFEVNImKpHTZ14aqByhXvwXneNWiGbARS1pEmy139upIAm 8dXNdibURT9rPRAg== Received: from quack3.suse.cz (unknown [10.163.28.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id A4C2C2C141; Mon, 6 Jun 2022 13:08:09 +0000 (UTC) Received: by quack3.suse.cz (Postfix, from userid 1000) id 5CE76A0633; Mon, 6 Jun 2022 15:08:09 +0200 (CEST) Date: Mon, 6 Jun 2022 15:08:09 +0200 From: Jan Kara To: Matthew Wilcox Cc: Jan Kara , Jan Kara , tytso@mit.edu, Andreas Dilger , linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 1/3] quota: Prevent memory allocation recursion while holding dq_lock Message-ID: <20220606130809.6mton73yzxekjwtv@quack3.lan> References: <20220605143815.2330891-1-willy@infradead.org> <20220605143815.2330891-2-willy@infradead.org> <20220606080334.tv5r7kljang55fat@quack3.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 Mon 06-06-22 13:42:10, Matthew Wilcox wrote: > On Mon, Jun 06, 2022 at 10:03:34AM +0200, Jan Kara wrote: > > On Sun 05-06-22 15:38:13, Matthew Wilcox (Oracle) wrote: > > > As described in commit 02117b8ae9c0 ("f2fs: Set GF_NOFS in > > > read_cache_page_gfp while doing f2fs_quota_read"), we must not enter > > > filesystem reclaim while holding the dq_lock. Prevent this more generally > > > by using memalloc_nofs_save() while holding the lock. > > > > > > Signed-off-by: Matthew Wilcox (Oracle) > > > > This is definitely a good cleanup to have and seems mostly unrelated to the > > rest. I'll take it rightaway into my tree. Thanks for the patch! > > Thanks! It's really a pre-requisite for the second patch; I haven't > seen anywhere in the current codebase that will have a problem. All > the buffer_heads are allocated with GFP_NOFS | __GFP_NOFAIL (in > grow_dev_page()). Yes, I understand. But as f2fs case shows, there can be fs-local allocations that may be impacted. And it is good to have it documented in the code that dq_lock is not reclaim safe to avoid bugs like f2fs had in the future. Honza -- Jan Kara SUSE Labs, CR