From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 90E6ECCFA00 for ; Mon, 3 Nov 2025 01:49:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:Message-ID:In-Reply-To:Date:From:To:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:References:List-Owner; bh=lOwNGzZrHF/n6c1jqKGqCwnrk5Ql5skQPVKD3oSM6jU=; b=E9JQKuTeeBPN0UEp7bl43fy8LT Y+KiUP4CCaj+LEFMpFSyERyc2dtZ+9iq/pQNrHbNlFVf6xFHQK9T7G8/Dkig8lPNRDgAidRMMq5rd JIuV9MeogOVF5D973wWXK0O7JQAA7IYyTuMzZQoZchQ9m3HM72Ek9O7+WBnRiZIf230U=; Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1vFjh7-0002xL-92; Mon, 03 Nov 2025 01:49:17 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1vFjh5-0002xB-Vc for linux-f2fs-devel@lists.sourceforge.net; Mon, 03 Nov 2025 01:49:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:Content-Type:MIME-Version :Message-ID:In-Reply-To:Date:From:Cc:To:Subject:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=kKAQ55ZC7CWCOj9QlnZCvTgQQ9XfGsQN//rFpJEjYqI=; b=KK9hTPkmKSbu3/oyGuQS5nTJjn dvFIFv+oH76Z9jOIf8pF7zxvZKK+xDliT2dvhsG5t9F+SsSzSPdt1qVFIeGaZxuDZscdPrCwEvCLP aRkK92KmfVxLrONQcE/uHIg/Ht1gqWfZ5mPmp3TsI8V/qptkKyS2MVIeRknV3SXXNbUQ=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID: In-Reply-To:Date:From:Cc:To:Subject:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=kKAQ55ZC7CWCOj9QlnZCvTgQQ9XfGsQN//rFpJEjYqI=; b=RhRXpazqSzf50vFqtwZA0UfEcM jV5rbI/NjwUiNHDCu3XBqo/pxDrpwj2eHKK45KxVC19NwWUVD49iGeteMZJztOxXZ64FwoyR4+Jij 4Z+IgMr2yAdBEkBB/IvjckNrttZ641I9GRncgsoOGY+DN24DlaKF95xq9f+rYBeQRzTs=; Received: from sea.source.kernel.org ([172.234.252.31]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1vFjh5-0007M2-8a for linux-f2fs-devel@lists.sourceforge.net; Mon, 03 Nov 2025 01:49:15 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id F1A88445EB; Mon, 3 Nov 2025 01:49:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69F9EC116B1; Mon, 3 Nov 2025 01:49:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1762134544; bh=arAtIsI9jWOkj6ySIvHWCR08cokcinzzktaRQv6IHN4=; h=Subject:To:Cc:From:Date:In-Reply-To:From; b=by+vf6nh/IxLNCKqVoTx0uY91rCPHfNp0SKR0gkxqPBwDPjvazd9muJvUpQ4MX6+h OVH0VZosqAwP6uQtGyF5Yr6H6NS13L3oTDqvQJ73JXuYLmDzIMf41Hyl9nZRCM3MCR X4lZ3wrziffBnDCz8ofoefifnznpH+LbyqLDfRNw= To: adilger.kernel@dilger.ca, akpm@linux-foundation.org, anna@kernel.org, axboe@kernel.dk, chao@kernel.org, djwong@kernel.org, dlemoal@kernel.org, gregkh@linuxfoundation.org, hare@suse.de, hch@infradead.org, idryomov@gmail.com, jaegeuk@kernel.org, jlayton@kernel.org, konishi.ryusuke@gmail.com, linux-f2fs-devel@lists.sourceforge.net, linux-mm@kvack.org, mcgrof@kernel.org, mngyadam@amazon.de, nagy@khwaternagy.com, syzbot+00f7f5b884b117ee6773@syzkaller.appspotmail.com, syzbot+f30591e72bfc24d4715b@syzkaller.appspotmail.com, trond.myklebust@hammerspace.com, tytso@mit.edu, viro@zeniv.linux.org.uk, willy@infradead.org, xiubli@redhat.com From: Date: Mon, 03 Nov 2025 10:46:57 +0900 In-Reply-To: <20251021070353.96705-10-mngyadam@amazon.de> Message-ID: <2025110357-fossil-reclusive-c3df@gregkh> MIME-Version: 1.0 X-stable: commit X-Patchwork-Hint: ignore X-Headers-End: 1vFjh5-0007M2-8a Subject: [f2fs-dev] Patch "nilfs2: fix deadlock warnings caused by lock dependency in init_nilfs()" has been added to the 6.1-stable tree X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: stable-commits@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net This is a note to let you know that I've just added the patch titled nilfs2: fix deadlock warnings caused by lock dependency in init_nilfs() to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: nilfs2-fix-deadlock-warnings-caused-by-lock-dependency-in-init_nilfs.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >From stable+bounces-188303-greg=kroah.com@vger.kernel.org Tue Oct 21 16:19:13 2025 From: Mahmoud Adam Date: Tue, 21 Oct 2025 09:03:43 +0200 Subject: nilfs2: fix deadlock warnings caused by lock dependency in init_nilfs() To: Cc: , , Ryusuke Konishi , , , Andrew Morton , Jens Axboe , Xiubo Li , Ilya Dryomov , Jeff Layton , Alexander Viro , Theodore Ts'o , Andreas Dilger , Jaegeuk Kim , Chao Yu , Christoph Hellwig , "Darrick J. Wong" , Trond Myklebust , Anna Schumaker , "Matthew Wilcox (Oracle)" , Hannes Reinecke , Damien Le Moal , Luis Chamberlain , , , , , , , , , , Message-ID: <20251021070353.96705-10-mngyadam@amazon.de> From: Ryusuke Konishi commit fb881cd7604536b17a1927fb0533f9a6982ffcc5 upstream. After commit c0e473a0d226 ("block: fix race between set_blocksize and read paths") was merged, set_blocksize() called by sb_set_blocksize() now locks the inode of the backing device file. As a result of this change, syzbot started reporting deadlock warnings due to a circular dependency involving the semaphore "ns_sem" of the nilfs object, the inode lock of the backing device file, and the locks that this inode lock is transitively dependent on. This is caused by a new lock dependency added by the above change, since init_nilfs() calls sb_set_blocksize() in the lock section of "ns_sem". However, these warnings are false positives because init_nilfs() is called in the early stage of the mount operation and the filesystem has not yet started. The reason why "ns_sem" is locked in init_nilfs() was to avoid a race condition in nilfs_fill_super() caused by sharing a nilfs object among multiple filesystem instances (super block structures) in the early implementation. However, nilfs objects and super block structures have long ago become one-to-one, and there is no longer any need to use the semaphore there. So, fix this issue by removing the use of the semaphore "ns_sem" in init_nilfs(). Link: https://lkml.kernel.org/r/20250503053327.12294-1-konishi.ryusuke@gmail.com Fixes: c0e473a0d226 ("block: fix race between set_blocksize and read paths") Signed-off-by: Ryusuke Konishi Reported-by: syzbot+00f7f5b884b117ee6773@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=00f7f5b884b117ee6773 Tested-by: syzbot+00f7f5b884b117ee6773@syzkaller.appspotmail.com Reported-by: syzbot+f30591e72bfc24d4715b@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=f30591e72bfc24d4715b Tested-by: syzbot+f30591e72bfc24d4715b@syzkaller.appspotmail.com> Signed-off-by: Andrew Morton Signed-off-by: Mahmoud Adam Signed-off-by: Greg Kroah-Hartman --- fs/nilfs2/the_nilfs.c | 3 --- 1 file changed, 3 deletions(-) --- a/fs/nilfs2/the_nilfs.c +++ b/fs/nilfs2/the_nilfs.c @@ -680,8 +680,6 @@ int init_nilfs(struct the_nilfs *nilfs, int blocksize; int err; - down_write(&nilfs->ns_sem); - blocksize = sb_min_blocksize(sb, NILFS_MIN_BLOCK_SIZE); if (!blocksize) { nilfs_err(sb, "unable to set blocksize"); @@ -757,7 +755,6 @@ int init_nilfs(struct the_nilfs *nilfs, set_nilfs_init(nilfs); err = 0; out: - up_write(&nilfs->ns_sem); return err; failed_sbh: Patches currently in stable-queue which might be from mngyadam@amazon.de are queue-6.1/block-fix-race-between-set_blocksize-and-read-paths.patch queue-6.1/filemap-add-a-kiocb_invalidate_pages-helper.patch queue-6.1/fs-factor-out-a-direct_write_fallback-helper.patch queue-6.1/direct_write_fallback-on-error-revert-the-ki_pos-update-from-buffered-write.patch queue-6.1/filemap-update-ki_pos-in-generic_perform_write.patch queue-6.1/filemap-add-a-kiocb_invalidate_post_direct_write-helper.patch queue-6.1/nilfs2-fix-deadlock-warnings-caused-by-lock-dependency-in-init_nilfs.patch queue-6.1/block-open-code-__generic_file_write_iter-for-blkdev-writes.patch _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel