Skip to content

Commit 5930ea6

Browse files
committed
ext4: call ext4_handle_dirty_metadata with correct inode in ext4_dx_add_entry
ext4_dx_add_entry manipulates bh2 and frames[0].bh, which are two buffer_heads that point to directory blocks assigned to the directory inode. However, the function calls ext4_handle_dirty_metadata with the inode of the file that's being added to the directory, not the directory inode itself. Therefore, correct the code to dirty the directory buffers with the directory inode, not the file inode. Signed-off-by: Darrick J. Wong <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]> Cc: [email protected]
1 parent f9287c1 commit 5930ea6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/ext4/namei.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,7 +1585,7 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
15851585
dxtrace(dx_show_index("node", frames[1].entries));
15861586
dxtrace(dx_show_index("node",
15871587
((struct dx_node *) bh2->b_data)->entries));
1588-
err = ext4_handle_dirty_metadata(handle, inode, bh2);
1588+
err = ext4_handle_dirty_metadata(handle, dir, bh2);
15891589
if (err)
15901590
goto journal_error;
15911591
brelse (bh2);
@@ -1611,7 +1611,7 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
16111611
if (err)
16121612
goto journal_error;
16131613
}
1614-
err = ext4_handle_dirty_metadata(handle, inode, frames[0].bh);
1614+
err = ext4_handle_dirty_metadata(handle, dir, frames[0].bh);
16151615
if (err) {
16161616
ext4_std_error(inode->i_sb, err);
16171617
goto cleanup;

0 commit comments

Comments
 (0)