Skip to content

Commit d2db60d

Browse files
Eric Sandeentorvalds
Eric Sandeen
authored andcommitted
ext3: Properly count journal credits for long symlinks
Commit ae54870 ("ext3: Fix lock inversion in ext3_symlink()") recalculated the number of credits needed for a long symlink, in the process of splitting it into two transactions. However, the first credit calculation under-counted because if selinux is enabled, credits are needed to create the selinux xattr as well. Overrunning the reservation will result in an OOPS in journal_dirty_metadata() due to this assert: J_ASSERT_JH(jh, handle->h_buffer_credits > 0); Fix this by increasing the reservation size. Signed-off-by: Eric Sandeen <[email protected]> Reviewed-by: Jan Kara <[email protected]> Acked-by: "Theodore Ts'o" <[email protected]> Cc: [email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent 72fa599 commit d2db60d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fs/ext3/namei.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -2209,9 +2209,11 @@ static int ext3_symlink (struct inode * dir,
22092209
/*
22102210
* For non-fast symlinks, we just allocate inode and put it on
22112211
* orphan list in the first transaction => we need bitmap,
2212-
* group descriptor, sb, inode block, quota blocks.
2212+
* group descriptor, sb, inode block, quota blocks, and
2213+
* possibly selinux xattr blocks.
22132214
*/
2214-
credits = 4 + EXT3_MAXQUOTAS_INIT_BLOCKS(dir->i_sb);
2215+
credits = 4 + EXT3_MAXQUOTAS_INIT_BLOCKS(dir->i_sb) +
2216+
EXT3_XATTR_TRANS_BLOCKS;
22152217
} else {
22162218
/*
22172219
* Fast symlink. We have to add entry to directory

0 commit comments

Comments
 (0)