diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/block_dev.c | 3 | ||||
-rw-r--r-- | fs/btrfs/ctree.h | 2 | ||||
-rw-r--r-- | fs/btrfs/disk-io.c | 43 | ||||
-rw-r--r-- | fs/btrfs/extent-tree.c | 18 | ||||
-rw-r--r-- | fs/btrfs/super.c | 1 | ||||
-rw-r--r-- | fs/btrfs/tree-log.c | 2 | ||||
-rw-r--r-- | fs/buffer.c | 38 | ||||
-rw-r--r-- | fs/ext3/super.c | 7 | ||||
-rw-r--r-- | fs/ext4/extents.c | 9 | ||||
-rw-r--r-- | fs/ext4/file.c | 2 | ||||
-rw-r--r-- | fs/ext4/ialloc.c | 4 | ||||
-rw-r--r-- | fs/ext4/inode.c | 7 | ||||
-rw-r--r-- | fs/ext4/namei.c | 28 | ||||
-rw-r--r-- | fs/ext4/resize.c | 2 | ||||
-rw-r--r-- | fs/ext4/super.c | 17 | ||||
-rw-r--r-- | fs/isofs/inode.c | 24 | ||||
-rw-r--r-- | fs/isofs/namei.c | 22 | ||||
-rw-r--r-- | fs/jbd/revoke.c | 7 | ||||
-rw-r--r-- | fs/jbd2/revoke.c | 10 | ||||
-rw-r--r-- | fs/namei.c | 5 | ||||
-rw-r--r-- | fs/nfsd/nfs4proc.c | 7 | ||||
-rw-r--r-- | fs/notify/inode_mark.c | 17 | ||||
-rw-r--r-- | fs/ocfs2/namei.c | 2 | ||||
-rw-r--r-- | fs/overlayfs/readdir.c | 17 | ||||
-rw-r--r-- | fs/quota/dquot.c | 2 |
25 files changed, 128 insertions, 168 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index cc9d4114cda0..1d9c9f3754f8 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -1585,7 +1585,7 @@ ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
1585 | } | 1585 | } |
1586 | EXPORT_SYMBOL_GPL(blkdev_write_iter); | 1586 | EXPORT_SYMBOL_GPL(blkdev_write_iter); |
1587 | 1587 | ||
1588 | static ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to) | 1588 | ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to) |
1589 | { | 1589 | { |
1590 | struct file *file = iocb->ki_filp; | 1590 | struct file *file = iocb->ki_filp; |
1591 | struct inode *bd_inode = file->f_mapping->host; | 1591 | struct inode *bd_inode = file->f_mapping->host; |
@@ -1599,6 +1599,7 @@ static ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to) | |||
1599 | iov_iter_truncate(to, size); | 1599 | iov_iter_truncate(to, size); |
1600 | return generic_file_read_iter(iocb, to); | 1600 | return generic_file_read_iter(iocb, to); |
1601 | } | 1601 | } |
1602 | EXPORT_SYMBOL_GPL(blkdev_read_iter); | ||
1602 | 1603 | ||
1603 | /* | 1604 | /* |
1604 | * Try to release a page associated with block device when the system | 1605 | * Try to release a page associated with block device when the system |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index d557264ee974..fe69edda11fb 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -3276,7 +3276,7 @@ int btrfs_run_delayed_refs(struct btrfs_trans_handle *trans, | |||
3276 | struct btrfs_root *root, unsigned long count); | 3276 | struct btrfs_root *root, unsigned long count); |
3277 | int btrfs_async_run_delayed_refs(struct btrfs_root *root, | 3277 | int btrfs_async_run_delayed_refs(struct btrfs_root *root, |
3278 | unsigned long count, int wait); | 3278 | unsigned long count, int wait); |
3279 | int btrfs_lookup_extent(struct btrfs_root *root, u64 start, u64 len); | 3279 | int btrfs_lookup_data_extent(struct btrfs_root *root, u64 start, u64 len); |
3280 | int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans, | 3280 | int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans, |
3281 | struct btrfs_root *root, u64 bytenr, | 3281 | struct btrfs_root *root, u64 bytenr, |
3282 | u64 offset, int metadata, u64 *refs, u64 *flags); | 3282 | u64 offset, int metadata, u64 *refs, u64 *flags); |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 1ad0f47ac850..1bf9f897065d 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -3817,19 +3817,19 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info, | |||
3817 | struct btrfs_super_block *sb = fs_info->super_copy; | 3817 | struct btrfs_super_block *sb = fs_info->super_copy; |
3818 | int ret = 0; | 3818 | int ret = 0; |
3819 | 3819 | ||
3820 | if (sb->root_level > BTRFS_MAX_LEVEL) { | 3820 | if (btrfs_super_root_level(sb) >= BTRFS_MAX_LEVEL) { |
3821 | printk(KERN_ERR "BTRFS: tree_root level too big: %d > %d\n", | 3821 | printk(KERN_ERR "BTRFS: tree_root level too big: %d >= %d\n", |
3822 | sb->root_level, BTRFS_MAX_LEVEL); | 3822 | btrfs_super_root_level(sb), BTRFS_MAX_LEVEL); |
3823 | ret = -EINVAL; | 3823 | ret = -EINVAL; |
3824 | } | 3824 | } |
3825 | if (sb->chunk_root_level > BTRFS_MAX_LEVEL) { | 3825 | if (btrfs_super_chunk_root_level(sb) >= BTRFS_MAX_LEVEL) { |
3826 | printk(KERN_ERR "BTRFS: chunk_root level too big: %d > %d\n", | 3826 | printk(KERN_ERR "BTRFS: chunk_root level too big: %d >= %d\n", |
3827 | sb->chunk_root_level, BTRFS_MAX_LEVEL); | 3827 | btrfs_super_chunk_root_level(sb), BTRFS_MAX_LEVEL); |
3828 | ret = -EINVAL; | 3828 | ret = -EINVAL; |
3829 | } | 3829 | } |
3830 | if (sb->log_root_level > BTRFS_MAX_LEVEL) { | 3830 | if (btrfs_super_log_root_level(sb) >= BTRFS_MAX_LEVEL) { |
3831 | printk(KERN_ERR "BTRFS: log_root level too big: %d > %d\n", | 3831 | printk(KERN_ERR "BTRFS: log_root level too big: %d >= %d\n", |
3832 | sb->log_root_level, BTRFS_MAX_LEVEL); | 3832 | btrfs_super_log_root_level(sb), BTRFS_MAX_LEVEL); |
3833 | ret = -EINVAL; | 3833 | ret = -EINVAL; |
3834 | } | 3834 | } |
3835 | 3835 | ||
@@ -3837,15 +3837,15 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info, | |||
3837 | * The common minimum, we don't know if we can trust the nodesize/sectorsize | 3837 | * The common minimum, we don't know if we can trust the nodesize/sectorsize |
3838 | * items yet, they'll be verified later. Issue just a warning. | 3838 | * items yet, they'll be verified later. Issue just a warning. |
3839 | */ | 3839 | */ |
3840 | if (!IS_ALIGNED(sb->root, 4096)) | 3840 | if (!IS_ALIGNED(btrfs_super_root(sb), 4096)) |
3841 | printk(KERN_WARNING "BTRFS: tree_root block unaligned: %llu\n", | 3841 | printk(KERN_WARNING "BTRFS: tree_root block unaligned: %llu\n", |
3842 | sb->root); | 3842 | sb->root); |
3843 | if (!IS_ALIGNED(sb->chunk_root, 4096)) | 3843 | if (!IS_ALIGNED(btrfs_super_chunk_root(sb), 4096)) |
3844 | printk(KERN_WARNING "BTRFS: tree_root block unaligned: %llu\n", | 3844 | printk(KERN_WARNING "BTRFS: tree_root block unaligned: %llu\n", |
3845 | sb->chunk_root); | 3845 | sb->chunk_root); |
3846 | if (!IS_ALIGNED(sb->log_root, 4096)) | 3846 | if (!IS_ALIGNED(btrfs_super_log_root(sb), 4096)) |
3847 | printk(KERN_WARNING "BTRFS: tree_root block unaligned: %llu\n", | 3847 | printk(KERN_WARNING "BTRFS: tree_root block unaligned: %llu\n", |
3848 | sb->log_root); | 3848 | btrfs_super_log_root(sb)); |
3849 | 3849 | ||
3850 | if (memcmp(fs_info->fsid, sb->dev_item.fsid, BTRFS_UUID_SIZE) != 0) { | 3850 | if (memcmp(fs_info->fsid, sb->dev_item.fsid, BTRFS_UUID_SIZE) != 0) { |
3851 | printk(KERN_ERR "BTRFS: dev_item UUID does not match fsid: %pU != %pU\n", | 3851 | printk(KERN_ERR "BTRFS: dev_item UUID does not match fsid: %pU != %pU\n", |
@@ -3857,13 +3857,13 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info, | |||
3857 | * Hint to catch really bogus numbers, bitflips or so, more exact checks are | 3857 | * Hint to catch really bogus numbers, bitflips or so, more exact checks are |
3858 | * done later | 3858 | * done later |
3859 | */ | 3859 | */ |
3860 | if (sb->num_devices > (1UL << 31)) | 3860 | if (btrfs_super_num_devices(sb) > (1UL << 31)) |
3861 | printk(KERN_WARNING "BTRFS: suspicious number of devices: %llu\n", | 3861 | printk(KERN_WARNING "BTRFS: suspicious number of devices: %llu\n", |
3862 | sb->num_devices); | 3862 | btrfs_super_num_devices(sb)); |
3863 | 3863 | ||
3864 | if (sb->bytenr != BTRFS_SUPER_INFO_OFFSET) { | 3864 | if (btrfs_super_bytenr(sb) != BTRFS_SUPER_INFO_OFFSET) { |
3865 | printk(KERN_ERR "BTRFS: super offset mismatch %llu != %u\n", | 3865 | printk(KERN_ERR "BTRFS: super offset mismatch %llu != %u\n", |
3866 | sb->bytenr, BTRFS_SUPER_INFO_OFFSET); | 3866 | btrfs_super_bytenr(sb), BTRFS_SUPER_INFO_OFFSET); |
3867 | ret = -EINVAL; | 3867 | ret = -EINVAL; |
3868 | } | 3868 | } |
3869 | 3869 | ||
@@ -3871,14 +3871,15 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info, | |||
3871 | * The generation is a global counter, we'll trust it more than the others | 3871 | * The generation is a global counter, we'll trust it more than the others |
3872 | * but it's still possible that it's the one that's wrong. | 3872 | * but it's still possible that it's the one that's wrong. |
3873 | */ | 3873 | */ |
3874 | if (sb->generation < sb->chunk_root_generation) | 3874 | if (btrfs_super_generation(sb) < btrfs_super_chunk_root_generation(sb)) |
3875 | printk(KERN_WARNING | 3875 | printk(KERN_WARNING |
3876 | "BTRFS: suspicious: generation < chunk_root_generation: %llu < %llu\n", | 3876 | "BTRFS: suspicious: generation < chunk_root_generation: %llu < %llu\n", |
3877 | sb->generation, sb->chunk_root_generation); | 3877 | btrfs_super_generation(sb), btrfs_super_chunk_root_generation(sb)); |
3878 | if (sb->generation < sb->cache_generation && sb->cache_generation != (u64)-1) | 3878 | if (btrfs_super_generation(sb) < btrfs_super_cache_generation(sb) |
3879 | && btrfs_super_cache_generation(sb) != (u64)-1) | ||
3879 | printk(KERN_WARNING | 3880 | printk(KERN_WARNING |
3880 | "BTRFS: suspicious: generation < cache_generation: %llu < %llu\n", | 3881 | "BTRFS: suspicious: generation < cache_generation: %llu < %llu\n", |
3881 | sb->generation, sb->cache_generation); | 3882 | btrfs_super_generation(sb), btrfs_super_cache_generation(sb)); |
3882 | 3883 | ||
3883 | return ret; | 3884 | return ret; |
3884 | } | 3885 | } |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index d56589571012..47c1ba141082 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -710,8 +710,8 @@ void btrfs_clear_space_info_full(struct btrfs_fs_info *info) | |||
710 | rcu_read_unlock(); | 710 | rcu_read_unlock(); |
711 | } | 711 | } |
712 | 712 | ||
713 | /* simple helper to search for an existing extent at a given offset */ | 713 | /* simple helper to search for an existing data extent at a given offset */ |
714 | int btrfs_lookup_extent(struct btrfs_root *root, u64 start, u64 len) | 714 | int btrfs_lookup_data_extent(struct btrfs_root *root, u64 start, u64 len) |
715 | { | 715 | { |
716 | int ret; | 716 | int ret; |
717 | struct btrfs_key key; | 717 | struct btrfs_key key; |
@@ -726,12 +726,6 @@ int btrfs_lookup_extent(struct btrfs_root *root, u64 start, u64 len) | |||
726 | key.type = BTRFS_EXTENT_ITEM_KEY; | 726 | key.type = BTRFS_EXTENT_ITEM_KEY; |
727 | ret = btrfs_search_slot(NULL, root->fs_info->extent_root, &key, path, | 727 | ret = btrfs_search_slot(NULL, root->fs_info->extent_root, &key, path, |
728 | 0, 0); | 728 | 0, 0); |
729 | if (ret > 0) { | ||
730 | btrfs_item_key_to_cpu(path->nodes[0], &key, path->slots[0]); | ||
731 | if (key.objectid == start && | ||
732 | key.type == BTRFS_METADATA_ITEM_KEY) | ||
733 | ret = 0; | ||
734 | } | ||
735 | btrfs_free_path(path); | 729 | btrfs_free_path(path); |
736 | return ret; | 730 | return ret; |
737 | } | 731 | } |
@@ -786,7 +780,6 @@ search_again: | |||
786 | else | 780 | else |
787 | key.type = BTRFS_EXTENT_ITEM_KEY; | 781 | key.type = BTRFS_EXTENT_ITEM_KEY; |
788 | 782 | ||
789 | again: | ||
790 | ret = btrfs_search_slot(trans, root->fs_info->extent_root, | 783 | ret = btrfs_search_slot(trans, root->fs_info->extent_root, |
791 | &key, path, 0, 0); | 784 | &key, path, 0, 0); |
792 | if (ret < 0) | 785 | if (ret < 0) |
@@ -802,13 +795,6 @@ again: | |||
802 | key.offset == root->nodesize) | 795 | key.offset == root->nodesize) |
803 | ret = 0; | 796 | ret = 0; |
804 | } | 797 | } |
805 | if (ret) { | ||
806 | key.objectid = bytenr; | ||
807 | key.type = BTRFS_EXTENT_ITEM_KEY; | ||
808 | key.offset = root->nodesize; | ||
809 | btrfs_release_path(path); | ||
810 | goto again; | ||
811 | } | ||
812 | } | 798 | } |
813 | 799 | ||
814 | if (ret == 0) { | 800 | if (ret == 0) { |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index a2b97ef10317..54bd91ece35b 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -2151,6 +2151,7 @@ static void __exit exit_btrfs_fs(void) | |||
2151 | extent_map_exit(); | 2151 | extent_map_exit(); |
2152 | extent_io_exit(); | 2152 | extent_io_exit(); |
2153 | btrfs_interface_exit(); | 2153 | btrfs_interface_exit(); |
2154 | btrfs_end_io_wq_exit(); | ||
2154 | unregister_filesystem(&btrfs_fs_type); | 2155 | unregister_filesystem(&btrfs_fs_type); |
2155 | btrfs_exit_sysfs(); | 2156 | btrfs_exit_sysfs(); |
2156 | btrfs_cleanup_fs_uuids(); | 2157 | btrfs_cleanup_fs_uuids(); |
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 1475979e5718..286213cec861 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -672,7 +672,7 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans, | |||
672 | * is this extent already allocated in the extent | 672 | * is this extent already allocated in the extent |
673 | * allocation tree? If so, just add a reference | 673 | * allocation tree? If so, just add a reference |
674 | */ | 674 | */ |
675 | ret = btrfs_lookup_extent(root, ins.objectid, | 675 | ret = btrfs_lookup_data_extent(root, ins.objectid, |
676 | ins.offset); | 676 | ins.offset); |
677 | if (ret == 0) { | 677 | if (ret == 0) { |
678 | ret = btrfs_inc_extent_ref(trans, root, | 678 | ret = btrfs_inc_extent_ref(trans, root, |
diff --git a/fs/buffer.c b/fs/buffer.c index 6c48f20eddd4..20805db2c987 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -128,21 +128,15 @@ __clear_page_buffers(struct page *page) | |||
128 | page_cache_release(page); | 128 | page_cache_release(page); |
129 | } | 129 | } |
130 | 130 | ||
131 | 131 | static void buffer_io_error(struct buffer_head *bh, char *msg) | |
132 | static int quiet_error(struct buffer_head *bh) | ||
133 | { | ||
134 | if (!test_bit(BH_Quiet, &bh->b_state) && printk_ratelimit()) | ||
135 | return 0; | ||
136 | return 1; | ||
137 | } | ||
138 | |||
139 | |||
140 | static void buffer_io_error(struct buffer_head *bh) | ||
141 | { | 132 | { |
142 | char b[BDEVNAME_SIZE]; | 133 | char b[BDEVNAME_SIZE]; |
143 | printk(KERN_ERR "Buffer I/O error on device %s, logical block %Lu\n", | 134 | |
135 | if (!test_bit(BH_Quiet, &bh->b_state)) | ||
136 | printk_ratelimited(KERN_ERR | ||
137 | "Buffer I/O error on dev %s, logical block %llu%s\n", | ||
144 | bdevname(bh->b_bdev, b), | 138 | bdevname(bh->b_bdev, b), |
145 | (unsigned long long)bh->b_blocknr); | 139 | (unsigned long long)bh->b_blocknr, msg); |
146 | } | 140 | } |
147 | 141 | ||
148 | /* | 142 | /* |
@@ -177,17 +171,10 @@ EXPORT_SYMBOL(end_buffer_read_sync); | |||
177 | 171 | ||
178 | void end_buffer_write_sync(struct buffer_head *bh, int uptodate) | 172 | void end_buffer_write_sync(struct buffer_head *bh, int uptodate) |
179 | { | 173 | { |
180 | char b[BDEVNAME_SIZE]; | ||
181 | |||
182 | if (uptodate) { | 174 | if (uptodate) { |
183 | set_buffer_uptodate(bh); | 175 | set_buffer_uptodate(bh); |
184 | } else { | 176 | } else { |
185 | if (!quiet_error(bh)) { | 177 | buffer_io_error(bh, ", lost sync page write"); |
186 | buffer_io_error(bh); | ||
187 | printk(KERN_WARNING "lost page write due to " | ||
188 | "I/O error on %s\n", | ||
189 | bdevname(bh->b_bdev, b)); | ||
190 | } | ||
191 | set_buffer_write_io_error(bh); | 178 | set_buffer_write_io_error(bh); |
192 | clear_buffer_uptodate(bh); | 179 | clear_buffer_uptodate(bh); |
193 | } | 180 | } |
@@ -304,8 +291,7 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate) | |||
304 | set_buffer_uptodate(bh); | 291 | set_buffer_uptodate(bh); |
305 | } else { | 292 | } else { |
306 | clear_buffer_uptodate(bh); | 293 | clear_buffer_uptodate(bh); |
307 | if (!quiet_error(bh)) | 294 | buffer_io_error(bh, ", async page read"); |
308 | buffer_io_error(bh); | ||
309 | SetPageError(page); | 295 | SetPageError(page); |
310 | } | 296 | } |
311 | 297 | ||
@@ -353,7 +339,6 @@ still_busy: | |||
353 | */ | 339 | */ |
354 | void end_buffer_async_write(struct buffer_head *bh, int uptodate) | 340 | void end_buffer_async_write(struct buffer_head *bh, int uptodate) |
355 | { | 341 | { |
356 | char b[BDEVNAME_SIZE]; | ||
357 | unsigned long flags; | 342 | unsigned long flags; |
358 | struct buffer_head *first; | 343 | struct buffer_head *first; |
359 | struct buffer_head *tmp; | 344 | struct buffer_head *tmp; |
@@ -365,12 +350,7 @@ void end_buffer_async_write(struct buffer_head *bh, int uptodate) | |||
365 | if (uptodate) { | 350 | if (uptodate) { |
366 | set_buffer_uptodate(bh); | 351 | set_buffer_uptodate(bh); |
367 | } else { | 352 | } else { |
368 | if (!quiet_error(bh)) { | 353 | buffer_io_error(bh, ", lost async page write"); |
369 | buffer_io_error(bh); | ||
370 | printk(KERN_WARNING "lost page write due to " | ||
371 | "I/O error on %s\n", | ||
372 | bdevname(bh->b_bdev, b)); | ||
373 | } | ||
374 | set_bit(AS_EIO, &page->mapping->flags); | 354 | set_bit(AS_EIO, &page->mapping->flags); |
375 | set_buffer_write_io_error(bh); | 355 | set_buffer_write_io_error(bh); |
376 | clear_buffer_uptodate(bh); | 356 | clear_buffer_uptodate(bh); |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 7015db0bafd1..eb742d0e67ff 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -1354,13 +1354,6 @@ set_qf_format: | |||
1354 | "not specified."); | 1354 | "not specified."); |
1355 | return 0; | 1355 | return 0; |
1356 | } | 1356 | } |
1357 | } else { | ||
1358 | if (sbi->s_jquota_fmt) { | ||
1359 | ext3_msg(sb, KERN_ERR, "error: journaled quota format " | ||
1360 | "specified with no journaling " | ||
1361 | "enabled."); | ||
1362 | return 0; | ||
1363 | } | ||
1364 | } | 1357 | } |
1365 | #endif | 1358 | #endif |
1366 | return 1; | 1359 | return 1; |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 37043d0b2be8..0b16fb4c06d3 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -3603,11 +3603,10 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, | |||
3603 | } | 3603 | } |
3604 | } | 3604 | } |
3605 | 3605 | ||
3606 | allocated = ext4_split_extent(handle, inode, ppath, | 3606 | err = ext4_split_extent(handle, inode, ppath, &split_map, split_flag, |
3607 | &split_map, split_flag, flags); | 3607 | flags); |
3608 | if (allocated < 0) | 3608 | if (err > 0) |
3609 | err = allocated; | 3609 | err = 0; |
3610 | |||
3611 | out: | 3610 | out: |
3612 | /* If we have gotten a failure, don't zero out status tree */ | 3611 | /* If we have gotten a failure, don't zero out status tree */ |
3613 | if (!err) | 3612 | if (!err) |
diff --git a/fs/ext4/file.c b/fs/ext4/file.c index aca7b24a4432..8131be8c0af3 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c | |||
@@ -137,10 +137,10 @@ ext4_file_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
137 | iov_iter_truncate(from, sbi->s_bitmap_maxbytes - pos); | 137 | iov_iter_truncate(from, sbi->s_bitmap_maxbytes - pos); |
138 | } | 138 | } |
139 | 139 | ||
140 | iocb->private = &overwrite; | ||
140 | if (o_direct) { | 141 | if (o_direct) { |
141 | blk_start_plug(&plug); | 142 | blk_start_plug(&plug); |
142 | 143 | ||
143 | iocb->private = &overwrite; | ||
144 | 144 | ||
145 | /* check whether we do a DIO overwrite or not */ | 145 | /* check whether we do a DIO overwrite or not */ |
146 | if (ext4_should_dioread_nolock(inode) && !aio_mutex && | 146 | if (ext4_should_dioread_nolock(inode) && !aio_mutex && |
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 8012a5daf401..ac644c31ca67 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
@@ -887,6 +887,10 @@ got: | |||
887 | struct buffer_head *block_bitmap_bh; | 887 | struct buffer_head *block_bitmap_bh; |
888 | 888 | ||
889 | block_bitmap_bh = ext4_read_block_bitmap(sb, group); | 889 | block_bitmap_bh = ext4_read_block_bitmap(sb, group); |
890 | if (!block_bitmap_bh) { | ||
891 | err = -EIO; | ||
892 | goto out; | ||
893 | } | ||
890 | BUFFER_TRACE(block_bitmap_bh, "get block bitmap access"); | 894 | BUFFER_TRACE(block_bitmap_bh, "get block bitmap access"); |
891 | err = ext4_journal_get_write_access(handle, block_bitmap_bh); | 895 | err = ext4_journal_get_write_access(handle, block_bitmap_bh); |
892 | if (err) { | 896 | if (err) { |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index e9777f93cf05..3356ab5395f4 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -4959,7 +4959,12 @@ int ext4_change_inode_journal_flag(struct inode *inode, int val) | |||
4959 | if (val) | 4959 | if (val) |
4960 | ext4_set_inode_flag(inode, EXT4_INODE_JOURNAL_DATA); | 4960 | ext4_set_inode_flag(inode, EXT4_INODE_JOURNAL_DATA); |
4961 | else { | 4961 | else { |
4962 | jbd2_journal_flush(journal); | 4962 | err = jbd2_journal_flush(journal); |
4963 | if (err < 0) { | ||
4964 | jbd2_journal_unlock_updates(journal); | ||
4965 | ext4_inode_resume_unlocked_dio(inode); | ||
4966 | return err; | ||
4967 | } | ||
4963 | ext4_clear_inode_flag(inode, EXT4_INODE_JOURNAL_DATA); | 4968 | ext4_clear_inode_flag(inode, EXT4_INODE_JOURNAL_DATA); |
4964 | } | 4969 | } |
4965 | ext4_set_aops(inode); | 4970 | ext4_set_aops(inode); |
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 123798c5ac31..426211882f72 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
@@ -1816,31 +1816,39 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry, | |||
1816 | hinfo.hash_version += EXT4_SB(dir->i_sb)->s_hash_unsigned; | 1816 | hinfo.hash_version += EXT4_SB(dir->i_sb)->s_hash_unsigned; |
1817 | hinfo.seed = EXT4_SB(dir->i_sb)->s_hash_seed; | 1817 | hinfo.seed = EXT4_SB(dir->i_sb)->s_hash_seed; |
1818 | ext4fs_dirhash(name, namelen, &hinfo); | 1818 | ext4fs_dirhash(name, namelen, &hinfo); |
1819 | memset(frames, 0, sizeof(frames)); | ||
1819 | frame = frames; | 1820 | frame = frames; |
1820 | frame->entries = entries; | 1821 | frame->entries = entries; |
1821 | frame->at = entries; | 1822 | frame->at = entries; |
1822 | frame->bh = bh; | 1823 | frame->bh = bh; |
1823 | bh = bh2; | 1824 | bh = bh2; |
1824 | 1825 | ||
1825 | ext4_handle_dirty_dx_node(handle, dir, frame->bh); | 1826 | retval = ext4_handle_dirty_dx_node(handle, dir, frame->bh); |
1826 | ext4_handle_dirty_dirent_node(handle, dir, bh); | 1827 | if (retval) |
1828 | goto out_frames; | ||
1829 | retval = ext4_handle_dirty_dirent_node(handle, dir, bh); | ||
1830 | if (retval) | ||
1831 | goto out_frames; | ||
1827 | 1832 | ||
1828 | de = do_split(handle,dir, &bh, frame, &hinfo); | 1833 | de = do_split(handle,dir, &bh, frame, &hinfo); |
1829 | if (IS_ERR(de)) { | 1834 | if (IS_ERR(de)) { |
1830 | /* | 1835 | retval = PTR_ERR(de); |
1831 | * Even if the block split failed, we have to properly write | 1836 | goto out_frames; |
1832 | * out all the changes we did so far. Otherwise we can end up | ||
1833 | * with corrupted filesystem. | ||
1834 | */ | ||
1835 | ext4_mark_inode_dirty(handle, dir); | ||
1836 | dx_release(frames); | ||
1837 | return PTR_ERR(de); | ||
1838 | } | 1837 | } |
1839 | dx_release(frames); | 1838 | dx_release(frames); |
1840 | 1839 | ||
1841 | retval = add_dirent_to_buf(handle, dentry, inode, de, bh); | 1840 | retval = add_dirent_to_buf(handle, dentry, inode, de, bh); |
1842 | brelse(bh); | 1841 | brelse(bh); |
1843 | return retval; | 1842 | return retval; |
1843 | out_frames: | ||
1844 | /* | ||
1845 | * Even if the block split failed, we have to properly write | ||
1846 | * out all the changes we did so far. Otherwise we can end up | ||
1847 | * with corrupted filesystem. | ||
1848 | */ | ||
1849 | ext4_mark_inode_dirty(handle, dir); | ||
1850 | dx_release(frames); | ||
1851 | return retval; | ||
1844 | } | 1852 | } |
1845 | 1853 | ||
1846 | /* | 1854 | /* |
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index f298c60f907d..ca4588388fc3 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c | |||
@@ -1081,7 +1081,7 @@ static void update_backups(struct super_block *sb, int blk_off, char *data, | |||
1081 | break; | 1081 | break; |
1082 | 1082 | ||
1083 | if (meta_bg == 0) | 1083 | if (meta_bg == 0) |
1084 | backup_block = group * bpg + blk_off; | 1084 | backup_block = ((ext4_fsblk_t)group) * bpg + blk_off; |
1085 | else | 1085 | else |
1086 | backup_block = (ext4_group_first_block_no(sb, group) + | 1086 | backup_block = (ext4_group_first_block_no(sb, group) + |
1087 | ext4_bg_has_super(sb, group)); | 1087 | ext4_bg_has_super(sb, group)); |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 1eda6ab0ef9d..2c9e6864abd9 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -3526,6 +3526,10 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3526 | #ifdef CONFIG_EXT4_FS_POSIX_ACL | 3526 | #ifdef CONFIG_EXT4_FS_POSIX_ACL |
3527 | set_opt(sb, POSIX_ACL); | 3527 | set_opt(sb, POSIX_ACL); |
3528 | #endif | 3528 | #endif |
3529 | /* don't forget to enable journal_csum when metadata_csum is enabled. */ | ||
3530 | if (ext4_has_metadata_csum(sb)) | ||
3531 | set_opt(sb, JOURNAL_CHECKSUM); | ||
3532 | |||
3529 | if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_DATA) | 3533 | if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_DATA) |
3530 | set_opt(sb, JOURNAL_DATA); | 3534 | set_opt(sb, JOURNAL_DATA); |
3531 | else if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_ORDERED) | 3535 | else if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_ORDERED) |
@@ -3943,7 +3947,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3943 | if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_MMP) && | 3947 | if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_MMP) && |
3944 | !(sb->s_flags & MS_RDONLY)) | 3948 | !(sb->s_flags & MS_RDONLY)) |
3945 | if (ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block))) | 3949 | if (ext4_multi_mount_protect(sb, le64_to_cpu(es->s_mmp_block))) |
3946 | goto failed_mount3; | 3950 | goto failed_mount3a; |
3947 | 3951 | ||
3948 | /* | 3952 | /* |
3949 | * The first inode we look at is the journal inode. Don't try | 3953 | * The first inode we look at is the journal inode. Don't try |
@@ -3952,7 +3956,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3952 | if (!test_opt(sb, NOLOAD) && | 3956 | if (!test_opt(sb, NOLOAD) && |
3953 | EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) { | 3957 | EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) { |
3954 | if (ext4_load_journal(sb, es, journal_devnum)) | 3958 | if (ext4_load_journal(sb, es, journal_devnum)) |
3955 | goto failed_mount3; | 3959 | goto failed_mount3a; |
3956 | } else if (test_opt(sb, NOLOAD) && !(sb->s_flags & MS_RDONLY) && | 3960 | } else if (test_opt(sb, NOLOAD) && !(sb->s_flags & MS_RDONLY) && |
3957 | EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER)) { | 3961 | EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER)) { |
3958 | ext4_msg(sb, KERN_ERR, "required journal recovery " | 3962 | ext4_msg(sb, KERN_ERR, "required journal recovery " |
@@ -4240,6 +4244,7 @@ failed_mount_wq: | |||
4240 | jbd2_journal_destroy(sbi->s_journal); | 4244 | jbd2_journal_destroy(sbi->s_journal); |
4241 | sbi->s_journal = NULL; | 4245 | sbi->s_journal = NULL; |
4242 | } | 4246 | } |
4247 | failed_mount3a: | ||
4243 | ext4_es_unregister_shrinker(sbi); | 4248 | ext4_es_unregister_shrinker(sbi); |
4244 | failed_mount3: | 4249 | failed_mount3: |
4245 | del_timer_sync(&sbi->s_err_report); | 4250 | del_timer_sync(&sbi->s_err_report); |
@@ -4841,6 +4846,14 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) | |||
4841 | goto restore_opts; | 4846 | goto restore_opts; |
4842 | } | 4847 | } |
4843 | 4848 | ||
4849 | if ((old_opts.s_mount_opt & EXT4_MOUNT_JOURNAL_CHECKSUM) ^ | ||
4850 | test_opt(sb, JOURNAL_CHECKSUM)) { | ||
4851 | ext4_msg(sb, KERN_ERR, "changing journal_checksum " | ||
4852 | "during remount not supported"); | ||
4853 | err = -EINVAL; | ||
4854 | goto restore_opts; | ||
4855 | } | ||
4856 | |||
4844 | if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) { | 4857 | if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) { |
4845 | if (test_opt2(sb, EXPLICIT_DELALLOC)) { | 4858 | if (test_opt2(sb, EXPLICIT_DELALLOC)) { |
4846 | ext4_msg(sb, KERN_ERR, "can't mount with " | 4859 | ext4_msg(sb, KERN_ERR, "can't mount with " |
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index 881b3bd0143f..fe839b915116 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c | |||
@@ -29,13 +29,9 @@ | |||
29 | #define BEQUIET | 29 | #define BEQUIET |
30 | 30 | ||
31 | static int isofs_hashi(const struct dentry *parent, struct qstr *qstr); | 31 | static int isofs_hashi(const struct dentry *parent, struct qstr *qstr); |
32 | static int isofs_hash(const struct dentry *parent, struct qstr *qstr); | ||
33 | static int isofs_dentry_cmpi(const struct dentry *parent, | 32 | static int isofs_dentry_cmpi(const struct dentry *parent, |
34 | const struct dentry *dentry, | 33 | const struct dentry *dentry, |
35 | unsigned int len, const char *str, const struct qstr *name); | 34 | unsigned int len, const char *str, const struct qstr *name); |
36 | static int isofs_dentry_cmp(const struct dentry *parent, | ||
37 | const struct dentry *dentry, | ||
38 | unsigned int len, const char *str, const struct qstr *name); | ||
39 | 35 | ||
40 | #ifdef CONFIG_JOLIET | 36 | #ifdef CONFIG_JOLIET |
41 | static int isofs_hashi_ms(const struct dentry *parent, struct qstr *qstr); | 37 | static int isofs_hashi_ms(const struct dentry *parent, struct qstr *qstr); |
@@ -135,10 +131,6 @@ static const struct super_operations isofs_sops = { | |||
135 | 131 | ||
136 | static const struct dentry_operations isofs_dentry_ops[] = { | 132 | static const struct dentry_operations isofs_dentry_ops[] = { |
137 | { | 133 | { |
138 | .d_hash = isofs_hash, | ||
139 | .d_compare = isofs_dentry_cmp, | ||
140 | }, | ||
141 | { | ||
142 | .d_hash = isofs_hashi, | 134 | .d_hash = isofs_hashi, |
143 | .d_compare = isofs_dentry_cmpi, | 135 | .d_compare = isofs_dentry_cmpi, |
144 | }, | 136 | }, |
@@ -258,25 +250,12 @@ static int isofs_dentry_cmp_common( | |||
258 | } | 250 | } |
259 | 251 | ||
260 | static int | 252 | static int |
261 | isofs_hash(const struct dentry *dentry, struct qstr *qstr) | ||
262 | { | ||
263 | return isofs_hash_common(qstr, 0); | ||
264 | } | ||
265 | |||
266 | static int | ||
267 | isofs_hashi(const struct dentry *dentry, struct qstr *qstr) | 253 | isofs_hashi(const struct dentry *dentry, struct qstr *qstr) |
268 | { | 254 | { |
269 | return isofs_hashi_common(qstr, 0); | 255 | return isofs_hashi_common(qstr, 0); |
270 | } | 256 | } |
271 | 257 | ||
272 | static int | 258 | static int |
273 | isofs_dentry_cmp(const struct dentry *parent, const struct dentry *dentry, | ||
274 | unsigned int len, const char *str, const struct qstr *name) | ||
275 | { | ||
276 | return isofs_dentry_cmp_common(len, str, name, 0, 0); | ||
277 | } | ||
278 | |||
279 | static int | ||
280 | isofs_dentry_cmpi(const struct dentry *parent, const struct dentry *dentry, | 259 | isofs_dentry_cmpi(const struct dentry *parent, const struct dentry *dentry, |
281 | unsigned int len, const char *str, const struct qstr *name) | 260 | unsigned int len, const char *str, const struct qstr *name) |
282 | { | 261 | { |
@@ -930,7 +909,8 @@ root_found: | |||
930 | if (opt.check == 'r') | 909 | if (opt.check == 'r') |
931 | table++; | 910 | table++; |
932 | 911 | ||
933 | s->s_d_op = &isofs_dentry_ops[table]; | 912 | if (table) |
913 | s->s_d_op = &isofs_dentry_ops[table - 1]; | ||
934 | 914 | ||
935 | /* get the root dentry */ | 915 | /* get the root dentry */ |
936 | s->s_root = d_make_root(inode); | 916 | s->s_root = d_make_root(inode); |
diff --git a/fs/isofs/namei.c b/fs/isofs/namei.c index 95295640d9c8..7b543e6b6526 100644 --- a/fs/isofs/namei.c +++ b/fs/isofs/namei.c | |||
@@ -18,25 +18,10 @@ static int | |||
18 | isofs_cmp(struct dentry *dentry, const char *compare, int dlen) | 18 | isofs_cmp(struct dentry *dentry, const char *compare, int dlen) |
19 | { | 19 | { |
20 | struct qstr qstr; | 20 | struct qstr qstr; |
21 | |||
22 | if (!compare) | ||
23 | return 1; | ||
24 | |||
25 | /* check special "." and ".." files */ | ||
26 | if (dlen == 1) { | ||
27 | /* "." */ | ||
28 | if (compare[0] == 0) { | ||
29 | if (!dentry->d_name.len) | ||
30 | return 0; | ||
31 | compare = "."; | ||
32 | } else if (compare[0] == 1) { | ||
33 | compare = ".."; | ||
34 | dlen = 2; | ||
35 | } | ||
36 | } | ||
37 | |||
38 | qstr.name = compare; | 21 | qstr.name = compare; |
39 | qstr.len = dlen; | 22 | qstr.len = dlen; |
23 | if (likely(!dentry->d_op)) | ||
24 | return dentry->d_name.len != dlen || memcmp(dentry->d_name.name, compare, dlen); | ||
40 | return dentry->d_op->d_compare(NULL, NULL, dentry->d_name.len, dentry->d_name.name, &qstr); | 25 | return dentry->d_op->d_compare(NULL, NULL, dentry->d_name.len, dentry->d_name.name, &qstr); |
41 | } | 26 | } |
42 | 27 | ||
@@ -146,7 +131,8 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry, | |||
146 | (!(de->flags[-sbi->s_high_sierra] & 1))) && | 131 | (!(de->flags[-sbi->s_high_sierra] & 1))) && |
147 | (sbi->s_showassoc || | 132 | (sbi->s_showassoc || |
148 | (!(de->flags[-sbi->s_high_sierra] & 4)))) { | 133 | (!(de->flags[-sbi->s_high_sierra] & 4)))) { |
149 | match = (isofs_cmp(dentry, dpnt, dlen) == 0); | 134 | if (dpnt && (dlen > 1 || dpnt[0] > 1)) |
135 | match = (isofs_cmp(dentry, dpnt, dlen) == 0); | ||
150 | } | 136 | } |
151 | if (match) { | 137 | if (match) { |
152 | isofs_normalize_block_and_offset(de, | 138 | isofs_normalize_block_and_offset(de, |
diff --git a/fs/jbd/revoke.c b/fs/jbd/revoke.c index 8898bbd2b61e..dcead636c33b 100644 --- a/fs/jbd/revoke.c +++ b/fs/jbd/revoke.c | |||
@@ -93,6 +93,7 @@ | |||
93 | #include <linux/bio.h> | 93 | #include <linux/bio.h> |
94 | #endif | 94 | #endif |
95 | #include <linux/log2.h> | 95 | #include <linux/log2.h> |
96 | #include <linux/hash.h> | ||
96 | 97 | ||
97 | static struct kmem_cache *revoke_record_cache; | 98 | static struct kmem_cache *revoke_record_cache; |
98 | static struct kmem_cache *revoke_table_cache; | 99 | static struct kmem_cache *revoke_table_cache; |
@@ -129,15 +130,11 @@ static void flush_descriptor(journal_t *, struct journal_head *, int, int); | |||
129 | 130 | ||
130 | /* Utility functions to maintain the revoke table */ | 131 | /* Utility functions to maintain the revoke table */ |
131 | 132 | ||
132 | /* Borrowed from buffer.c: this is a tried and tested block hash function */ | ||
133 | static inline int hash(journal_t *journal, unsigned int block) | 133 | static inline int hash(journal_t *journal, unsigned int block) |
134 | { | 134 | { |
135 | struct jbd_revoke_table_s *table = journal->j_revoke; | 135 | struct jbd_revoke_table_s *table = journal->j_revoke; |
136 | int hash_shift = table->hash_shift; | ||
137 | 136 | ||
138 | return ((block << (hash_shift - 6)) ^ | 137 | return hash_32(block, table->hash_shift); |
139 | (block >> 13) ^ | ||
140 | (block << (hash_shift - 12))) & (table->hash_size - 1); | ||
141 | } | 138 | } |
142 | 139 | ||
143 | static int insert_revoke_hash(journal_t *journal, unsigned int blocknr, | 140 | static int insert_revoke_hash(journal_t *journal, unsigned int blocknr, |
diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c index d5e95a175c92..c6cbaef2bda1 100644 --- a/fs/jbd2/revoke.c +++ b/fs/jbd2/revoke.c | |||
@@ -92,6 +92,7 @@ | |||
92 | #include <linux/init.h> | 92 | #include <linux/init.h> |
93 | #include <linux/bio.h> | 93 | #include <linux/bio.h> |
94 | #include <linux/log2.h> | 94 | #include <linux/log2.h> |
95 | #include <linux/hash.h> | ||
95 | #endif | 96 | #endif |
96 | 97 | ||
97 | static struct kmem_cache *jbd2_revoke_record_cache; | 98 | static struct kmem_cache *jbd2_revoke_record_cache; |
@@ -130,16 +131,9 @@ static void flush_descriptor(journal_t *, struct buffer_head *, int, int); | |||
130 | 131 | ||
131 | /* Utility functions to maintain the revoke table */ | 132 | /* Utility functions to maintain the revoke table */ |
132 | 133 | ||
133 | /* Borrowed from buffer.c: this is a tried and tested block hash function */ | ||
134 | static inline int hash(journal_t *journal, unsigned long long block) | 134 | static inline int hash(journal_t *journal, unsigned long long block) |
135 | { | 135 | { |
136 | struct jbd2_revoke_table_s *table = journal->j_revoke; | 136 | return hash_64(block, journal->j_revoke->hash_shift); |
137 | int hash_shift = table->hash_shift; | ||
138 | int hash = (int)block ^ (int)((block >> 31) >> 1); | ||
139 | |||
140 | return ((hash << (hash_shift - 6)) ^ | ||
141 | (hash >> 13) ^ | ||
142 | (hash << (hash_shift - 12))) & (table->hash_size - 1); | ||
143 | } | 137 | } |
144 | 138 | ||
145 | static int insert_revoke_hash(journal_t *journal, unsigned long long blocknr, | 139 | static int insert_revoke_hash(journal_t *journal, unsigned long long blocknr, |
diff --git a/fs/namei.c b/fs/namei.c index 42df664e95e5..db5fe86319e6 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -2497,7 +2497,7 @@ struct dentry *lock_rename(struct dentry *p1, struct dentry *p2) | |||
2497 | } | 2497 | } |
2498 | 2498 | ||
2499 | mutex_lock_nested(&p1->d_inode->i_mutex, I_MUTEX_PARENT); | 2499 | mutex_lock_nested(&p1->d_inode->i_mutex, I_MUTEX_PARENT); |
2500 | mutex_lock_nested(&p2->d_inode->i_mutex, I_MUTEX_CHILD); | 2500 | mutex_lock_nested(&p2->d_inode->i_mutex, I_MUTEX_PARENT2); |
2501 | return NULL; | 2501 | return NULL; |
2502 | } | 2502 | } |
2503 | EXPORT_SYMBOL(lock_rename); | 2503 | EXPORT_SYMBOL(lock_rename); |
@@ -3154,7 +3154,8 @@ static int do_tmpfile(int dfd, struct filename *pathname, | |||
3154 | if (error) | 3154 | if (error) |
3155 | goto out2; | 3155 | goto out2; |
3156 | audit_inode(pathname, nd->path.dentry, 0); | 3156 | audit_inode(pathname, nd->path.dentry, 0); |
3157 | error = may_open(&nd->path, op->acc_mode, op->open_flag); | 3157 | /* Don't check for other permissions, the inode was just created */ |
3158 | error = may_open(&nd->path, MAY_OPEN, op->open_flag); | ||
3158 | if (error) | 3159 | if (error) |
3159 | goto out2; | 3160 | goto out2; |
3160 | file->f_path.mnt = nd->path.mnt; | 3161 | file->f_path.mnt = nd->path.mnt; |
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index cdeb3cfd6f32..0beb023f25ac 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c | |||
@@ -1272,7 +1272,8 @@ static bool need_wrongsec_check(struct svc_rqst *rqstp) | |||
1272 | */ | 1272 | */ |
1273 | if (argp->opcnt == resp->opcnt) | 1273 | if (argp->opcnt == resp->opcnt) |
1274 | return false; | 1274 | return false; |
1275 | 1275 | if (next->opnum == OP_ILLEGAL) | |
1276 | return false; | ||
1276 | nextd = OPDESC(next); | 1277 | nextd = OPDESC(next); |
1277 | /* | 1278 | /* |
1278 | * Rest of 2.6.3.1.1: certain operations will return WRONGSEC | 1279 | * Rest of 2.6.3.1.1: certain operations will return WRONGSEC |
@@ -1589,7 +1590,8 @@ static inline u32 nfsd4_rename_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op | |||
1589 | static inline u32 nfsd4_sequence_rsize(struct svc_rqst *rqstp, | 1590 | static inline u32 nfsd4_sequence_rsize(struct svc_rqst *rqstp, |
1590 | struct nfsd4_op *op) | 1591 | struct nfsd4_op *op) |
1591 | { | 1592 | { |
1592 | return NFS4_MAX_SESSIONID_LEN + 20; | 1593 | return (op_encode_hdr_size |
1594 | + XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + 5) * sizeof(__be32); | ||
1593 | } | 1595 | } |
1594 | 1596 | ||
1595 | static inline u32 nfsd4_setattr_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) | 1597 | static inline u32 nfsd4_setattr_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) |
@@ -1893,6 +1895,7 @@ static struct nfsd4_operation nfsd4_ops[] = { | |||
1893 | .op_func = (nfsd4op_func)nfsd4_sequence, | 1895 | .op_func = (nfsd4op_func)nfsd4_sequence, |
1894 | .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP, | 1896 | .op_flags = ALLOWED_WITHOUT_FH | ALLOWED_AS_FIRST_OP, |
1895 | .op_name = "OP_SEQUENCE", | 1897 | .op_name = "OP_SEQUENCE", |
1898 | .op_rsize_bop = (nfsd4op_rsize)nfsd4_sequence_rsize, | ||
1896 | }, | 1899 | }, |
1897 | [OP_DESTROY_CLIENTID] = { | 1900 | [OP_DESTROY_CLIENTID] = { |
1898 | .op_func = (nfsd4op_func)nfsd4_destroy_clientid, | 1901 | .op_func = (nfsd4op_func)nfsd4_destroy_clientid, |
diff --git a/fs/notify/inode_mark.c b/fs/notify/inode_mark.c index 9ce062218de9..e8497144b323 100644 --- a/fs/notify/inode_mark.c +++ b/fs/notify/inode_mark.c | |||
@@ -288,20 +288,25 @@ void fsnotify_unmount_inodes(struct list_head *list) | |||
288 | spin_unlock(&inode->i_lock); | 288 | spin_unlock(&inode->i_lock); |
289 | 289 | ||
290 | /* In case the dropping of a reference would nuke next_i. */ | 290 | /* In case the dropping of a reference would nuke next_i. */ |
291 | if ((&next_i->i_sb_list != list) && | 291 | while (&next_i->i_sb_list != list) { |
292 | atomic_read(&next_i->i_count)) { | ||
293 | spin_lock(&next_i->i_lock); | 292 | spin_lock(&next_i->i_lock); |
294 | if (!(next_i->i_state & (I_FREEING | I_WILL_FREE))) { | 293 | if (!(next_i->i_state & (I_FREEING | I_WILL_FREE)) && |
294 | atomic_read(&next_i->i_count)) { | ||
295 | __iget(next_i); | 295 | __iget(next_i); |
296 | need_iput = next_i; | 296 | need_iput = next_i; |
297 | spin_unlock(&next_i->i_lock); | ||
298 | break; | ||
297 | } | 299 | } |
298 | spin_unlock(&next_i->i_lock); | 300 | spin_unlock(&next_i->i_lock); |
301 | next_i = list_entry(next_i->i_sb_list.next, | ||
302 | struct inode, i_sb_list); | ||
299 | } | 303 | } |
300 | 304 | ||
301 | /* | 305 | /* |
302 | * We can safely drop inode_sb_list_lock here because we hold | 306 | * We can safely drop inode_sb_list_lock here because either |
303 | * references on both inode and next_i. Also no new inodes | 307 | * we actually hold references on both inode and next_i or |
304 | * will be added since the umount has begun. | 308 | * end of list. Also no new inodes will be added since the |
309 | * umount has begun. | ||
305 | */ | 310 | */ |
306 | spin_unlock(&inode_sb_list_lock); | 311 | spin_unlock(&inode_sb_list_lock); |
307 | 312 | ||
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index 8add6f1030d7..b931e04e3388 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
@@ -158,7 +158,7 @@ bail_add: | |||
158 | * NOTE: This dentry already has ->d_op set from | 158 | * NOTE: This dentry already has ->d_op set from |
159 | * ocfs2_get_parent() and ocfs2_get_dentry() | 159 | * ocfs2_get_parent() and ocfs2_get_dentry() |
160 | */ | 160 | */ |
161 | if (ret) | 161 | if (!IS_ERR_OR_NULL(ret)) |
162 | dentry = ret; | 162 | dentry = ret; |
163 | 163 | ||
164 | status = ocfs2_dentry_attach_lock(dentry, inode, | 164 | status = ocfs2_dentry_attach_lock(dentry, inode, |
diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c index 910553f37aca..4e9d7c1fea52 100644 --- a/fs/overlayfs/readdir.c +++ b/fs/overlayfs/readdir.c | |||
@@ -21,9 +21,10 @@ struct ovl_cache_entry { | |||
21 | unsigned int len; | 21 | unsigned int len; |
22 | unsigned int type; | 22 | unsigned int type; |
23 | u64 ino; | 23 | u64 ino; |
24 | bool is_whiteout; | ||
25 | struct list_head l_node; | 24 | struct list_head l_node; |
26 | struct rb_node node; | 25 | struct rb_node node; |
26 | bool is_whiteout; | ||
27 | bool is_cursor; | ||
27 | char name[]; | 28 | char name[]; |
28 | }; | 29 | }; |
29 | 30 | ||
@@ -92,6 +93,7 @@ static struct ovl_cache_entry *ovl_cache_entry_new(const char *name, int len, | |||
92 | p->type = d_type; | 93 | p->type = d_type; |
93 | p->ino = ino; | 94 | p->ino = ino; |
94 | p->is_whiteout = false; | 95 | p->is_whiteout = false; |
96 | p->is_cursor = false; | ||
95 | } | 97 | } |
96 | 98 | ||
97 | return p; | 99 | return p; |
@@ -251,7 +253,7 @@ static int ovl_dir_mark_whiteouts(struct dentry *dir, | |||
251 | 253 | ||
252 | mutex_lock(&dir->d_inode->i_mutex); | 254 | mutex_lock(&dir->d_inode->i_mutex); |
253 | list_for_each_entry(p, rdd->list, l_node) { | 255 | list_for_each_entry(p, rdd->list, l_node) { |
254 | if (!p->name) | 256 | if (p->is_cursor) |
255 | continue; | 257 | continue; |
256 | 258 | ||
257 | if (p->type != DT_CHR) | 259 | if (p->type != DT_CHR) |
@@ -307,7 +309,6 @@ static inline int ovl_dir_read_merged(struct path *upperpath, | |||
307 | } | 309 | } |
308 | out: | 310 | out: |
309 | return err; | 311 | return err; |
310 | |||
311 | } | 312 | } |
312 | 313 | ||
313 | static void ovl_seek_cursor(struct ovl_dir_file *od, loff_t pos) | 314 | static void ovl_seek_cursor(struct ovl_dir_file *od, loff_t pos) |
@@ -316,7 +317,7 @@ static void ovl_seek_cursor(struct ovl_dir_file *od, loff_t pos) | |||
316 | loff_t off = 0; | 317 | loff_t off = 0; |
317 | 318 | ||
318 | list_for_each_entry(p, &od->cache->entries, l_node) { | 319 | list_for_each_entry(p, &od->cache->entries, l_node) { |
319 | if (!p->name) | 320 | if (p->is_cursor) |
320 | continue; | 321 | continue; |
321 | if (off >= pos) | 322 | if (off >= pos) |
322 | break; | 323 | break; |
@@ -389,7 +390,7 @@ static int ovl_iterate(struct file *file, struct dir_context *ctx) | |||
389 | 390 | ||
390 | p = list_entry(od->cursor.l_node.next, struct ovl_cache_entry, l_node); | 391 | p = list_entry(od->cursor.l_node.next, struct ovl_cache_entry, l_node); |
391 | /* Skip cursors */ | 392 | /* Skip cursors */ |
392 | if (p->name) { | 393 | if (!p->is_cursor) { |
393 | if (!p->is_whiteout) { | 394 | if (!p->is_whiteout) { |
394 | if (!dir_emit(ctx, p->name, p->len, p->ino, p->type)) | 395 | if (!dir_emit(ctx, p->name, p->len, p->ino, p->type)) |
395 | break; | 396 | break; |
@@ -454,12 +455,13 @@ static int ovl_dir_fsync(struct file *file, loff_t start, loff_t end, | |||
454 | if (!od->is_upper && ovl_path_type(dentry) == OVL_PATH_MERGE) { | 455 | if (!od->is_upper && ovl_path_type(dentry) == OVL_PATH_MERGE) { |
455 | struct inode *inode = file_inode(file); | 456 | struct inode *inode = file_inode(file); |
456 | 457 | ||
457 | realfile = od->upperfile; | 458 | realfile =lockless_dereference(od->upperfile); |
458 | if (!realfile) { | 459 | if (!realfile) { |
459 | struct path upperpath; | 460 | struct path upperpath; |
460 | 461 | ||
461 | ovl_path_upper(dentry, &upperpath); | 462 | ovl_path_upper(dentry, &upperpath); |
462 | realfile = ovl_path_open(&upperpath, O_RDONLY); | 463 | realfile = ovl_path_open(&upperpath, O_RDONLY); |
464 | smp_mb__before_spinlock(); | ||
463 | mutex_lock(&inode->i_mutex); | 465 | mutex_lock(&inode->i_mutex); |
464 | if (!od->upperfile) { | 466 | if (!od->upperfile) { |
465 | if (IS_ERR(realfile)) { | 467 | if (IS_ERR(realfile)) { |
@@ -518,6 +520,7 @@ static int ovl_dir_open(struct inode *inode, struct file *file) | |||
518 | od->realfile = realfile; | 520 | od->realfile = realfile; |
519 | od->is_real = (type != OVL_PATH_MERGE); | 521 | od->is_real = (type != OVL_PATH_MERGE); |
520 | od->is_upper = (type != OVL_PATH_LOWER); | 522 | od->is_upper = (type != OVL_PATH_LOWER); |
523 | od->cursor.is_cursor = true; | ||
521 | file->private_data = od; | 524 | file->private_data = od; |
522 | 525 | ||
523 | return 0; | 526 | return 0; |
@@ -569,7 +572,7 @@ void ovl_cleanup_whiteouts(struct dentry *upper, struct list_head *list) | |||
569 | { | 572 | { |
570 | struct ovl_cache_entry *p; | 573 | struct ovl_cache_entry *p; |
571 | 574 | ||
572 | mutex_lock_nested(&upper->d_inode->i_mutex, I_MUTEX_PARENT); | 575 | mutex_lock_nested(&upper->d_inode->i_mutex, I_MUTEX_CHILD); |
573 | list_for_each_entry(p, list, l_node) { | 576 | list_for_each_entry(p, list, l_node) { |
574 | struct dentry *dentry; | 577 | struct dentry *dentry; |
575 | 578 | ||
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 8b663b2d9562..6b4527216a7f 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
@@ -634,7 +634,7 @@ int dquot_writeback_dquots(struct super_block *sb, int type) | |||
634 | dqstats_inc(DQST_LOOKUPS); | 634 | dqstats_inc(DQST_LOOKUPS); |
635 | err = sb->dq_op->write_dquot(dquot); | 635 | err = sb->dq_op->write_dquot(dquot); |
636 | if (!ret && err) | 636 | if (!ret && err) |
637 | err = ret; | 637 | ret = err; |
638 | dqput(dquot); | 638 | dqput(dquot); |
639 | spin_lock(&dq_list_lock); | 639 | spin_lock(&dq_list_lock); |
640 | } | 640 | } |