diff options
Diffstat (limited to 'fs/ext4/xattr.c')
-rw-r--r-- | fs/ext4/xattr.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index fed5b01d7a8d..910bf9a59cb3 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c | |||
@@ -482,9 +482,10 @@ ext4_xattr_release_block(handle_t *handle, struct inode *inode, | |||
482 | ea_bdebug(bh, "refcount now=0; freeing"); | 482 | ea_bdebug(bh, "refcount now=0; freeing"); |
483 | if (ce) | 483 | if (ce) |
484 | mb_cache_entry_free(ce); | 484 | mb_cache_entry_free(ce); |
485 | ext4_free_blocks(handle, inode, bh->b_blocknr, 1, 1); | ||
486 | get_bh(bh); | 485 | get_bh(bh); |
487 | ext4_forget(handle, 1, inode, bh, bh->b_blocknr); | 486 | ext4_free_blocks(handle, inode, bh, 0, 1, |
487 | EXT4_FREE_BLOCKS_METADATA | | ||
488 | EXT4_FREE_BLOCKS_FORGET); | ||
488 | } else { | 489 | } else { |
489 | le32_add_cpu(&BHDR(bh)->h_refcount, -1); | 490 | le32_add_cpu(&BHDR(bh)->h_refcount, -1); |
490 | error = ext4_handle_dirty_metadata(handle, inode, bh); | 491 | error = ext4_handle_dirty_metadata(handle, inode, bh); |
@@ -832,7 +833,8 @@ inserted: | |||
832 | new_bh = sb_getblk(sb, block); | 833 | new_bh = sb_getblk(sb, block); |
833 | if (!new_bh) { | 834 | if (!new_bh) { |
834 | getblk_failed: | 835 | getblk_failed: |
835 | ext4_free_blocks(handle, inode, block, 1, 1); | 836 | ext4_free_blocks(handle, inode, 0, block, 1, |
837 | EXT4_FREE_BLOCKS_METADATA); | ||
836 | error = -EIO; | 838 | error = -EIO; |
837 | goto cleanup; | 839 | goto cleanup; |
838 | } | 840 | } |
@@ -988,6 +990,10 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index, | |||
988 | if (error) | 990 | if (error) |
989 | goto cleanup; | 991 | goto cleanup; |
990 | 992 | ||
993 | error = ext4_journal_get_write_access(handle, is.iloc.bh); | ||
994 | if (error) | ||
995 | goto cleanup; | ||
996 | |||
991 | if (EXT4_I(inode)->i_state & EXT4_STATE_NEW) { | 997 | if (EXT4_I(inode)->i_state & EXT4_STATE_NEW) { |
992 | struct ext4_inode *raw_inode = ext4_raw_inode(&is.iloc); | 998 | struct ext4_inode *raw_inode = ext4_raw_inode(&is.iloc); |
993 | memset(raw_inode, 0, EXT4_SB(inode->i_sb)->s_inode_size); | 999 | memset(raw_inode, 0, EXT4_SB(inode->i_sb)->s_inode_size); |
@@ -1013,9 +1019,6 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index, | |||
1013 | if (flags & XATTR_CREATE) | 1019 | if (flags & XATTR_CREATE) |
1014 | goto cleanup; | 1020 | goto cleanup; |
1015 | } | 1021 | } |
1016 | error = ext4_journal_get_write_access(handle, is.iloc.bh); | ||
1017 | if (error) | ||
1018 | goto cleanup; | ||
1019 | if (!value) { | 1022 | if (!value) { |
1020 | if (!is.s.not_found) | 1023 | if (!is.s.not_found) |
1021 | error = ext4_xattr_ibody_set(handle, inode, &i, &is); | 1024 | error = ext4_xattr_ibody_set(handle, inode, &i, &is); |