From mboxrd@z Thu Jan 1 00:00:00 1970 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 2A0C52116 for ; Tue, 23 Jan 2024 20:39:11 +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=1706042353; cv=none; b=mug2M8E+LjcejVf7QmxjZwUfosG5wu4nn/tdmTEDkO5Sm7O0SWPCnpQiFZ1ZQqgIiZ9wS046YmF58OWQLZV/J7XV1JGQAVakMZNi1ewRJaPwFY2+z/wcx7YRaJfUpzH/GWOGcoXVSWCa2PmJkSKQdBhpmUk5bUU/2Vuzf4LI4zs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706042353; c=relaxed/simple; bh=AKvnUEhfVuCU8VrVyAXnPsxlke6MhfWDzU9qTo+VAk8=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=dwMOE/6RaTnc33dEtDB2RZXhDF3jQKnKur2F41N8AEV55X4Bxx6dY/K/Ac+G2s4uU+yj4dwHA5YSjl32gYn9J4/TQvaCKpZeSLvOdOAgeO0lpy6hg83YoaYR9YTCaj+ztuiW1yPX6VKSc0mlamvDDbhHy+Gk5gAWjVKHTwliac0= 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=bvc4vpaD; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="bvc4vpaD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706042351; 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=bvc4vpaDM73yvGY00LFUPeIo9Q+zXzGUvTiI4zi3yREe6x2c9rTFy5M83v6p5Zs4ha/6iD DYnmBpFkCeDU5S3qRAhs90cDahwLXvlb/pMpdxyObsPu5/6QY8nid02f+mTfUv1WRTVx1I EFtKKNL6ImB0nrynaMjhEru5QUYNBUA= 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-btrfs@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