public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Theodore Ts'o <tytso@mit.edu>
Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org
Subject: why does ext4_sync_parent() bother with d_find_any_alias() at all?
Date: Sun, 26 Apr 2026 07:10:09 +0100	[thread overview]
Message-ID: <20260426061009.GQ3518998@ZenIV> (raw)

	The caller has a dentry for that inode, after all...
Am I missing something there?  IOW, is there anything wrong
with something like (untested) patch below?

diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
index 924726dcc85f..c635cd732c2e 100644
--- a/fs/ext4/fsync.c
+++ b/fs/ext4/fsync.c
@@ -43,16 +43,14 @@
  * the parent directory's parent as well, and so on recursively, if
  * they are also freshly created.
  */
-static int ext4_sync_parent(struct inode *inode)
+static int ext4_sync_parent(struct inode *inode, struct dentry *dentry)
 {
-	struct dentry *dentry, *next;
+	struct dentry *next;
 	int ret = 0;
 
 	if (!ext4_test_inode_state(inode, EXT4_STATE_NEWENTRY))
 		return 0;
-	dentry = d_find_any_alias(inode);
-	if (!dentry)
-		return 0;
+	dget(dentry);
 	while (ext4_test_inode_state(inode, EXT4_STATE_NEWENTRY)) {
 		ext4_clear_inode_state(inode, EXT4_STATE_NEWENTRY);
 
@@ -99,7 +97,7 @@ static int ext4_fsync_nojournal(struct file *file, loff_t start, loff_t end,
 	if (ret)
 		return ret;
 
-	ret = ext4_sync_parent(inode);
+	ret = ext4_sync_parent(inode, file->f_path.dentry);
 
 	if (test_opt(inode->i_sb, BARRIER))
 		*needs_barrier = true;

                 reply	other threads:[~2026-04-26  6:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260426061009.GQ3518998@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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