diff options
Diffstat (limited to 'fs/ext4/inline.c')
-rw-r--r-- | fs/ext4/inline.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index e55a8bc870bd..3543fe80a3c4 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c | |||
@@ -682,6 +682,10 @@ int ext4_try_to_write_inline_data(struct address_space *mapping, | |||
682 | goto convert; | 682 | goto convert; |
683 | } | 683 | } |
684 | 684 | ||
685 | ret = ext4_journal_get_write_access(handle, iloc.bh); | ||
686 | if (ret) | ||
687 | goto out; | ||
688 | |||
685 | flags |= AOP_FLAG_NOFS; | 689 | flags |= AOP_FLAG_NOFS; |
686 | 690 | ||
687 | page = grab_cache_page_write_begin(mapping, 0, flags); | 691 | page = grab_cache_page_write_begin(mapping, 0, flags); |
@@ -710,7 +714,7 @@ int ext4_try_to_write_inline_data(struct address_space *mapping, | |||
710 | out_up_read: | 714 | out_up_read: |
711 | up_read(&EXT4_I(inode)->xattr_sem); | 715 | up_read(&EXT4_I(inode)->xattr_sem); |
712 | out: | 716 | out: |
713 | if (handle) | 717 | if (handle && (ret != 1)) |
714 | ext4_journal_stop(handle); | 718 | ext4_journal_stop(handle); |
715 | brelse(iloc.bh); | 719 | brelse(iloc.bh); |
716 | return ret; | 720 | return ret; |
@@ -752,6 +756,7 @@ int ext4_write_inline_data_end(struct inode *inode, loff_t pos, unsigned len, | |||
752 | 756 | ||
753 | ext4_write_unlock_xattr(inode, &no_expand); | 757 | ext4_write_unlock_xattr(inode, &no_expand); |
754 | brelse(iloc.bh); | 758 | brelse(iloc.bh); |
759 | mark_inode_dirty(inode); | ||
755 | out: | 760 | out: |
756 | return copied; | 761 | return copied; |
757 | } | 762 | } |
@@ -898,7 +903,6 @@ retry_journal: | |||
898 | goto out; | 903 | goto out; |
899 | } | 904 | } |
900 | 905 | ||
901 | |||
902 | page = grab_cache_page_write_begin(mapping, 0, flags); | 906 | page = grab_cache_page_write_begin(mapping, 0, flags); |
903 | if (!page) { | 907 | if (!page) { |
904 | ret = -ENOMEM; | 908 | ret = -ENOMEM; |
@@ -916,6 +920,9 @@ retry_journal: | |||
916 | if (ret < 0) | 920 | if (ret < 0) |
917 | goto out_release_page; | 921 | goto out_release_page; |
918 | } | 922 | } |
923 | ret = ext4_journal_get_write_access(handle, iloc.bh); | ||
924 | if (ret) | ||
925 | goto out_release_page; | ||
919 | 926 | ||
920 | up_read(&EXT4_I(inode)->xattr_sem); | 927 | up_read(&EXT4_I(inode)->xattr_sem); |
921 | *pagep = page; | 928 | *pagep = page; |
@@ -936,7 +943,6 @@ int ext4_da_write_inline_data_end(struct inode *inode, loff_t pos, | |||
936 | unsigned len, unsigned copied, | 943 | unsigned len, unsigned copied, |
937 | struct page *page) | 944 | struct page *page) |
938 | { | 945 | { |
939 | int i_size_changed = 0; | ||
940 | int ret; | 946 | int ret; |
941 | 947 | ||
942 | ret = ext4_write_inline_data_end(inode, pos, len, copied, page); | 948 | ret = ext4_write_inline_data_end(inode, pos, len, copied, page); |
@@ -954,10 +960,8 @@ int ext4_da_write_inline_data_end(struct inode *inode, loff_t pos, | |||
954 | * But it's important to update i_size while still holding page lock: | 960 | * But it's important to update i_size while still holding page lock: |
955 | * page writeout could otherwise come in and zero beyond i_size. | 961 | * page writeout could otherwise come in and zero beyond i_size. |
956 | */ | 962 | */ |
957 | if (pos+copied > inode->i_size) { | 963 | if (pos+copied > inode->i_size) |
958 | i_size_write(inode, pos+copied); | 964 | i_size_write(inode, pos+copied); |
959 | i_size_changed = 1; | ||
960 | } | ||
961 | unlock_page(page); | 965 | unlock_page(page); |
962 | put_page(page); | 966 | put_page(page); |
963 | 967 | ||
@@ -967,8 +971,7 @@ int ext4_da_write_inline_data_end(struct inode *inode, loff_t pos, | |||
967 | * ordering of page lock and transaction start for journaling | 971 | * ordering of page lock and transaction start for journaling |
968 | * filesystems. | 972 | * filesystems. |
969 | */ | 973 | */ |
970 | if (i_size_changed) | 974 | mark_inode_dirty(inode); |
971 | mark_inode_dirty(inode); | ||
972 | 975 | ||
973 | return copied; | 976 | return copied; |
974 | } | 977 | } |