public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: syzbot <syzbot+3e58a7dc1a8c00243999@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Forwarded: [PATCH] ntfs3: add debug warnings for run_lock initialization
Date: Tue, 14 Oct 2025 03:09:43 -0700	[thread overview]
Message-ID: <68ee2167.050a0220.ac43.00f1.GAE@google.com> (raw)
In-Reply-To: <68ed7606.a70a0220.b3ac9.001f.GAE@google.com>

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.

***

Subject: [PATCH] ntfs3: add debug warnings for run_lock initialization
Author: kartikey406@gmail.com

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

Add debug messages to track when run_lock is initialized for regular
files to help diagnose lockdep warnings.

Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
---
 fs/ntfs3/file.c  |  1 +
 fs/ntfs3/inode.c | 57 ++++++++++++++++++++++++++++++++++++++++++------
 2 files changed, 51 insertions(+), 7 deletions(-)

diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
index 4c90ec2fa2ea..0eb218a2b999 100644
--- a/fs/ntfs3/file.c
+++ b/fs/ntfs3/file.c
@@ -773,6 +773,7 @@ static long ntfs_fallocate(struct file *file, int mode, loff_t vbo, loff_t len)
 int ntfs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
 		 struct iattr *attr)
 {
+	printk(KERN_WARNING "ntfs_setattr: testing by deepanshu \n");
 	struct inode *inode = d_inode(dentry);
 	struct ntfs_inode *ni = ntfs_i(inode);
 	u32 ia_valid = attr->ia_valid;
diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
index 3959f23c487a..dafac23e20be 100644
--- a/fs/ntfs3/inode.c
+++ b/fs/ntfs3/inode.c
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+// Created regular file inode// SPDX-License-Identifier: GPL-2.0
 /*
  *
  * Copyright (C) 2019-2021 Paragon Software GmbH, All rights reserved.
@@ -50,7 +50,10 @@ static struct inode *ntfs_read_mft(struct inode *inode,
 	/* Setup 'uid' and 'gid' */
 	inode->i_uid = sbi->options->fs_uid;
 	inode->i_gid = sbi->options->fs_gid;
-
+	if (ino == 25) {
+		ntfs_warn(sb, "DEBUG: ntfs_read_mft ENTERED for inode 25");
+		dump_stack();
+	}
 	err = mi_init(&ni->mi, sbi, ino);
 	if (err)
 		goto out;
@@ -462,7 +465,11 @@ static struct inode *ntfs_read_mft(struct inode *inode,
 		inode->i_mapping->a_ops = is_compressed(ni) ? &ntfs_aops_cmpr :
 							      &ntfs_aops;
 		if (ino != MFT_REC_MFT)
+		{
+			ntfs_warn(sb, "DEBUG: deepanshu  Read inode %lu, S_ISREG=%d, run_lock_init=%d",
+          ino, S_ISREG(mode), (ino != MFT_REC_MFT));
 			init_rwsem(&ni->file.run_lock);
+		}
 	} else if (S_ISCHR(mode) || S_ISBLK(mode) || S_ISFIFO(mode) ||
 		   S_ISSOCK(mode)) {
 		inode->i_op = &ntfs_special_inode_operations;
@@ -529,27 +536,58 @@ static int ntfs_set_inode(struct inode *inode, void *data)
 struct inode *ntfs_iget5(struct super_block *sb, const struct MFT_REF *ref,
 			 const struct cpu_str *name)
 {
+	
 	struct inode *inode;
-
+	unsigned long ino = ino_get(ref);
+	 if (ino == 25) {
+                ntfs_warn(sb, "DEBUG: ntfs_iget5 called for inode 25");
+                dump_stack();
+        }
 	inode = iget5_locked(sb, ino_get(ref), ntfs_test_inode, ntfs_set_inode,
 			     (void *)ref);
 	if (unlikely(!inode))
 		return ERR_PTR(-ENOMEM);
-
+	 if (ino == 25)
+                ntfs_warn(sb, "DEBUG: inode 25 - I_NEW=%d", !!(inode->i_state & I_NEW));
 	/* If this is a freshly allocated inode, need to read it now. */
-	if (inode->i_state & I_NEW)
+	if (inode->i_state & I_NEW){
+		if (ino == 25)
+                        ntfs_warn(sb, "DEBUG: Calling ntfs_read_mft for inode 25");
 		inode = ntfs_read_mft(inode, name, ref);
+		if (ino == 25 && IS_ERR(inode)) {
+                        ntfs_warn(sb, "DEBUG: ntfs_read_mft FAILED for inode 25, error=%ld",
+                                  PTR_ERR(inode));
+                        dump_stack();
+                }
+	}
 	else if (ref->seq != ntfs_i(inode)->mi.mrec->seq) {
 		/*
 		 * Sequence number is not expected.
 		 * Looks like inode was reused but caller uses the old reference
 		 */
+		if (ino == 25 && IS_ERR(inode)) {
+                        ntfs_warn(sb, "DEBUG: ntfs_read_mft FAILED for inode 25, error=%ld",
+                                  PTR_ERR(inode));
+                        dump_stack();
+                }
 		iput(inode);
 		inode = ERR_PTR(-ESTALE);
 	}
 
-	if (IS_ERR(inode))
-		ntfs_set_state(sb->s_fs_info, NTFS_DIRTY_ERROR);
+	else if (ino == 25) {
+                ntfs_warn(sb, "DEBUG: inode 25 found in cache, skipping ntfs_read_mft!");
+                dump_stack();
+        }
+
+	/*if (IS_ERR(inode))
+		ntfs_set_state(sb->s_fs_info, NTFS_DIRTY_ERROR);*/
+	if (IS_ERR(inode)) {
+                if (ino == 25)
+                        ntfs_warn(sb, "DEBUG: inode 25 IS_ERR, setting DIRTY_ERROR");
+                ntfs_set_state(sb->s_fs_info, NTFS_DIRTY_ERROR);
+        } else if (ino == 25) {
+                ntfs_warn(sb, "DEBUG: inode 25 returning successfully");
+        }
 
 	return inode;
 }
@@ -1180,6 +1218,8 @@ int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir,
 		      umode_t mode, dev_t dev, const char *symname, u32 size,
 		      struct ntfs_fnd *fnd)
 {
+	printk(KERN_WARNING "GET THE MESSAGE deepanshu \n");
+	//ntfs_warn(sb, "DEBUG: In inodde function");
 	int err;
 	struct super_block *sb = dir->i_sb;
 	struct ntfs_sb_info *sbi = sb->s_fs_info;
@@ -1597,6 +1637,7 @@ int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir,
 		inode->i_size = size;
 		inode_nohighmem(inode);
 	} else if (S_ISREG(mode)) {
+		ntfs_warn(dir->i_sb, "DEBUG: Setting up regular file inode %lu", inode->i_ino);
 		inode->i_op = &ntfs_file_inode_operations;
 		inode->i_fop = unlikely(is_legacy_ntfs(sb)) ?
 				       &ntfs_legacy_file_operations :
@@ -1604,6 +1645,8 @@ int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir,
 		inode->i_mapping->a_ops = is_compressed(ni) ? &ntfs_aops_cmpr :
 							      &ntfs_aops;
 		init_rwsem(&ni->file.run_lock);
+		ntfs_warn(sb, "DEBUG: Created regular file inode %lu, run_lock initialized", 
+              inode->i_ino);
 	} else {
 		inode->i_op = &ntfs_special_inode_operations;
 		init_special_inode(inode, mode, dev);
-- 
2.43.0


  parent reply	other threads:[~2025-10-14 10:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-13 21:58 [syzbot] [ntfs3?] INFO: trying to register non-static key in ntfs_setattr syzbot
2025-10-14  6:41 ` Forwarded: [PATCH] ntfs3: initialize run_lock for MFT inode in ntfs_read_mft syzbot
2025-10-14  7:38 ` Forwarded: [PATCH] ntfs3: prevent MFT inode resize operations syzbot
2025-10-14  9:06 ` Forwarded: [PATCH] ntfs3: add debug warnings for run_lock initialization syzbot
2025-10-14  9:43 ` syzbot
2025-10-14 10:09 ` syzbot [this message]
2025-10-14 11:02 ` syzbot
2025-10-14 11:49 ` syzbot
2025-10-16 17:58   ` Dan Carpenter
2025-10-14 12:53 ` Forwarded: [PATCH] ntfs3: initialize run_lock for $Extend inode records syzbot
2025-10-14 13:25 ` Forwarded: [PATCH] ntfs3: prevent operations on NTFS system files syzbot
2026-01-02  4:59 ` [syzbot] [ntfs3?] INFO: trying to register non-static key in ntfs_setattr syzbot
2026-01-02  5:17   ` Tetsuo Handa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=68ee2167.050a0220.ac43.00f1.GAE@google.com \
    --to=syzbot+3e58a7dc1a8c00243999@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox