aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/compression.c2
-rw-r--r--fs/btrfs/extent-tree.c11
-rw-r--r--fs/btrfs/extent_io.c6
-rw-r--r--fs/btrfs/free-space-cache.c9
-rw-r--r--fs/btrfs/scrub.c4
-rw-r--r--fs/btrfs/transaction.c9
-rw-r--r--fs/btrfs/volumes.c20
-rw-r--r--fs/gfs2/Kconfig7
-rw-r--r--fs/gfs2/aops.c4
-rw-r--r--fs/gfs2/bmap.c6
-rw-r--r--fs/gfs2/dir.c4
-rw-r--r--fs/gfs2/inode.c13
-rw-r--r--fs/gfs2/rgrp.c8
-rw-r--r--fs/gfs2/xattr.c12
-rw-r--r--fs/libfs.c1
-rw-r--r--fs/proc/stat.c34
-rw-r--r--fs/sysfs/dir.c5
-rw-r--r--fs/sysfs/group.c6
18 files changed, 119 insertions, 42 deletions
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index d286b40a5671..86eff48dab78 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -405,6 +405,7 @@ int btrfs_submit_compressed_write(struct inode *inode, u64 start,
405 bio_put(bio); 405 bio_put(bio);
406 406
407 bio = compressed_bio_alloc(bdev, first_byte, GFP_NOFS); 407 bio = compressed_bio_alloc(bdev, first_byte, GFP_NOFS);
408 BUG_ON(!bio);
408 bio->bi_private = cb; 409 bio->bi_private = cb;
409 bio->bi_end_io = end_compressed_bio_write; 410 bio->bi_end_io = end_compressed_bio_write;
410 bio_add_page(bio, page, PAGE_CACHE_SIZE, 0); 411 bio_add_page(bio, page, PAGE_CACHE_SIZE, 0);
@@ -687,6 +688,7 @@ int btrfs_submit_compressed_read(struct inode *inode, struct bio *bio,
687 688
688 comp_bio = compressed_bio_alloc(bdev, cur_disk_byte, 689 comp_bio = compressed_bio_alloc(bdev, cur_disk_byte,
689 GFP_NOFS); 690 GFP_NOFS);
691 BUG_ON(!comp_bio);
690 comp_bio->bi_private = cb; 692 comp_bio->bi_private = cb;
691 comp_bio->bi_end_io = end_compressed_bio_read; 693 comp_bio->bi_end_io = end_compressed_bio_read;
692 694
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index a84420491c11..2b35f8d14bb9 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -529,9 +529,7 @@ static int cache_block_group(struct btrfs_block_group_cache *cache,
529 * allocate blocks for the tree root we can't do the fast caching since 529 * allocate blocks for the tree root we can't do the fast caching since
530 * we likely hold important locks. 530 * we likely hold important locks.
531 */ 531 */
532 if (trans && (!trans->transaction->in_commit) && 532 if (fs_info->mount_opt & BTRFS_MOUNT_SPACE_CACHE) {
533 (root && root != root->fs_info->tree_root) &&
534 btrfs_test_opt(root, SPACE_CACHE)) {
535 ret = load_free_space_cache(fs_info, cache); 533 ret = load_free_space_cache(fs_info, cache);
536 534
537 spin_lock(&cache->lock); 535 spin_lock(&cache->lock);
@@ -3152,15 +3150,14 @@ static void set_avail_alloc_bits(struct btrfs_fs_info *fs_info, u64 flags)
3152/* 3150/*
3153 * returns target flags in extended format or 0 if restripe for this 3151 * returns target flags in extended format or 0 if restripe for this
3154 * chunk_type is not in progress 3152 * chunk_type is not in progress
3153 *
3154 * should be called with either volume_mutex or balance_lock held
3155 */ 3155 */
3156static u64 get_restripe_target(struct btrfs_fs_info *fs_info, u64 flags) 3156static u64 get_restripe_target(struct btrfs_fs_info *fs_info, u64 flags)
3157{ 3157{
3158 struct btrfs_balance_control *bctl = fs_info->balance_ctl; 3158 struct btrfs_balance_control *bctl = fs_info->balance_ctl;
3159 u64 target = 0; 3159 u64 target = 0;
3160 3160
3161 BUG_ON(!mutex_is_locked(&fs_info->volume_mutex) &&
3162 !spin_is_locked(&fs_info->balance_lock));
3163
3164 if (!bctl) 3161 if (!bctl)
3165 return 0; 3162 return 0;
3166 3163
@@ -4205,7 +4202,7 @@ static u64 calc_global_metadata_size(struct btrfs_fs_info *fs_info)
4205 num_bytes += div64_u64(data_used + meta_used, 50); 4202 num_bytes += div64_u64(data_used + meta_used, 50);
4206 4203
4207 if (num_bytes * 3 > meta_used) 4204 if (num_bytes * 3 > meta_used)
4208 num_bytes = div64_u64(meta_used, 3) * 2; 4205 num_bytes = div64_u64(meta_used, 3);
4209 4206
4210 return ALIGN(num_bytes, fs_info->extent_root->leafsize << 10); 4207 return ALIGN(num_bytes, fs_info->extent_root->leafsize << 10);
4211} 4208}
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 8d904dd7ea9f..cd4b5e400221 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1937,7 +1937,7 @@ int repair_eb_io_failure(struct btrfs_root *root, struct extent_buffer *eb,
1937 struct btrfs_mapping_tree *map_tree = &root->fs_info->mapping_tree; 1937 struct btrfs_mapping_tree *map_tree = &root->fs_info->mapping_tree;
1938 u64 start = eb->start; 1938 u64 start = eb->start;
1939 unsigned long i, num_pages = num_extent_pages(eb->start, eb->len); 1939 unsigned long i, num_pages = num_extent_pages(eb->start, eb->len);
1940 int ret; 1940 int ret = 0;
1941 1941
1942 for (i = 0; i < num_pages; i++) { 1942 for (i = 0; i < num_pages; i++) {
1943 struct page *p = extent_buffer_page(eb, i); 1943 struct page *p = extent_buffer_page(eb, i);
@@ -2180,6 +2180,10 @@ static int bio_readpage_error(struct bio *failed_bio, struct page *page,
2180 } 2180 }
2181 2181
2182 bio = bio_alloc(GFP_NOFS, 1); 2182 bio = bio_alloc(GFP_NOFS, 1);
2183 if (!bio) {
2184 free_io_failure(inode, failrec, 0);
2185 return -EIO;
2186 }
2183 bio->bi_private = state; 2187 bio->bi_private = state;
2184 bio->bi_end_io = failed_bio->bi_end_io; 2188 bio->bi_end_io = failed_bio->bi_end_io;
2185 bio->bi_sector = failrec->logical >> 9; 2189 bio->bi_sector = failrec->logical >> 9;
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index e88330d3df52..202008ec367d 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -748,13 +748,6 @@ int load_free_space_cache(struct btrfs_fs_info *fs_info,
748 u64 used = btrfs_block_group_used(&block_group->item); 748 u64 used = btrfs_block_group_used(&block_group->item);
749 749
750 /* 750 /*
751 * If we're unmounting then just return, since this does a search on the
752 * normal root and not the commit root and we could deadlock.
753 */
754 if (btrfs_fs_closing(fs_info))
755 return 0;
756
757 /*
758 * If this block group has been marked to be cleared for one reason or 751 * If this block group has been marked to be cleared for one reason or
759 * another then we can't trust the on disk cache, so just return. 752 * another then we can't trust the on disk cache, so just return.
760 */ 753 */
@@ -768,6 +761,8 @@ int load_free_space_cache(struct btrfs_fs_info *fs_info,
768 path = btrfs_alloc_path(); 761 path = btrfs_alloc_path();
769 if (!path) 762 if (!path)
770 return 0; 763 return 0;
764 path->search_commit_root = 1;
765 path->skip_locking = 1;
771 766
772 inode = lookup_free_space_inode(root, block_group, path); 767 inode = lookup_free_space_inode(root, block_group, path);
773 if (IS_ERR(inode)) { 768 if (IS_ERR(inode)) {
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index 90acc82046c3..bc015f77f3ea 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -1044,6 +1044,8 @@ static int scrub_recheck_block(struct btrfs_fs_info *fs_info,
1044 1044
1045 BUG_ON(!page->page); 1045 BUG_ON(!page->page);
1046 bio = bio_alloc(GFP_NOFS, 1); 1046 bio = bio_alloc(GFP_NOFS, 1);
1047 if (!bio)
1048 return -EIO;
1047 bio->bi_bdev = page->bdev; 1049 bio->bi_bdev = page->bdev;
1048 bio->bi_sector = page->physical >> 9; 1050 bio->bi_sector = page->physical >> 9;
1049 bio->bi_end_io = scrub_complete_bio_end_io; 1051 bio->bi_end_io = scrub_complete_bio_end_io;
@@ -1171,6 +1173,8 @@ static int scrub_repair_page_from_good_copy(struct scrub_block *sblock_bad,
1171 DECLARE_COMPLETION_ONSTACK(complete); 1173 DECLARE_COMPLETION_ONSTACK(complete);
1172 1174
1173 bio = bio_alloc(GFP_NOFS, 1); 1175 bio = bio_alloc(GFP_NOFS, 1);
1176 if (!bio)
1177 return -EIO;
1174 bio->bi_bdev = page_bad->bdev; 1178 bio->bi_bdev = page_bad->bdev;
1175 bio->bi_sector = page_bad->physical >> 9; 1179 bio->bi_sector = page_bad->physical >> 9;
1176 bio->bi_end_io = scrub_complete_bio_end_io; 1180 bio->bi_end_io = scrub_complete_bio_end_io;
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 8da29e8e4de1..11b77a59db62 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -480,6 +480,7 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
480 struct btrfs_transaction *cur_trans = trans->transaction; 480 struct btrfs_transaction *cur_trans = trans->transaction;
481 struct btrfs_fs_info *info = root->fs_info; 481 struct btrfs_fs_info *info = root->fs_info;
482 int count = 0; 482 int count = 0;
483 int err = 0;
483 484
484 if (--trans->use_count) { 485 if (--trans->use_count) {
485 trans->block_rsv = trans->orig_rsv; 486 trans->block_rsv = trans->orig_rsv;
@@ -532,18 +533,18 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
532 533
533 if (current->journal_info == trans) 534 if (current->journal_info == trans)
534 current->journal_info = NULL; 535 current->journal_info = NULL;
535 memset(trans, 0, sizeof(*trans));
536 kmem_cache_free(btrfs_trans_handle_cachep, trans);
537 536
538 if (throttle) 537 if (throttle)
539 btrfs_run_delayed_iputs(root); 538 btrfs_run_delayed_iputs(root);
540 539
541 if (trans->aborted || 540 if (trans->aborted ||
542 root->fs_info->fs_state & BTRFS_SUPER_FLAG_ERROR) { 541 root->fs_info->fs_state & BTRFS_SUPER_FLAG_ERROR) {
543 return -EIO; 542 err = -EIO;
544 } 543 }
545 544
546 return 0; 545 memset(trans, 0, sizeof(*trans));
546 kmem_cache_free(btrfs_trans_handle_cachep, trans);
547 return err;
547} 548}
548 549
549int btrfs_end_transaction(struct btrfs_trans_handle *trans, 550int btrfs_end_transaction(struct btrfs_trans_handle *trans,
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index a872b48be0ae..759d02486d7c 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -3833,6 +3833,7 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw,
3833 int sub_stripes = 0; 3833 int sub_stripes = 0;
3834 u64 stripes_per_dev = 0; 3834 u64 stripes_per_dev = 0;
3835 u32 remaining_stripes = 0; 3835 u32 remaining_stripes = 0;
3836 u32 last_stripe = 0;
3836 3837
3837 if (map->type & 3838 if (map->type &
3838 (BTRFS_BLOCK_GROUP_RAID0 | BTRFS_BLOCK_GROUP_RAID10)) { 3839 (BTRFS_BLOCK_GROUP_RAID0 | BTRFS_BLOCK_GROUP_RAID10)) {
@@ -3846,6 +3847,8 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw,
3846 stripe_nr_orig, 3847 stripe_nr_orig,
3847 factor, 3848 factor,
3848 &remaining_stripes); 3849 &remaining_stripes);
3850 div_u64_rem(stripe_nr_end - 1, factor, &last_stripe);
3851 last_stripe *= sub_stripes;
3849 } 3852 }
3850 3853
3851 for (i = 0; i < num_stripes; i++) { 3854 for (i = 0; i < num_stripes; i++) {
@@ -3858,16 +3861,29 @@ static int __btrfs_map_block(struct btrfs_mapping_tree *map_tree, int rw,
3858 BTRFS_BLOCK_GROUP_RAID10)) { 3861 BTRFS_BLOCK_GROUP_RAID10)) {
3859 bbio->stripes[i].length = stripes_per_dev * 3862 bbio->stripes[i].length = stripes_per_dev *
3860 map->stripe_len; 3863 map->stripe_len;
3864
3861 if (i / sub_stripes < remaining_stripes) 3865 if (i / sub_stripes < remaining_stripes)
3862 bbio->stripes[i].length += 3866 bbio->stripes[i].length +=
3863 map->stripe_len; 3867 map->stripe_len;
3868
3869 /*
3870 * Special for the first stripe and
3871 * the last stripe:
3872 *
3873 * |-------|...|-------|
3874 * |----------|
3875 * off end_off
3876 */
3864 if (i < sub_stripes) 3877 if (i < sub_stripes)
3865 bbio->stripes[i].length -= 3878 bbio->stripes[i].length -=
3866 stripe_offset; 3879 stripe_offset;
3867 if ((i / sub_stripes + 1) % 3880
3868 sub_stripes == remaining_stripes) 3881 if (stripe_index >= last_stripe &&
3882 stripe_index <= (last_stripe +
3883 sub_stripes - 1))
3869 bbio->stripes[i].length -= 3884 bbio->stripes[i].length -=
3870 stripe_end_offset; 3885 stripe_end_offset;
3886
3871 if (i == sub_stripes - 1) 3887 if (i == sub_stripes - 1)
3872 stripe_offset = 0; 3888 stripe_offset = 0;
3873 } else 3889 } else
diff --git a/fs/gfs2/Kconfig b/fs/gfs2/Kconfig
index c465ae066c62..eb08c9e43c2a 100644
--- a/fs/gfs2/Kconfig
+++ b/fs/gfs2/Kconfig
@@ -1,10 +1,6 @@
1config GFS2_FS 1config GFS2_FS
2 tristate "GFS2 file system support" 2 tristate "GFS2 file system support"
3 depends on (64BIT || LBDAF) 3 depends on (64BIT || LBDAF)
4 select DLM if GFS2_FS_LOCKING_DLM
5 select CONFIGFS_FS if GFS2_FS_LOCKING_DLM
6 select SYSFS if GFS2_FS_LOCKING_DLM
7 select IP_SCTP if DLM_SCTP
8 select FS_POSIX_ACL 4 select FS_POSIX_ACL
9 select CRC32 5 select CRC32
10 select QUOTACTL 6 select QUOTACTL
@@ -29,7 +25,8 @@ config GFS2_FS
29 25
30config GFS2_FS_LOCKING_DLM 26config GFS2_FS_LOCKING_DLM
31 bool "GFS2 DLM locking" 27 bool "GFS2 DLM locking"
32 depends on (GFS2_FS!=n) && NET && INET && (IPV6 || IPV6=n) && HOTPLUG 28 depends on (GFS2_FS!=n) && NET && INET && (IPV6 || IPV6=n) && \
29 HOTPLUG && DLM && CONFIGFS_FS && SYSFS
33 help 30 help
34 Multiple node locking module for GFS2 31 Multiple node locking module for GFS2
35 32
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
index 38b7a74a0f91..9b2ff0e851b1 100644
--- a/fs/gfs2/aops.c
+++ b/fs/gfs2/aops.c
@@ -807,7 +807,7 @@ static int gfs2_stuffed_write_end(struct inode *inode, struct buffer_head *dibh,
807 807
808 if (inode == sdp->sd_rindex) { 808 if (inode == sdp->sd_rindex) {
809 adjust_fs_space(inode); 809 adjust_fs_space(inode);
810 ip->i_gh.gh_flags |= GL_NOCACHE; 810 sdp->sd_rindex_uptodate = 0;
811 } 811 }
812 812
813 brelse(dibh); 813 brelse(dibh);
@@ -873,7 +873,7 @@ static int gfs2_write_end(struct file *file, struct address_space *mapping,
873 873
874 if (inode == sdp->sd_rindex) { 874 if (inode == sdp->sd_rindex) {
875 adjust_fs_space(inode); 875 adjust_fs_space(inode);
876 ip->i_gh.gh_flags |= GL_NOCACHE; 876 sdp->sd_rindex_uptodate = 0;
877 } 877 }
878 878
879 brelse(dibh); 879 brelse(dibh);
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 197c5c47e577..03c04febe26f 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -724,7 +724,11 @@ static int do_strip(struct gfs2_inode *ip, struct buffer_head *dibh,
724 int metadata; 724 int metadata;
725 unsigned int revokes = 0; 725 unsigned int revokes = 0;
726 int x; 726 int x;
727 int error = 0; 727 int error;
728
729 error = gfs2_rindex_update(sdp);
730 if (error)
731 return error;
728 732
729 if (!*top) 733 if (!*top)
730 sm->sm_first = 0; 734 sm->sm_first = 0;
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index c35573abd371..a836056343f0 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -1844,6 +1844,10 @@ static int leaf_dealloc(struct gfs2_inode *dip, u32 index, u32 len,
1844 unsigned int x, size = len * sizeof(u64); 1844 unsigned int x, size = len * sizeof(u64);
1845 int error; 1845 int error;
1846 1846
1847 error = gfs2_rindex_update(sdp);
1848 if (error)
1849 return error;
1850
1847 memset(&rlist, 0, sizeof(struct gfs2_rgrp_list)); 1851 memset(&rlist, 0, sizeof(struct gfs2_rgrp_list));
1848 1852
1849 ht = kzalloc(size, GFP_NOFS); 1853 ht = kzalloc(size, GFP_NOFS);
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index c98a60ee6dfd..a9ba2444e077 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -1031,7 +1031,13 @@ static int gfs2_unlink(struct inode *dir, struct dentry *dentry)
1031 struct buffer_head *bh; 1031 struct buffer_head *bh;
1032 struct gfs2_holder ghs[3]; 1032 struct gfs2_holder ghs[3];
1033 struct gfs2_rgrpd *rgd; 1033 struct gfs2_rgrpd *rgd;
1034 int error = -EROFS; 1034 int error;
1035
1036 error = gfs2_rindex_update(sdp);
1037 if (error)
1038 return error;
1039
1040 error = -EROFS;
1035 1041
1036 gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs); 1042 gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs);
1037 gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + 1); 1043 gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + 1);
@@ -1224,6 +1230,10 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
1224 return 0; 1230 return 0;
1225 } 1231 }
1226 1232
1233 error = gfs2_rindex_update(sdp);
1234 if (error)
1235 return error;
1236
1227 if (odip != ndip) { 1237 if (odip != ndip) {
1228 error = gfs2_glock_nq_init(sdp->sd_rename_gl, LM_ST_EXCLUSIVE, 1238 error = gfs2_glock_nq_init(sdp->sd_rename_gl, LM_ST_EXCLUSIVE,
1229 0, &r_gh); 1239 0, &r_gh);
@@ -1345,7 +1355,6 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
1345 error = alloc_required; 1355 error = alloc_required;
1346 if (error < 0) 1356 if (error < 0)
1347 goto out_gunlock; 1357 goto out_gunlock;
1348 error = 0;
1349 1358
1350 if (alloc_required) { 1359 if (alloc_required) {
1351 struct gfs2_qadata *qa = gfs2_qadata_get(ndip); 1360 struct gfs2_qadata *qa = gfs2_qadata_get(ndip);
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 19bde40b4864..3df65c9ab73b 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -332,9 +332,6 @@ struct gfs2_rgrpd *gfs2_blk2rgrpd(struct gfs2_sbd *sdp, u64 blk, bool exact)
332 struct rb_node *n, *next; 332 struct rb_node *n, *next;
333 struct gfs2_rgrpd *cur; 333 struct gfs2_rgrpd *cur;
334 334
335 if (gfs2_rindex_update(sdp))
336 return NULL;
337
338 spin_lock(&sdp->sd_rindex_spin); 335 spin_lock(&sdp->sd_rindex_spin);
339 n = sdp->sd_rindex_tree.rb_node; 336 n = sdp->sd_rindex_tree.rb_node;
340 while (n) { 337 while (n) {
@@ -640,6 +637,7 @@ static int read_rindex_entry(struct gfs2_inode *ip,
640 return 0; 637 return 0;
641 638
642 error = 0; /* someone else read in the rgrp; free it and ignore it */ 639 error = 0; /* someone else read in the rgrp; free it and ignore it */
640 gfs2_glock_put(rgd->rd_gl);
643 641
644fail: 642fail:
645 kfree(rgd->rd_bits); 643 kfree(rgd->rd_bits);
@@ -927,6 +925,10 @@ int gfs2_fitrim(struct file *filp, void __user *argp)
927 } else if (copy_from_user(&r, argp, sizeof(r))) 925 } else if (copy_from_user(&r, argp, sizeof(r)))
928 return -EFAULT; 926 return -EFAULT;
929 927
928 ret = gfs2_rindex_update(sdp);
929 if (ret)
930 return ret;
931
930 rgd = gfs2_blk2rgrpd(sdp, r.start, 0); 932 rgd = gfs2_blk2rgrpd(sdp, r.start, 0);
931 rgd_end = gfs2_blk2rgrpd(sdp, r.start + r.len, 0); 933 rgd_end = gfs2_blk2rgrpd(sdp, r.start + r.len, 0);
932 934
diff --git a/fs/gfs2/xattr.c b/fs/gfs2/xattr.c
index 2e5ba425cae7..927f4df874ae 100644
--- a/fs/gfs2/xattr.c
+++ b/fs/gfs2/xattr.c
@@ -238,6 +238,10 @@ static int ea_dealloc_unstuffed(struct gfs2_inode *ip, struct buffer_head *bh,
238 unsigned int x; 238 unsigned int x;
239 int error; 239 int error;
240 240
241 error = gfs2_rindex_update(sdp);
242 if (error)
243 return error;
244
241 if (GFS2_EA_IS_STUFFED(ea)) 245 if (GFS2_EA_IS_STUFFED(ea))
242 return 0; 246 return 0;
243 247
@@ -1330,6 +1334,10 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip)
1330 unsigned int x; 1334 unsigned int x;
1331 int error; 1335 int error;
1332 1336
1337 error = gfs2_rindex_update(sdp);
1338 if (error)
1339 return error;
1340
1333 memset(&rlist, 0, sizeof(struct gfs2_rgrp_list)); 1341 memset(&rlist, 0, sizeof(struct gfs2_rgrp_list));
1334 1342
1335 error = gfs2_meta_read(ip->i_gl, ip->i_eattr, DIO_WAIT, &indbh); 1343 error = gfs2_meta_read(ip->i_gl, ip->i_eattr, DIO_WAIT, &indbh);
@@ -1439,6 +1447,10 @@ static int ea_dealloc_block(struct gfs2_inode *ip)
1439 struct gfs2_holder gh; 1447 struct gfs2_holder gh;
1440 int error; 1448 int error;
1441 1449
1450 error = gfs2_rindex_update(sdp);
1451 if (error)
1452 return error;
1453
1442 rgd = gfs2_blk2rgrpd(sdp, ip->i_eattr, 1); 1454 rgd = gfs2_blk2rgrpd(sdp, ip->i_eattr, 1);
1443 if (!rgd) { 1455 if (!rgd) {
1444 gfs2_consist_inode(ip); 1456 gfs2_consist_inode(ip);
diff --git a/fs/libfs.c b/fs/libfs.c
index 358094f0433d..18d08f5db53a 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -529,6 +529,7 @@ int simple_fill_super(struct super_block *s, unsigned long magic,
529 return 0; 529 return 0;
530out: 530out:
531 d_genocide(root); 531 d_genocide(root);
532 shrink_dcache_parent(root);
532 dput(root); 533 dput(root);
533 return -ENOMEM; 534 return -ENOMEM;
534} 535}
diff --git a/fs/proc/stat.c b/fs/proc/stat.c
index 6a0c62d6e442..64c3b3172367 100644
--- a/fs/proc/stat.c
+++ b/fs/proc/stat.c
@@ -18,19 +18,39 @@
18#ifndef arch_irq_stat 18#ifndef arch_irq_stat
19#define arch_irq_stat() 0 19#define arch_irq_stat() 0
20#endif 20#endif
21#ifndef arch_idle_time 21
22#define arch_idle_time(cpu) 0 22#ifdef arch_idle_time
23#endif 23
24static cputime64_t get_idle_time(int cpu)
25{
26 cputime64_t idle;
27
28 idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE];
29 if (cpu_online(cpu) && !nr_iowait_cpu(cpu))
30 idle += arch_idle_time(cpu);
31 return idle;
32}
33
34static cputime64_t get_iowait_time(int cpu)
35{
36 cputime64_t iowait;
37
38 iowait = kcpustat_cpu(cpu).cpustat[CPUTIME_IOWAIT];
39 if (cpu_online(cpu) && nr_iowait_cpu(cpu))
40 iowait += arch_idle_time(cpu);
41 return iowait;
42}
43
44#else
24 45
25static u64 get_idle_time(int cpu) 46static u64 get_idle_time(int cpu)
26{ 47{
27 u64 idle, idle_time = get_cpu_idle_time_us(cpu, NULL); 48 u64 idle, idle_time = get_cpu_idle_time_us(cpu, NULL);
28 49
29 if (idle_time == -1ULL) { 50 if (idle_time == -1ULL)
30 /* !NO_HZ so we can rely on cpustat.idle */ 51 /* !NO_HZ so we can rely on cpustat.idle */
31 idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE]; 52 idle = kcpustat_cpu(cpu).cpustat[CPUTIME_IDLE];
32 idle += arch_idle_time(cpu); 53 else
33 } else
34 idle = usecs_to_cputime64(idle_time); 54 idle = usecs_to_cputime64(idle_time);
35 55
36 return idle; 56 return idle;
@@ -49,6 +69,8 @@ static u64 get_iowait_time(int cpu)
49 return iowait; 69 return iowait;
50} 70}
51 71
72#endif
73
52static int show_stat(struct seq_file *p, void *v) 74static int show_stat(struct seq_file *p, void *v)
53{ 75{
54 int i, j; 76 int i, j;
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 2a7a3f5d1ca6..35a36d39fa2c 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -729,6 +729,9 @@ int sysfs_create_dir(struct kobject * kobj)
729 else 729 else
730 parent_sd = &sysfs_root; 730 parent_sd = &sysfs_root;
731 731
732 if (!parent_sd)
733 return -ENOENT;
734
732 if (sysfs_ns_type(parent_sd)) 735 if (sysfs_ns_type(parent_sd))
733 ns = kobj->ktype->namespace(kobj); 736 ns = kobj->ktype->namespace(kobj);
734 type = sysfs_read_ns_type(kobj); 737 type = sysfs_read_ns_type(kobj);
@@ -878,7 +881,6 @@ int sysfs_rename(struct sysfs_dirent *sd,
878 881
879 dup_name = sd->s_name; 882 dup_name = sd->s_name;
880 sd->s_name = new_name; 883 sd->s_name = new_name;
881 sd->s_hash = sysfs_name_hash(sd->s_ns, sd->s_name);
882 } 884 }
883 885
884 /* Move to the appropriate place in the appropriate directories rbtree. */ 886 /* Move to the appropriate place in the appropriate directories rbtree. */
@@ -886,6 +888,7 @@ int sysfs_rename(struct sysfs_dirent *sd,
886 sysfs_get(new_parent_sd); 888 sysfs_get(new_parent_sd);
887 sysfs_put(sd->s_parent); 889 sysfs_put(sd->s_parent);
888 sd->s_ns = new_ns; 890 sd->s_ns = new_ns;
891 sd->s_hash = sysfs_name_hash(sd->s_ns, sd->s_name);
889 sd->s_parent = new_parent_sd; 892 sd->s_parent = new_parent_sd;
890 sysfs_link_sibling(sd); 893 sysfs_link_sibling(sd);
891 894
diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c
index dd1701caecc9..2df555c66d57 100644
--- a/fs/sysfs/group.c
+++ b/fs/sysfs/group.c
@@ -67,7 +67,11 @@ static int internal_create_group(struct kobject *kobj, int update,
67 /* Updates may happen before the object has been instantiated */ 67 /* Updates may happen before the object has been instantiated */
68 if (unlikely(update && !kobj->sd)) 68 if (unlikely(update && !kobj->sd))
69 return -EINVAL; 69 return -EINVAL;
70 70 if (!grp->attrs) {
71 WARN(1, "sysfs: attrs not set by subsystem for group: %s/%s\n",
72 kobj->name, grp->name ? "" : grp->name);
73 return -EINVAL;
74 }
71 if (grp->name) { 75 if (grp->name) {
72 error = sysfs_create_subdir(kobj, grp->name, &sd); 76 error = sysfs_create_subdir(kobj, grp->name, &sd);
73 if (error) 77 if (error)