Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp718708rdb; Tue, 23 Jan 2024 12:40:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IGSXR3jWooZieIlYzOULpdsMolX1hIu3WJYNFE45LBJKP7DGkYljkr8CfgS4vOsIoVNi+ZF X-Received: by 2002:a17:90a:49cb:b0:28c:f2f5:a966 with SMTP id l11-20020a17090a49cb00b0028cf2f5a966mr3083508pjm.10.1706042447476; Tue, 23 Jan 2024 12:40:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706042447; cv=pass; d=google.com; s=arc-20160816; b=wA8WdCdrPeQ8KQC4ntFfLZn+BGklp1l/pYjw1AOp0vAQjPxmX+iOXxTkPloHqz6B0I ryRWNEuLlCQKTp7//ELMdpfaKGoniyk5bfsBB/VfC8v9JtXzBntVauI0C4l/ApekB2YA 2JyC1MA2jUmFEH8z+4tkgPoOReBhBgngbYoGF3J/9k4EZsXstXOYRVOxDyZdsgmqPuBC apjzt2qfhPOqjunzcEQ2q+5Gn2SedwIG/J2v48Ghp+67mrxNcGMFxC6hZRWri0K7Bv0h 7bcPTKg1S3MQg9sfz9KHO578hmaAYgd/GyIJf4yzUNRgMRZS5Lp/A+8ZIHn8Qgpgjlqg 0M7g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:in-reply-to:subject:cc:to:from:date :dkim-signature; bh=MZviQqgVcq2tRc3p4TWEA+VfgMFTGON5OotgVwwOHF4=; fh=g4TEmrtWX88WqhOP/U/G24TMXq4NPRfWynUFEp2N4f8=; b=m2Ln0cr+5wgQ/s87F3vaK7BBFuD5nxbB6Xn/YLFQw+k5F+b2QRtoV+SwiPXlqlWejW iYokVaff2C4XrPoAW1rPg83bAD00hrXNTa/eOj4dj84lP2QbZLQv9hyOBTVLg9THetQL e/H0rlhXcFM6NAwMb8Ouluo6uOafRVxj0wzJQjX9FjXQ/raPpXki+mnahRUIiLu0hw1u lI+ISgPzlOSwpdr+W1AiVfoTfqQu1o+JhjO6DdrgHWLcJ/PEseedmQ7tm7Gg8FKeDiWB gwQET6m7LMT9p7Dl501Md+BILTdBWbV+H6Kk88ysEIlzRQqbLTU9XsvcpdCh8o+4h4OA 6c2Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AEXR0JW3; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-36033-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36033-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id a5-20020a17090a008500b0028db9dc6563si10474279pja.110.2024.01.23.12.40.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 12:40:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-36033-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AEXR0JW3; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-36033-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36033-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 70CC9290E50 for ; Tue, 23 Jan 2024 20:39:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2C19B4C81; Tue, 23 Jan 2024 20:39:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="AEXR0JW3" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 08F7A4417 for ; Tue, 23 Jan 2024 20:39:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706042352; cv=none; b=Jo1cR5j1KvjAcf+2CWrVtjDP/IEZhQ0FXBddT58Y45p9x3vYk7HvwkUCtKjJYoMxAzM32W+ZTTvGVLwGDRDLQN+SLoXU6xtlcfLH4Hgxae31+SghxNGpEjuU8926411ZgCS1KqjGupKISj66irYG1ouTKhR3bkOzXfKyP3vC0Fg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706042352; c=relaxed/simple; bh=AKvnUEhfVuCU8VrVyAXnPsxlke6MhfWDzU9qTo+VAk8=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=sqhHzlGbOkqdU8xOwL/7WwD3oN9L1bUmeGRochQrvwvWS0s42GYryBzpzlOJaE+SjEwU3Z4GsoXaL1poNs8LIhv+T796ffLt1I3lOWYvtnNXAWv8oGClnxhWp6aHKUoh9FvuakvaJ1SBDCFS9S99O6s/uJbOyFjZ0hRPZPevDKE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=AEXR0JW3; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706042350; h=from:from:reply-to:subject:subject: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=MZviQqgVcq2tRc3p4TWEA+VfgMFTGON5OotgVwwOHF4=; b=AEXR0JW3kcQewmXfRpoKS0VgDzaTzwxOXZlygNLAzJ7cw7nHVfaY40lxE7XFrjOsfOqLMX LP6TiRmZgA/665cjMvGNe/DtqBV1xBq8UaiTK45GarJrZ3zVfsZ8SUQfdm03jM6uw4hl9p QCJtvtqz6s4R6knrExoPdwtM8zNB+m0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-16-4b7BRzuFOe-EJjmvnNvwOg-1; Tue, 23 Jan 2024 15:39:04 -0500 X-MC-Unique: 4b7BRzuFOe-EJjmvnNvwOg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 088278828C2; Tue, 23 Jan 2024 20:39:03 +0000 (UTC) Received: from file1-rdu.file-001.prod.rdu2.dc.redhat.com (unknown [10.11.5.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EC2462026D66; Tue, 23 Jan 2024 20:39:02 +0000 (UTC) Received: by file1-rdu.file-001.prod.rdu2.dc.redhat.com (Postfix, from userid 12668) id D9D7030A79CB; Tue, 23 Jan 2024 20:39:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by file1-rdu.file-001.prod.rdu2.dc.redhat.com (Postfix) with ESMTP id D72613FB4E; Tue, 23 Jan 2024 21:39:02 +0100 (CET) Date: Tue, 23 Jan 2024 21:39:02 +0100 (CET) From: Mikulas Patocka To: Johannes Thumshirn cc: 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 In-Reply-To: <20240123-zonefs_nofs-v1-1-cc0b0308ef25@wdc.com> Message-ID: <31e0f796-1c5-b7f8-2f4b-d937770e8d5@redhat.com> References: <20240123-zonefs_nofs-v1-0-cc0b0308ef25@wdc.com> <20240123-zonefs_nofs-v1-1-cc0b0308ef25@wdc.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 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 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) Mikulas