[{"id":3683055,"web_url":"http://patchwork.ozlabs.org/comment/3683055/","msgid":"<20260428012829.GA16497@macsyma-wired.lan>","list_archive_url":null,"date":"2026-04-28T01:28:29","subject":"Re: [PATCH] ext4: avoid __GFP_NOFAIL in __ext4_get_inode_loc\n allocation","submitter":{"id":350,"url":"http://patchwork.ozlabs.org/api/people/350/","name":"Theodore Tso","email":"tytso@mit.edu"},"content":"On Mon, Apr 27, 2026 at 06:23:00PM -0400, Chao Shi wrote:\n> When kswapd shrinks the dcache, the last iput() on an ext4 inode can\n> trigger ext4_orphan_del(), which calls ext4_reserve_inode_write() and\n> ultimately __ext4_get_inode_loc().  That function calls sb_getblk(),\n> which wraps __getblk() and carries implicit __GFP_NOFAIL.  Because\n> kswapd runs with PF_MEMALLOC set, combining NOFAIL with a non-reclaimable\n> context trips WARN_ON_ONCE(current->flags & PF_MEMALLOC) inside\n> __alloc_pages_slowpath(), producing a spurious splat even though the\n> allocation could simply fail and return -ENOMEM to the caller.\n\nNAK.  As Sashiko correctly points out:\n\nSashiko AI review found 1 potential issue(s):\n- [Critical] Removing __GFP_NOFAIL from __ext4_get_inode_loc causes transient memory\nshortages to trigger a fatal filesystem abort (remount read-only) or severe metadata\ncorruption, trading a memory reclaim warning for a Denial of Service.\n\nThe warning in mm/page_alloc.c is the sort of thing that causes file\nsystem developers to decide to drop __GFP_NOFAIL and replace it with a\nretry loop just to shut the mm subsystem the heck up, since some mm\ndevelopers seem to view hangs in heavy OOM conditions as the worst\nthing, where as fs developers consider data corruption to be far\nworse, since users tend to get cranky when they lose their data, and\n(a) in practice the OOM killer tends to get triggered first, and (b)\nthat's what software and hardware watchdogs are for.\n\nIn any case, there are *far* worse things than a random splat, and if\nyou really want to make it go away, my suggestion is to remove the\nWARN_ON_ONCE from __alloc_pages_slowpath().\n\n\t\t/*\n\t\t * PF_MEMALLOC request from this context is rather bizarre\n\t\t * because we cannot reclaim anything and only can loop waiting\n\t\t * for somebody to do a work for us.\n\t\t */\n\t\tWARN_ON_ONCE(current->flags & PF_MEMALLOC);\n\nI disagrr the premise; it's not bizzare at all.\n\n\t\t\t\t\t\t- Ted","headers":{"Return-Path":"\n <SRS0=5Vbc=C3=vger.kernel.org=linux-ext4+bounces-16132-patchwork-incoming=ozlabs.org@ozlabs.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-ext4@vger.kernel.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","patchwork-incoming@ozlabs.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=mit.edu header.i=@mit.edu header.a=rsa-sha256\n header.s=outgoing header.b=bpxNAWe1;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org\n (client-ip=2404:9400:2221:ea00::3; helo=mail.ozlabs.org;\n envelope-from=srs0=5vbc=c3=vger.kernel.org=linux-ext4+bounces-16132-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)","gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=\"2600:3c0a:e001:db::12fc:5321\"\n arc.chain=subspace.kernel.org","gandalf.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=mit.edu","gandalf.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=mit.edu header.i=@mit.edu header.a=rsa-sha256\n header.s=outgoing header.b=bpxNAWe1;\n\tdkim-atps=neutral","gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-ext4+bounces-16132-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=mit.edu header.i=@mit.edu\n header.b=\"bpxNAWe1\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=18.9.28.11","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=mit.edu","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=mit.edu"],"Received":["from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1 raw public key)\n server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g4NCt31Bwz1xvV\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 11:30:18 +1000 (AEST)","from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4g4NCt25ySz4wL6\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 28 Apr 2026 11:30:18 +1000 (AEST)","by gandalf.ozlabs.org (Postfix)\n\tid 4g4NCt22gXz4wJP; Tue, 28 Apr 2026 11:30:18 +1000 (AEST)","from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby gandalf.ozlabs.org (Postfix) with ESMTPS id 4g4NCn1Jj8z4wL6\n\tfor <patchwork-incoming@ozlabs.org>; Tue, 28 Apr 2026 11:30:13 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 5993D302BB80\n\tfor <patchwork-incoming@ozlabs.org>; Tue, 28 Apr 2026 01:29:55 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id CD2642BE7DD;\n\tTue, 28 Apr 2026 01:29:54 +0000 (UTC)","from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 285972874FB\n\tfor <linux-ext4@vger.kernel.org>; Tue, 28 Apr 2026 01:29:52 +0000 (UTC)","from macsyma.thunk.org (pool-173-48-114-3.bstnma.fios.verizon.net\n [173.48.114.3])\n\t(authenticated bits=0)\n        (User authenticated as tytso@ATHENA.MIT.EDU)\n\tby outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 63S1TTY5004923\n\t(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT);\n\tMon, 27 Apr 2026 21:29:31 -0400","by macsyma.thunk.org (Postfix, from userid 15806)\n\tid 75A8B654B4B6; Mon, 27 Apr 2026 21:28:29 -0400 (EDT)"],"ARC-Seal":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1777339818; cv=pass;\n\tb=y+PJzJJ7N5qOIYvcj/RmEf4Wayze+gTKWRMVeAGmyHfBbXI9mpKig6udmDA/rZfu3uZBEVCznrX2n8fgT6KFf/l7S99B6wJ2l/+frVB5AEJvY/auelqTXnDwaJTmiuBE+gNqPtmxpC/DfDi6EKzrHx1/aK7Xe5FnlJHi6/+GypVAZB04DUdOAuXKjq4PoEdwwnTrFvqCaSPV9ct6KrycaWub78qP4nzTz9ZTMFvW3LvbZXZFV6NLb7Ap0I2/Gk6t/J3cv/YGOlQRCCub5j1Q/IaTPcrQOzocA7UPWicgb3UfGYSms5GsdFYsX1/Rozp5xFD4jzm8t7Q/yeGIsDzCQg==","i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777339794; cv=none;\n b=Vp04gZJ+4vL8JvAbL7Mb2XyzBUi4hYneSrJz0nTCnIZCQxf1/9FRquqOgkEbaIZ0N65PZVrWH6pJsR1nHFsYUWkOsZwvHaVgH8ioDEveG5pVky61WwUSXZSupmM5z1fRvBRzzlpKn8xoYN7XHrMbQL4jS5CriE4ylVQlI16CGu8="],"ARC-Message-Signature":["i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1777339818; c=relaxed/relaxed;\n\tbh=anb5HoXbr6dEjzu4UFV8nxvroOX7Fqri7kDOT8ZZVTQ=;\n\th=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:\n\t Content-Type:Content-Disposition:In-Reply-To;\n b=WRsnnM1GjZ18roAsc/CXoGf0MDcpx8I3ipFxXxx/x8P9SdHX+oYXQAICCwIqGGTfZ6/u2acyL5mDXJx6QdnubFfi9RT3TSD9LwryCDqoetnEt2pO8t4ciQCwpT10BgmTdwT3WEeoLQE2k2Zw/sHf7zOwFk+g1lyXbpiKCAzUaveD6JdOF9Zy01IOHiCa6M99Wej+Myii3DFrEww99FoGlpd5v8ubfeyjuZ1NQDT9VGzAH8d6wjorFqitIY0SQNKQ/dK/QX6oWmm/0ylGKUaQVPEjx9NGM5MRX3ZjGhvrDXeQLvSg3eaiEvouXGbvJRFKzvBf3qdvwnnN/RUHETONCg==","i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777339794; c=relaxed/simple;\n\tbh=qpgrSG8ClOQgTRhrw6/SuH6V4RCoB/x7rUrBv9a4oDE=;\n\th=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:\n\t Content-Type:Content-Disposition:In-Reply-To;\n b=kNQ4+VUrViKRel0hPRJwHKvfHAV4agAz5pDL6zpZHJeO2wad2RXfEQmXUgno/KEEAqX0kdkZgEHNbDjVOaFji4LRGYG0jpU2NS2NCxc02BJXV6pEr9hASOu5mB7tCLm82iAy63WxTNmXrFEGoNS0bThnMilQjztEuZxw85Wiqkw="],"ARC-Authentication-Results":["i=2; gandalf.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=mit.edu; dkim=pass (2048-bit key;\n unprotected) header.d=mit.edu header.i=@mit.edu header.a=rsa-sha256\n header.s=outgoing header.b=bpxNAWe1; dkim-atps=neutral;\n spf=pass (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-ext4+bounces-16132-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org","i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=mit.edu;\n spf=pass smtp.mailfrom=mit.edu;\n dkim=pass (2048-bit key) header.d=mit.edu header.i=@mit.edu\n header.b=bpxNAWe1; arc=none smtp.client-ip=18.9.28.11"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=mit.edu; s=outgoing;\n\tt=1777339773; bh=anb5HoXbr6dEjzu4UFV8nxvroOX7Fqri7kDOT8ZZVTQ=;\n\th=Date:From:Subject:Message-ID:MIME-Version:Content-Type;\n\tb=bpxNAWe1scg4JxXpkEIwUkzs72lQojFaq3rGl9FCWcpi9r6M4VWbqLMgpig7nzEhr\n\t 43DNV2x4sl+k78fpqyB2r2QhGtFFgIw5z2DxxepQf9Q9HrJvep8wS2MvDqiV31LxnU\n\t Uhmy3ywN6rPNZdFPXwoBmDZ88LpK6dgMNshbwwtACy4NFy42hjXKnasmCbazSmUe6V\n\t Pk+E1Eq1NHirBU76JRIQrYyPBCL4zVLqCOhcxzxl8uaaDZcT+hiDOcBQitfzsGW8XC\n\t 08YnXxczIlasbhlV3ZnsH1kA3UuG7yqnMroZ9I5s2sZWrbrC6U6FvNvEC9jbseOfCO\n\t tz5YHQBUP9tZQ==","Date":"Mon, 27 Apr 2026 21:28:29 -0400","From":"\"Theodore Tso\" <tytso@mit.edu>","To":"Chao Shi <coshi036@gmail.com>","Cc":"linux-ext4@vger.kernel.org, adilger.kernel@dilger.ca, jack@suse.cz,\n        Sungwoo Kim <iam@sung-woo.kim>, Dave Tian <daveti@purdue.edu>,\n        Weidong Zhu <weizhu@fiu.edu>","Subject":"Re: [PATCH] ext4: avoid __GFP_NOFAIL in __ext4_get_inode_loc\n allocation","Message-ID":"<20260428012829.GA16497@macsyma-wired.lan>","References":"<20260427222300.1284855-1-coshi036@gmail.com>","Precedence":"bulk","X-Mailing-List":"linux-ext4@vger.kernel.org","List-Id":"<linux-ext4.vger.kernel.org>","List-Subscribe":"<mailto:linux-ext4+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-ext4+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20260427222300.1284855-1-coshi036@gmail.com>","X-Spam-Status":"No, score=-1.2 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DMARC_PASS,\n\tHEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,\n\tSPF_PASS autolearn=disabled version=4.0.1","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org"}}]