diff options
author | Namhyung Kim <namhyung@gmail.com> | 2010-11-22 23:30:33 -0500 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2011-01-06 05:52:16 -0500 |
commit | ad1857a0e0cb29313efae3bb69c913b2c3c833a1 (patch) | |
tree | 2ae552ebb0cd91cfe4751eb6ab91486f96237f51 /fs/ext3 | |
parent | 5026e90b86684bc878e4db0a8cd043fed769719c (diff) |
ext3: Add journal error check into ext3_rename()
Check return value of ext3_journal_get_write_access() and
ext3_journal_dirty_metadata().
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext3')
-rw-r--r-- | fs/ext3/namei.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c index 9cc0b2c9664f..e69eed547242 100644 --- a/fs/ext3/namei.c +++ b/fs/ext3/namei.c | |||
@@ -2362,7 +2362,9 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry, | |||
2362 | goto end_rename; | 2362 | goto end_rename; |
2363 | } else { | 2363 | } else { |
2364 | BUFFER_TRACE(new_bh, "get write access"); | 2364 | BUFFER_TRACE(new_bh, "get write access"); |
2365 | ext3_journal_get_write_access(handle, new_bh); | 2365 | retval = ext3_journal_get_write_access(handle, new_bh); |
2366 | if (retval) | ||
2367 | goto journal_error; | ||
2366 | new_de->inode = cpu_to_le32(old_inode->i_ino); | 2368 | new_de->inode = cpu_to_le32(old_inode->i_ino); |
2367 | if (EXT3_HAS_INCOMPAT_FEATURE(new_dir->i_sb, | 2369 | if (EXT3_HAS_INCOMPAT_FEATURE(new_dir->i_sb, |
2368 | EXT3_FEATURE_INCOMPAT_FILETYPE)) | 2370 | EXT3_FEATURE_INCOMPAT_FILETYPE)) |
@@ -2371,7 +2373,9 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry, | |||
2371 | new_dir->i_ctime = new_dir->i_mtime = CURRENT_TIME_SEC; | 2373 | new_dir->i_ctime = new_dir->i_mtime = CURRENT_TIME_SEC; |
2372 | ext3_mark_inode_dirty(handle, new_dir); | 2374 | ext3_mark_inode_dirty(handle, new_dir); |
2373 | BUFFER_TRACE(new_bh, "call ext3_journal_dirty_metadata"); | 2375 | BUFFER_TRACE(new_bh, "call ext3_journal_dirty_metadata"); |
2374 | ext3_journal_dirty_metadata(handle, new_bh); | 2376 | retval = ext3_journal_dirty_metadata(handle, new_bh); |
2377 | if (retval) | ||
2378 | goto journal_error; | ||
2375 | brelse(new_bh); | 2379 | brelse(new_bh); |
2376 | new_bh = NULL; | 2380 | new_bh = NULL; |
2377 | } | 2381 | } |
@@ -2420,10 +2424,17 @@ static int ext3_rename (struct inode * old_dir, struct dentry *old_dentry, | |||
2420 | ext3_update_dx_flag(old_dir); | 2424 | ext3_update_dx_flag(old_dir); |
2421 | if (dir_bh) { | 2425 | if (dir_bh) { |
2422 | BUFFER_TRACE(dir_bh, "get_write_access"); | 2426 | BUFFER_TRACE(dir_bh, "get_write_access"); |
2423 | ext3_journal_get_write_access(handle, dir_bh); | 2427 | retval = ext3_journal_get_write_access(handle, dir_bh); |
2428 | if (retval) | ||
2429 | goto journal_error; | ||
2424 | PARENT_INO(dir_bh->b_data) = cpu_to_le32(new_dir->i_ino); | 2430 | PARENT_INO(dir_bh->b_data) = cpu_to_le32(new_dir->i_ino); |
2425 | BUFFER_TRACE(dir_bh, "call ext3_journal_dirty_metadata"); | 2431 | BUFFER_TRACE(dir_bh, "call ext3_journal_dirty_metadata"); |
2426 | ext3_journal_dirty_metadata(handle, dir_bh); | 2432 | retval = ext3_journal_dirty_metadata(handle, dir_bh); |
2433 | if (retval) { | ||
2434 | journal_error: | ||
2435 | ext3_std_error(new_dir->i_sb, retval); | ||
2436 | goto end_rename; | ||
2437 | } | ||
2427 | drop_nlink(old_dir); | 2438 | drop_nlink(old_dir); |
2428 | if (new_inode) { | 2439 | if (new_inode) { |
2429 | drop_nlink(new_inode); | 2440 | drop_nlink(new_inode); |