diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2014-07-28 13:06:26 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2014-07-28 13:06:26 -0400 |
commit | 40b163f1c45f52752677e66d2fd273dbfd273a22 (patch) | |
tree | 9047b84d0ab4086388c351d2f49e3ed1fba576d0 /fs/ext4/inline.c | |
parent | 6e2631463f3a2ce430a295c68aead3ff228ca3cf (diff) |
ext4: check inline directory before converting
Before converting an inline directory to a regular directory, check
the directory entries to make sure they're not obviously broken.
This helps us to avoid a BUG_ON if one of the dirents is trashed.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Diffstat (limited to 'fs/ext4/inline.c')
-rw-r--r-- | fs/ext4/inline.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index 141b6acbc51c..bea662bd0ca6 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c | |||
@@ -1172,6 +1172,18 @@ static int ext4_convert_inline_data_nolock(handle_t *handle, | |||
1172 | if (error < 0) | 1172 | if (error < 0) |
1173 | goto out; | 1173 | goto out; |
1174 | 1174 | ||
1175 | /* | ||
1176 | * Make sure the inline directory entries pass checks before we try to | ||
1177 | * convert them, so that we avoid touching stuff that needs fsck. | ||
1178 | */ | ||
1179 | if (S_ISDIR(inode->i_mode)) { | ||
1180 | error = ext4_check_all_de(inode, iloc->bh, | ||
1181 | buf + EXT4_INLINE_DOTDOT_SIZE, | ||
1182 | inline_size - EXT4_INLINE_DOTDOT_SIZE); | ||
1183 | if (error) | ||
1184 | goto out; | ||
1185 | } | ||
1186 | |||
1175 | error = ext4_destroy_inline_data_nolock(handle, inode); | 1187 | error = ext4_destroy_inline_data_nolock(handle, inode); |
1176 | if (error) | 1188 | if (error) |
1177 | goto out; | 1189 | goto out; |