diff options
Diffstat (limited to 'fs/ext2/xattr.c')
-rw-r--r-- | fs/ext2/xattr.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c index 7c3915780b19..8c29ae15129e 100644 --- a/fs/ext2/xattr.c +++ b/fs/ext2/xattr.c | |||
@@ -674,6 +674,7 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh, | |||
674 | new_bh = sb_getblk(sb, block); | 674 | new_bh = sb_getblk(sb, block); |
675 | if (!new_bh) { | 675 | if (!new_bh) { |
676 | ext2_free_blocks(inode, block, 1); | 676 | ext2_free_blocks(inode, block, 1); |
677 | mark_inode_dirty(inode); | ||
677 | error = -EIO; | 678 | error = -EIO; |
678 | goto cleanup; | 679 | goto cleanup; |
679 | } | 680 | } |
@@ -703,8 +704,10 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh, | |||
703 | * written (only some dirty data were not) so we just proceed | 704 | * written (only some dirty data were not) so we just proceed |
704 | * as if nothing happened and cleanup the unused block */ | 705 | * as if nothing happened and cleanup the unused block */ |
705 | if (error && error != -ENOSPC) { | 706 | if (error && error != -ENOSPC) { |
706 | if (new_bh && new_bh != old_bh) | 707 | if (new_bh && new_bh != old_bh) { |
707 | dquot_free_block(inode, 1); | 708 | dquot_free_block_nodirty(inode, 1); |
709 | mark_inode_dirty(inode); | ||
710 | } | ||
708 | goto cleanup; | 711 | goto cleanup; |
709 | } | 712 | } |
710 | } else | 713 | } else |
@@ -727,6 +730,7 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh, | |||
727 | mb_cache_entry_free(ce); | 730 | mb_cache_entry_free(ce); |
728 | ea_bdebug(old_bh, "freeing"); | 731 | ea_bdebug(old_bh, "freeing"); |
729 | ext2_free_blocks(inode, old_bh->b_blocknr, 1); | 732 | ext2_free_blocks(inode, old_bh->b_blocknr, 1); |
733 | mark_inode_dirty(inode); | ||
730 | /* We let our caller release old_bh, so we | 734 | /* We let our caller release old_bh, so we |
731 | * need to duplicate the buffer before. */ | 735 | * need to duplicate the buffer before. */ |
732 | get_bh(old_bh); | 736 | get_bh(old_bh); |
@@ -736,7 +740,8 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh, | |||
736 | le32_add_cpu(&HDR(old_bh)->h_refcount, -1); | 740 | le32_add_cpu(&HDR(old_bh)->h_refcount, -1); |
737 | if (ce) | 741 | if (ce) |
738 | mb_cache_entry_release(ce); | 742 | mb_cache_entry_release(ce); |
739 | dquot_free_block(inode, 1); | 743 | dquot_free_block_nodirty(inode, 1); |
744 | mark_inode_dirty(inode); | ||
740 | mark_buffer_dirty(old_bh); | 745 | mark_buffer_dirty(old_bh); |
741 | ea_bdebug(old_bh, "refcount now=%d", | 746 | ea_bdebug(old_bh, "refcount now=%d", |
742 | le32_to_cpu(HDR(old_bh)->h_refcount)); | 747 | le32_to_cpu(HDR(old_bh)->h_refcount)); |
@@ -799,7 +804,7 @@ ext2_xattr_delete_inode(struct inode *inode) | |||
799 | mark_buffer_dirty(bh); | 804 | mark_buffer_dirty(bh); |
800 | if (IS_SYNC(inode)) | 805 | if (IS_SYNC(inode)) |
801 | sync_dirty_buffer(bh); | 806 | sync_dirty_buffer(bh); |
802 | dquot_free_block(inode, 1); | 807 | dquot_free_block_nodirty(inode, 1); |
803 | } | 808 | } |
804 | EXT2_I(inode)->i_file_acl = 0; | 809 | EXT2_I(inode)->i_file_acl = 0; |
805 | 810 | ||
@@ -838,7 +843,7 @@ ext2_xattr_cache_insert(struct buffer_head *bh) | |||
838 | ce = mb_cache_entry_alloc(ext2_xattr_cache, GFP_NOFS); | 843 | ce = mb_cache_entry_alloc(ext2_xattr_cache, GFP_NOFS); |
839 | if (!ce) | 844 | if (!ce) |
840 | return -ENOMEM; | 845 | return -ENOMEM; |
841 | error = mb_cache_entry_insert(ce, bh->b_bdev, bh->b_blocknr, &hash); | 846 | error = mb_cache_entry_insert(ce, bh->b_bdev, bh->b_blocknr, hash); |
842 | if (error) { | 847 | if (error) { |
843 | mb_cache_entry_free(ce); | 848 | mb_cache_entry_free(ce); |
844 | if (error == -EBUSY) { | 849 | if (error == -EBUSY) { |
@@ -912,8 +917,8 @@ ext2_xattr_cache_find(struct inode *inode, struct ext2_xattr_header *header) | |||
912 | return NULL; /* never share */ | 917 | return NULL; /* never share */ |
913 | ea_idebug(inode, "looking for cached blocks [%x]", (int)hash); | 918 | ea_idebug(inode, "looking for cached blocks [%x]", (int)hash); |
914 | again: | 919 | again: |
915 | ce = mb_cache_entry_find_first(ext2_xattr_cache, 0, | 920 | ce = mb_cache_entry_find_first(ext2_xattr_cache, inode->i_sb->s_bdev, |
916 | inode->i_sb->s_bdev, hash); | 921 | hash); |
917 | while (ce) { | 922 | while (ce) { |
918 | struct buffer_head *bh; | 923 | struct buffer_head *bh; |
919 | 924 | ||
@@ -945,7 +950,7 @@ again: | |||
945 | unlock_buffer(bh); | 950 | unlock_buffer(bh); |
946 | brelse(bh); | 951 | brelse(bh); |
947 | } | 952 | } |
948 | ce = mb_cache_entry_find_next(ce, 0, inode->i_sb->s_bdev, hash); | 953 | ce = mb_cache_entry_find_next(ce, inode->i_sb->s_bdev, hash); |
949 | } | 954 | } |
950 | return NULL; | 955 | return NULL; |
951 | } | 956 | } |
@@ -1021,9 +1026,7 @@ static void ext2_xattr_rehash(struct ext2_xattr_header *header, | |||
1021 | int __init | 1026 | int __init |
1022 | init_ext2_xattr(void) | 1027 | init_ext2_xattr(void) |
1023 | { | 1028 | { |
1024 | ext2_xattr_cache = mb_cache_create("ext2_xattr", NULL, | 1029 | ext2_xattr_cache = mb_cache_create("ext2_xattr", 6); |
1025 | sizeof(struct mb_cache_entry) + | ||
1026 | sizeof(((struct mb_cache_entry *) 0)->e_indexes[0]), 1, 6); | ||
1027 | if (!ext2_xattr_cache) | 1030 | if (!ext2_xattr_cache) |
1028 | return -ENOMEM; | 1031 | return -ENOMEM; |
1029 | return 0; | 1032 | return 0; |