Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp1498646rdb; Sat, 23 Dec 2023 08:57:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IGCgq0Xcm5ShP1748ZQ/zEh2Kz5pJF9n3JE7LpUSXPG8wfv7kCfdcVIb/ofJT43IhwVFWpF X-Received: by 2002:a05:620a:1191:b0:781:20ca:923d with SMTP id b17-20020a05620a119100b0078120ca923dmr3262242qkk.78.1703350630591; Sat, 23 Dec 2023 08:57:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703350630; cv=none; d=google.com; s=arc-20160816; b=ie/RMmzb9Cx1t7meWUjHLzrktbYoK+b2GacMmum3TsaYEqwls+K5vH7V3sbWgepzJ6 Tr4bS8Kuy/r/HSv0f+q59z+u5io4OLdEffYQo1KURDOSWKLpSuhqR88OwyEJ5/zAbY8z nC9qCUjZ+URquwol6j2/N3FNWi4hoNVV9N9hpWmPc7sx6r0AMXmMeYj0M36Dzc9nACQ2 IIZxyvi/5BTg1TclIsTvSMU+cOCBJ6ecSSPDL8bXuDHPf0PY3aqJnvbhaJ7+joz9B0YP DNGYXH0jhstHEi+h6iCdOqjKtI4xkMvy0YpoeqbQM1HuRB9XyN6ji7ZSs/B6cA/ZhLA1 R5pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=I/eFQM9OFj9mUmVjzXCK/VJEaJGdQdMdFIR0hwNMvZY=; fh=vLiRp5U5TlWGEojPPL69zcPebiX4iZohEo/1Yn/h8Vo=; b=yKeQ2N8ZK5PcA0LvAB53VbIC461npfRpRtdLztuuU16XaulUILiBpeIYzXwSI5H0SY ss5XnJ/aYGZ74D/B7S1ovPwx2RoamRCxc3mS2qyMTyRF2Cy42SWdMXeXKlIVlt7NLH4t ziHh+YIejGzq5Zf2ratoTwFhOCDZS2GKHMTBKoFRWxD5X3VUgQhamnaKEIRO3pX2tNAA 8UZAzYRztRNIHF8Vj/2/ZykaIdfeuAxNgrXXiv//dPE9XoPpEPwL+re30CpWjv4TDqtN dUGxUaVFVFVLvmrx/xJb1//J86icg/ZQRwE18u4ngmXoGJyZhp+F2Wjtlw3VyETwP+KY 3c5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=WCCl570W; spf=pass (google.com: domain of linux-kernel+bounces-10505-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10505-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id b10-20020a05620a126a00b007812a53f113si4263772qkl.368.2023.12.23.08.57.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 Dec 2023 08:57:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-10505-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=WCCl570W; spf=pass (google.com: domain of linux-kernel+bounces-10505-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10505-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5115C1C20F02 for ; Sat, 23 Dec 2023 16:57:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B634212E68; Sat, 23 Dec 2023 16:57:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="WCCl570W" X-Original-To: linux-kernel@vger.kernel.org Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD6EC12E4C; Sat, 23 Dec 2023 16:56:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=I/eFQM9OFj9mUmVjzXCK/VJEaJGdQdMdFIR0hwNMvZY=; b=WCCl570WZpNXZxA0H1eMYJhmNZ fWwhiO4bF5zkndDyquY6lslVyBip0vv5KO3QfTUJfywTHivnH5X1HLiE5T8O4L/4DwLIT3heVjOkz LLY7s4Oks/svjXGQOSBN6djfEJDD/bDAKwyYjeGYTzV+Sq+vyDQAXRkF5485h9uNwfC+fdW3fPhNJ gdhF6cTeozO6xslaFmFFRe7fFieoIBdybeQ3GNtZl8c41Z0hqYJEJnsn8QtzgxeIC2wEnZAjRik8N uekGh7L+dsMuzAR3az0iHWZtYz+8E7EYDF53wcz2Tv5qooQP2h8ZdDDwwbfU6Osqv5NQ9GxJWNHZK PjSmplJw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rH5Iw-00BFGY-IN; Sat, 23 Dec 2023 16:56:50 +0000 Date: Sat, 23 Dec 2023 16:56:50 +0000 From: Matthew Wilcox To: Tetsuo Handa Cc: Konstantin Komarov , ntfs3@lists.linux.dev, Linux Kernel Mailing List , linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 5/8] fs/ntfs3: Use kvmalloc instead of kmalloc(... __GFP_NOWARN) Message-ID: References: <890222ac-1bd2-6817-7873-390801c5a172@paragon-software.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Sat, Dec 23, 2023 at 10:33:11PM +0900, Tetsuo Handa wrote: > But you can't replace GFP_NOFS with GFP_KERNEL anyway, for syzbot is also > reporting GFP_KERNEL allocation with filesystem lock held > at https://syzkaller.appspot.com/bug?extid=18f543fc90dd1194c616 . Well, you _can_. What _all_ filesystem authors should be doing is switching to memalloc_nofs_save/restore. Generally when taking a lock that's needed during reclaim. In this specific case, soemthing like this: diff --git a/fs/ntfs3/record.c b/fs/ntfs3/record.c index 7b6423584eae..432905489a14 100644 --- a/fs/ntfs3/record.c +++ b/fs/ntfs3/record.c @@ -122,6 +122,7 @@ int mi_read(struct mft_inode *mi, bool is_mft) struct ntfs_inode *mft_ni = sbi->mft.ni; struct runs_tree *run = mft_ni ? &mft_ni->file.run : NULL; struct rw_semaphore *rw_lock = NULL; + unsigned int memalloc = memalloc_nofs_save(); if (is_mounted(sbi)) { if (!is_mft && mft_ni) { @@ -177,6 +178,7 @@ int mi_read(struct mft_inode *mi, bool is_mft) goto out; } + memalloc_nofs_restore(memalloc); return 0; out: @@ -186,6 +188,7 @@ int mi_read(struct mft_inode *mi, bool is_mft) err = -EINVAL; } + memalloc_nofs_restore(memalloc); return err; }