Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp784545rdb; Tue, 23 Jan 2024 15:23:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IETLdJL2D19Zy7SOiaOh/7v6MntTR/TLNk0w4sS5jxzj7KxSMvbPL4rdANzHds3MqvOpMKG X-Received: by 2002:a17:902:e84c:b0:1d7:7b3d:99b7 with SMTP id t12-20020a170902e84c00b001d77b3d99b7mr1081585plg.132.1706052181973; Tue, 23 Jan 2024 15:23:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706052181; cv=pass; d=google.com; s=arc-20160816; b=br0kU80kSniG9jn6WpRIARBoBtS/YA/MXRSYBLsYCyvofSqPVwmlAg9O85EAi7ZyZv 5edvMJvwlvUhzoOJbhpr+1ikskij2yult3oGTDmW+52C3kwUPnFBun/AbENmXslBeDMk ZdcETgiWg1yIby6MLgj9wdzfFt6/sEtkLTVmnySb8S3HkejY47hzkBKUNLC8uH8iHv82 YEAOlXlLk1cEtA4172KOKscQkIaSxdv5r+nipR98x3bbjidYU6U9SKePmykb9TKOp93K fG38elxoQVWiB8i7VHFWkIJJNdBjYE8Pb5enE8MZYzs9ajjxveOIzT4mYY4L1YAX2h5t vLXQ== ARC-Message-Signature: i=2; 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=pyNE0YBQ61XvxQg0qzcUw/mj3pyKM5V+H7U9PFr3Dnc=; fh=nW9w4jroRIk+ni1tjXf+j5292pcXz8Umz1J75zPu4f8=; b=rRX+o2GQAbgCeyWAFcdLyN9dBFJQ1oX8G5SE/e1LfZ4ZHsAp/NLNOskqykF2GtXiZw 4r6fkU7biNC4HtFN3TxvL934HVhz3lbjlWB6aySOTSN0PREY63UqltYHgs7SdoE9Nmun cptvXyoZLVAcYQNoRgEwJwQT+WxJr75f6iksbqS8bCNy7QP+x7hu2QWazky3/rs86bdq YJdq+/MK+kSdefJoAmrRyNRcL3S+OK4P9nVd8aBpwAHqAY30VFjWHtB76ozHZeTm8aZE +AlMFBIw5afUZVL8++KqBr6F4+QOOsj8F2+w3M5a5lQz9PjAyt2aaB2QDthHW9LgGhqb QeHw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fromorbit-com.20230601.gappssmtp.com header.s=20230601 header.b=RvX4HvfC; arc=pass (i=1 spf=pass spfdomain=fromorbit.com dkim=pass dkdomain=fromorbit-com.20230601.gappssmtp.com dmarc=pass fromdomain=fromorbit.com); spf=pass (google.com: domain of linux-kernel+bounces-36183-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36183-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fromorbit.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id q1-20020a170902bd8100b001cffca283fasi10406313pls.144.2024.01.23.15.23.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 15:23:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-36183-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@fromorbit-com.20230601.gappssmtp.com header.s=20230601 header.b=RvX4HvfC; arc=pass (i=1 spf=pass spfdomain=fromorbit.com dkim=pass dkdomain=fromorbit-com.20230601.gappssmtp.com dmarc=pass fromdomain=fromorbit.com); spf=pass (google.com: domain of linux-kernel+bounces-36183-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36183-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fromorbit.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id A401E283598 for ; Tue, 23 Jan 2024 23:22:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5BE3B54BF2; Tue, 23 Jan 2024 23:21:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fromorbit-com.20230601.gappssmtp.com header.i=@fromorbit-com.20230601.gappssmtp.com header.b="RvX4HvfC" Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71AFF53E17 for ; Tue, 23 Jan 2024 23:21:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706052113; cv=none; b=CDediXp+Hx5qt4qJYVHjt6km3S0t/opfHFdV6vB/ieej8ohiIWl8Y3Aqk1NWCAWXdKHLIxzdvlhsVVEUjw6DoZfLOXHBPaF6JXWQKpf3MmS1k0VOFwD3tEMbtr9Z+CHRuRcLT1HVvSUphhkdcJ+g3JJyjuuKiX7tKnzNGC179vk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706052113; c=relaxed/simple; bh=ZR7sfWUwnT5BjG/tPD79vE4fth31migQSpuAcSwowUg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=J+9pVnhHCyzFGPavGYi0d6GVcjrbhWCiCkYoXr6/XbbhTxt0+GWyuiX4dHJ6ZHYHntGPUwbOlYyb9toOGsTgyqmjy3aZ16M3DfhkTAlBAEgwwTu/M2P+dS0ynUHgie65lS3Pate3XJiW1fmK0SBnBnfJKaQnOdi86fJjS4ilWjg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=fromorbit.com; spf=pass smtp.mailfrom=fromorbit.com; dkim=pass (2048-bit key) header.d=fromorbit-com.20230601.gappssmtp.com header.i=@fromorbit-com.20230601.gappssmtp.com header.b=RvX4HvfC; arc=none smtp.client-ip=209.85.214.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=fromorbit.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fromorbit.com Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1d71e184695so19441265ad.3 for ; Tue, 23 Jan 2024 15:21:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fromorbit-com.20230601.gappssmtp.com; s=20230601; t=1706052111; x=1706656911; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=pyNE0YBQ61XvxQg0qzcUw/mj3pyKM5V+H7U9PFr3Dnc=; b=RvX4HvfCp9MumJ6K8hIZzKFqBmgWHy/Y6u1vIUhjUQtIO4WFvjpCcqE70cg9PTfjRU +gDCUwKH4q0tfBIS0xfLoBJ1oaO5rJFYohmjq2yfeAKb8gQSJqyHKp44xaQeRPdQS5XI fDZcdggS8uPRwLROIRGfDdxD/56XoKevdcwY6M3M3FLudZgNoy6HsBhV4f2FMDeblEsL azKvCt06cZXAxAVsFCC6vJWC9/AvSgwn6Dzx+NkAbMyg9LsjT2K4Uf6JwkuG00v2geI8 Yt9qz2qHhvckMjKyDxEIBSZ3kbhkOb9M5H0N+UYQG6SHzoYr+4GlCEbngYI/xIUF0JRZ Da4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706052111; x=1706656911; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=pyNE0YBQ61XvxQg0qzcUw/mj3pyKM5V+H7U9PFr3Dnc=; b=kDtbTiQpwCv4+oDty8/nT4baFEzBiUNJlc8ZfPs6qX9tveIrT9Nz27RtTTD9fOp56H r9NbBDicamRNdqweoG7q2hjrPjUQK68Jyn7FGRPt/OG1mdL0TnZENT1bIbFdB75sRmEz qJ6pWzZhgINqM6V/XMot9Kw0Mh1jK/+yMT0R6mM1aBVOrs34lyonDHFCl5iAs4QBL62y ktPVANzhnlJUFXBEoBQARENrwwulD4BfD8m/AwvpJDYb2hCZKruaxeNG9yaWHAYsSxyA V9TKLeTFxnXI3wlJcoTKTrpCBi0UiwdN/juFH1vOZy5mgo1MPGDeY/+YOy3zAcLj5GF/ wxzg== X-Gm-Message-State: AOJu0YyEavUF/IK3Zsng1KX0ArPHDrfQXc6S42cXylx5H+QVPKNeqSKJ LZw+29LQzSPkzPi791CESQY7W7g6x+j4DAuNG3dc/W3tuYoA/IiG0MHjWQsYjLg= X-Received: by 2002:a17:902:d202:b0:1d7:1e5d:ab39 with SMTP id t2-20020a170902d20200b001d71e5dab39mr3908243ply.80.1706052110812; Tue, 23 Jan 2024 15:21:50 -0800 (PST) Received: from dread.disaster.area (pa49-181-38-249.pa.nsw.optusnet.com.au. [49.181.38.249]) by smtp.gmail.com with ESMTPSA id t10-20020a170902bc4a00b001d714a1530bsm8165932plz.176.2024.01.23.15.21.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 15:21:50 -0800 (PST) Received: from dave by dread.disaster.area with local (Exim 4.96) (envelope-from ) id 1rSQ5T-00EPce-2c; Wed, 24 Jan 2024 10:21:47 +1100 Date: Wed, 24 Jan 2024 10:21:47 +1100 From: Dave Chinner To: Mikulas Patocka Cc: Johannes Thumshirn , Damien Le Moal , Naohiro Aota , Mike Snitzer , dm-devel@lists.linux.dev, Chris Mason , Josef Bacik , David Sterba , Jaegeuk Kim , Chao Yu , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, "Matthew Wilcox (Oracle)" Subject: Re: [PATCH 1/5] zonefs: pass GFP_KERNEL to blkdev_zone_mgmt() call Message-ID: References: <20240123-zonefs_nofs-v1-0-cc0b0308ef25@wdc.com> <20240123-zonefs_nofs-v1-1-cc0b0308ef25@wdc.com> <31e0f796-1c5-b7f8-2f4b-d937770e8d5@redhat.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: <31e0f796-1c5-b7f8-2f4b-d937770e8d5@redhat.com> On Tue, Jan 23, 2024 at 09:39:02PM +0100, Mikulas Patocka wrote: > > > On Tue, 23 Jan 2024, Johannes Thumshirn wrote: > > > Pass GFP_KERNEL instead of GFP_NOFS to the blkdev_zone_mgmt() call in > > zonefs_zone_mgmt(). > > > > As as zonefs_zone_mgmt() and zonefs_inode_zone_mgmt() are never called > > from a place that can recurse back into the filesystem on memory reclaim, > > it is save to call blkdev_zone_mgmt() with GFP_KERNEL. > > > > Signed-off-by: Johannes Thumshirn > > --- > > fs/zonefs/super.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c > > index 93971742613a..63fbac018c04 100644 > > --- a/fs/zonefs/super.c > > +++ b/fs/zonefs/super.c > > @@ -113,7 +113,7 @@ static int zonefs_zone_mgmt(struct super_block *sb, > > > > trace_zonefs_zone_mgmt(sb, z, op); > > ret = blkdev_zone_mgmt(sb->s_bdev, op, z->z_sector, > > - z->z_size >> SECTOR_SHIFT, GFP_NOFS); > > + z->z_size >> SECTOR_SHIFT, GFP_KERNEL); > > if (ret) { > > zonefs_err(sb, > > "Zone management operation %s at %llu failed %d\n", > > > > -- > > 2.43.0 > > zonefs_inode_zone_mgmt calls > lockdep_assert_held(&ZONEFS_I(inode)->i_truncate_mutex); - so, this > function is called with the mutex held - could it happen that the > GFP_KERNEL allocation recurses into the filesystem and attempts to take > i_truncate_mutex as well? > > i.e. GFP_KERNEL -> iomap_do_writepage -> zonefs_write_map_blocks -> > zonefs_write_iomap_begin -> mutex_lock(&zi->i_truncate_mutex) zonefs doesn't have a ->writepage method, so writeback can't be called from memory reclaim like this. -Dave. -- Dave Chinner david@fromorbit.com