public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* why does ext4_sync_parent() bother with d_find_any_alias() at all?
@ 2026-04-26  6:10 Al Viro
  0 siblings, 0 replies; only message in thread
From: Al Viro @ 2026-04-26  6:10 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: linux-fsdevel, linux-ext4

	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;

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-04-26  6:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-26  6:10 why does ext4_sync_parent() bother with d_find_any_alias() at all? Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox