aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2012-04-19 16:06:26 -0400
committerMarcelo Tosatti <mtosatti@redhat.com>2012-04-19 16:06:26 -0400
commiteac0556750e727ff39144a9a9e59d5ccf1fc0e2a (patch)
treef5ccff7795b2ad5e47f17fb475599c526f533e79 /fs
parentf71fa31f9f7ac33cba12b8897983f950ad2c7a5b (diff)
parent19853301ef3289bda2d5264c1093e74efddaeab9 (diff)
Merge branch 'linus' into queue
Merge reason: development work has dependency on kvm patches merged upstream. Conflicts: Documentation/feature-removal-schedule.txt Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/compression.c2
-rw-r--r--fs/btrfs/ctree.h2
-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/cifs/connect.c82
-rw-r--r--fs/ext4/ext4.h3
-rw-r--r--fs/ext4/extents.c6
-rw-r--r--fs/ext4/super.c48
-rw-r--r--fs/fuse/dir.c25
-rw-r--r--fs/fuse/file.c129
-rw-r--r--fs/fuse/inode.c1
-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/lockd/clnt4xdr.c2
-rw-r--r--fs/lockd/clntxdr.c2
-rw-r--r--fs/nfsd/nfs3xdr.c22
-rw-r--r--fs/nfsd/nfs4proc.c7
-rw-r--r--fs/nfsd/nfs4state.c23
-rw-r--r--fs/nfsd/nfs4xdr.c4
-rw-r--r--fs/ocfs2/alloc.c2
-rw-r--r--fs/ocfs2/refcounttree.c12
-rw-r--r--fs/ocfs2/suballoc.c4
-rw-r--r--fs/proc/stat.c34
-rw-r--r--fs/sysfs/dir.c5
-rw-r--r--fs/sysfs/group.c6
35 files changed, 318 insertions, 217 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/ctree.h b/fs/btrfs/ctree.h
index 5b8ef8eb3521..3f65a812e282 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2166,7 +2166,7 @@ BTRFS_SETGET_STACK_FUNCS(root_last_snapshot, struct btrfs_root_item,
2166 2166
2167static inline bool btrfs_root_readonly(struct btrfs_root *root) 2167static inline bool btrfs_root_readonly(struct btrfs_root *root)
2168{ 2168{
2169 return root->root_item.flags & BTRFS_ROOT_SUBVOL_RDONLY; 2169 return (root->root_item.flags & cpu_to_le64(BTRFS_ROOT_SUBVOL_RDONLY)) != 0;
2170} 2170}
2171 2171
2172/* struct btrfs_root_backup */ 2172/* struct btrfs_root_backup */
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/cifs/connect.c b/fs/cifs/connect.c
index d81e933a796b..f31dc9ac37b7 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -109,6 +109,8 @@ enum {
109 109
110 /* Options which could be blank */ 110 /* Options which could be blank */
111 Opt_blank_pass, 111 Opt_blank_pass,
112 Opt_blank_user,
113 Opt_blank_ip,
112 114
113 Opt_err 115 Opt_err
114}; 116};
@@ -183,11 +185,15 @@ static const match_table_t cifs_mount_option_tokens = {
183 { Opt_wsize, "wsize=%s" }, 185 { Opt_wsize, "wsize=%s" },
184 { Opt_actimeo, "actimeo=%s" }, 186 { Opt_actimeo, "actimeo=%s" },
185 187
188 { Opt_blank_user, "user=" },
189 { Opt_blank_user, "username=" },
186 { Opt_user, "user=%s" }, 190 { Opt_user, "user=%s" },
187 { Opt_user, "username=%s" }, 191 { Opt_user, "username=%s" },
188 { Opt_blank_pass, "pass=" }, 192 { Opt_blank_pass, "pass=" },
189 { Opt_pass, "pass=%s" }, 193 { Opt_pass, "pass=%s" },
190 { Opt_pass, "password=%s" }, 194 { Opt_pass, "password=%s" },
195 { Opt_blank_ip, "ip=" },
196 { Opt_blank_ip, "addr=" },
191 { Opt_ip, "ip=%s" }, 197 { Opt_ip, "ip=%s" },
192 { Opt_ip, "addr=%s" }, 198 { Opt_ip, "addr=%s" },
193 { Opt_unc, "unc=%s" }, 199 { Opt_unc, "unc=%s" },
@@ -1117,7 +1123,7 @@ static int get_option_ul(substring_t args[], unsigned long *option)
1117 string = match_strdup(args); 1123 string = match_strdup(args);
1118 if (string == NULL) 1124 if (string == NULL)
1119 return -ENOMEM; 1125 return -ENOMEM;
1120 rc = kstrtoul(string, 10, option); 1126 rc = kstrtoul(string, 0, option);
1121 kfree(string); 1127 kfree(string);
1122 1128
1123 return rc; 1129 return rc;
@@ -1534,15 +1540,17 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1534 1540
1535 /* String Arguments */ 1541 /* String Arguments */
1536 1542
1543 case Opt_blank_user:
1544 /* null user, ie. anonymous authentication */
1545 vol->nullauth = 1;
1546 vol->username = NULL;
1547 break;
1537 case Opt_user: 1548 case Opt_user:
1538 string = match_strdup(args); 1549 string = match_strdup(args);
1539 if (string == NULL) 1550 if (string == NULL)
1540 goto out_nomem; 1551 goto out_nomem;
1541 1552
1542 if (!*string) { 1553 if (strnlen(string, MAX_USERNAME_SIZE) >
1543 /* null user, ie. anonymous authentication */
1544 vol->nullauth = 1;
1545 } else if (strnlen(string, MAX_USERNAME_SIZE) >
1546 MAX_USERNAME_SIZE) { 1554 MAX_USERNAME_SIZE) {
1547 printk(KERN_WARNING "CIFS: username too long\n"); 1555 printk(KERN_WARNING "CIFS: username too long\n");
1548 goto cifs_parse_mount_err; 1556 goto cifs_parse_mount_err;
@@ -1611,14 +1619,15 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1611 } 1619 }
1612 vol->password[j] = '\0'; 1620 vol->password[j] = '\0';
1613 break; 1621 break;
1622 case Opt_blank_ip:
1623 vol->UNCip = NULL;
1624 break;
1614 case Opt_ip: 1625 case Opt_ip:
1615 string = match_strdup(args); 1626 string = match_strdup(args);
1616 if (string == NULL) 1627 if (string == NULL)
1617 goto out_nomem; 1628 goto out_nomem;
1618 1629
1619 if (!*string) { 1630 if (strnlen(string, INET6_ADDRSTRLEN) >
1620 vol->UNCip = NULL;
1621 } else if (strnlen(string, INET6_ADDRSTRLEN) >
1622 INET6_ADDRSTRLEN) { 1631 INET6_ADDRSTRLEN) {
1623 printk(KERN_WARNING "CIFS: ip address " 1632 printk(KERN_WARNING "CIFS: ip address "
1624 "too long\n"); 1633 "too long\n");
@@ -1636,12 +1645,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1636 if (string == NULL) 1645 if (string == NULL)
1637 goto out_nomem; 1646 goto out_nomem;
1638 1647
1639 if (!*string) {
1640 printk(KERN_WARNING "CIFS: invalid path to "
1641 "network resource\n");
1642 goto cifs_parse_mount_err;
1643 }
1644
1645 temp_len = strnlen(string, 300); 1648 temp_len = strnlen(string, 300);
1646 if (temp_len == 300) { 1649 if (temp_len == 300) {
1647 printk(KERN_WARNING "CIFS: UNC name too long\n"); 1650 printk(KERN_WARNING "CIFS: UNC name too long\n");
@@ -1670,11 +1673,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1670 if (string == NULL) 1673 if (string == NULL)
1671 goto out_nomem; 1674 goto out_nomem;
1672 1675
1673 if (!*string) { 1676 if (strnlen(string, 256) == 256) {
1674 printk(KERN_WARNING "CIFS: invalid domain"
1675 " name\n");
1676 goto cifs_parse_mount_err;
1677 } else if (strnlen(string, 256) == 256) {
1678 printk(KERN_WARNING "CIFS: domain name too" 1677 printk(KERN_WARNING "CIFS: domain name too"
1679 " long\n"); 1678 " long\n");
1680 goto cifs_parse_mount_err; 1679 goto cifs_parse_mount_err;
@@ -1693,11 +1692,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1693 if (string == NULL) 1692 if (string == NULL)
1694 goto out_nomem; 1693 goto out_nomem;
1695 1694
1696 if (!*string) { 1695 if (!cifs_convert_address(
1697 printk(KERN_WARNING "CIFS: srcaddr value not"
1698 " specified\n");
1699 goto cifs_parse_mount_err;
1700 } else if (!cifs_convert_address(
1701 (struct sockaddr *)&vol->srcaddr, 1696 (struct sockaddr *)&vol->srcaddr,
1702 string, strlen(string))) { 1697 string, strlen(string))) {
1703 printk(KERN_WARNING "CIFS: Could not parse" 1698 printk(KERN_WARNING "CIFS: Could not parse"
@@ -1710,11 +1705,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1710 if (string == NULL) 1705 if (string == NULL)
1711 goto out_nomem; 1706 goto out_nomem;
1712 1707
1713 if (!*string) {
1714 printk(KERN_WARNING "CIFS: Invalid path"
1715 " prefix\n");
1716 goto cifs_parse_mount_err;
1717 }
1718 temp_len = strnlen(string, 1024); 1708 temp_len = strnlen(string, 1024);
1719 if (string[0] != '/') 1709 if (string[0] != '/')
1720 temp_len++; /* missing leading slash */ 1710 temp_len++; /* missing leading slash */
@@ -1742,11 +1732,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1742 if (string == NULL) 1732 if (string == NULL)
1743 goto out_nomem; 1733 goto out_nomem;
1744 1734
1745 if (!*string) { 1735 if (strnlen(string, 1024) >= 65) {
1746 printk(KERN_WARNING "CIFS: Invalid iocharset"
1747 " specified\n");
1748 goto cifs_parse_mount_err;
1749 } else if (strnlen(string, 1024) >= 65) {
1750 printk(KERN_WARNING "CIFS: iocharset name " 1736 printk(KERN_WARNING "CIFS: iocharset name "
1751 "too long.\n"); 1737 "too long.\n");
1752 goto cifs_parse_mount_err; 1738 goto cifs_parse_mount_err;
@@ -1771,11 +1757,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1771 if (string == NULL) 1757 if (string == NULL)
1772 goto out_nomem; 1758 goto out_nomem;
1773 1759
1774 if (!*string) {
1775 printk(KERN_WARNING "CIFS: No socket option"
1776 " specified\n");
1777 goto cifs_parse_mount_err;
1778 }
1779 if (strnicmp(string, "TCP_NODELAY", 11) == 0) 1760 if (strnicmp(string, "TCP_NODELAY", 11) == 0)
1780 vol->sockopt_tcp_nodelay = 1; 1761 vol->sockopt_tcp_nodelay = 1;
1781 break; 1762 break;
@@ -1784,12 +1765,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1784 if (string == NULL) 1765 if (string == NULL)
1785 goto out_nomem; 1766 goto out_nomem;
1786 1767
1787 if (!*string) {
1788 printk(KERN_WARNING "CIFS: Invalid (empty)"
1789 " netbiosname\n");
1790 break;
1791 }
1792
1793 memset(vol->source_rfc1001_name, 0x20, 1768 memset(vol->source_rfc1001_name, 0x20,
1794 RFC1001_NAME_LEN); 1769 RFC1001_NAME_LEN);
1795 /* 1770 /*
@@ -1817,11 +1792,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1817 if (string == NULL) 1792 if (string == NULL)
1818 goto out_nomem; 1793 goto out_nomem;
1819 1794
1820 if (!*string) {
1821 printk(KERN_WARNING "CIFS: Empty server"
1822 " netbiosname specified\n");
1823 break;
1824 }
1825 /* last byte, type, is 0x20 for servr type */ 1795 /* last byte, type, is 0x20 for servr type */
1826 memset(vol->target_rfc1001_name, 0x20, 1796 memset(vol->target_rfc1001_name, 0x20,
1827 RFC1001_NAME_LEN_WITH_NULL); 1797 RFC1001_NAME_LEN_WITH_NULL);
@@ -1848,12 +1818,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1848 if (string == NULL) 1818 if (string == NULL)
1849 goto out_nomem; 1819 goto out_nomem;
1850 1820
1851 if (!*string) {
1852 cERROR(1, "no protocol version specified"
1853 " after vers= mount option");
1854 goto cifs_parse_mount_err;
1855 }
1856
1857 if (strnicmp(string, "cifs", 4) == 0 || 1821 if (strnicmp(string, "cifs", 4) == 0 ||
1858 strnicmp(string, "1", 1) == 0) { 1822 strnicmp(string, "1", 1) == 0) {
1859 /* This is the default */ 1823 /* This is the default */
@@ -1868,12 +1832,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
1868 if (string == NULL) 1832 if (string == NULL)
1869 goto out_nomem; 1833 goto out_nomem;
1870 1834
1871 if (!*string) {
1872 printk(KERN_WARNING "CIFS: no security flavor"
1873 " specified\n");
1874 break;
1875 }
1876
1877 if (cifs_parse_security_flavors(string, vol) != 0) 1835 if (cifs_parse_security_flavors(string, vol) != 0)
1878 goto cifs_parse_mount_err; 1836 goto cifs_parse_mount_err;
1879 break; 1837 break;
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index ab2594a30f86..0e01e90add8b 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1203,9 +1203,6 @@ struct ext4_sb_info {
1203 unsigned long s_ext_blocks; 1203 unsigned long s_ext_blocks;
1204 unsigned long s_ext_extents; 1204 unsigned long s_ext_extents;
1205#endif 1205#endif
1206 /* ext4 extent cache stats */
1207 unsigned long extent_cache_hits;
1208 unsigned long extent_cache_misses;
1209 1206
1210 /* for buddy allocator */ 1207 /* for buddy allocator */
1211 struct ext4_group_info ***s_group_info; 1208 struct ext4_group_info ***s_group_info;
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 1421938e6792..abcdeab67f52 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -2066,10 +2066,6 @@ static int ext4_ext_check_cache(struct inode *inode, ext4_lblk_t block,
2066 ret = 1; 2066 ret = 1;
2067 } 2067 }
2068errout: 2068errout:
2069 if (!ret)
2070 sbi->extent_cache_misses++;
2071 else
2072 sbi->extent_cache_hits++;
2073 trace_ext4_ext_in_cache(inode, block, ret); 2069 trace_ext4_ext_in_cache(inode, block, ret);
2074 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); 2070 spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
2075 return ret; 2071 return ret;
@@ -2882,7 +2878,7 @@ static int ext4_split_extent_at(handle_t *handle,
2882 if (err) 2878 if (err)
2883 goto fix_extent_len; 2879 goto fix_extent_len;
2884 /* update the extent length and mark as initialized */ 2880 /* update the extent length and mark as initialized */
2885 ex->ee_len = cpu_to_le32(ee_len); 2881 ex->ee_len = cpu_to_le16(ee_len);
2886 ext4_ext_try_to_merge(inode, path, ex); 2882 ext4_ext_try_to_merge(inode, path, ex);
2887 err = ext4_ext_dirty(handle, inode, path + depth); 2883 err = ext4_ext_dirty(handle, inode, path + depth);
2888 goto out; 2884 goto out;
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index ceebaf853beb..6da193564e43 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1305,20 +1305,20 @@ static int set_qf_name(struct super_block *sb, int qtype, substring_t *args)
1305 ext4_msg(sb, KERN_ERR, 1305 ext4_msg(sb, KERN_ERR,
1306 "Cannot change journaled " 1306 "Cannot change journaled "
1307 "quota options when quota turned on"); 1307 "quota options when quota turned on");
1308 return 0; 1308 return -1;
1309 } 1309 }
1310 qname = match_strdup(args); 1310 qname = match_strdup(args);
1311 if (!qname) { 1311 if (!qname) {
1312 ext4_msg(sb, KERN_ERR, 1312 ext4_msg(sb, KERN_ERR,
1313 "Not enough memory for storing quotafile name"); 1313 "Not enough memory for storing quotafile name");
1314 return 0; 1314 return -1;
1315 } 1315 }
1316 if (sbi->s_qf_names[qtype] && 1316 if (sbi->s_qf_names[qtype] &&
1317 strcmp(sbi->s_qf_names[qtype], qname)) { 1317 strcmp(sbi->s_qf_names[qtype], qname)) {
1318 ext4_msg(sb, KERN_ERR, 1318 ext4_msg(sb, KERN_ERR,
1319 "%s quota file already specified", QTYPE2NAME(qtype)); 1319 "%s quota file already specified", QTYPE2NAME(qtype));
1320 kfree(qname); 1320 kfree(qname);
1321 return 0; 1321 return -1;
1322 } 1322 }
1323 sbi->s_qf_names[qtype] = qname; 1323 sbi->s_qf_names[qtype] = qname;
1324 if (strchr(sbi->s_qf_names[qtype], '/')) { 1324 if (strchr(sbi->s_qf_names[qtype], '/')) {
@@ -1326,7 +1326,7 @@ static int set_qf_name(struct super_block *sb, int qtype, substring_t *args)
1326 "quotafile must be on filesystem root"); 1326 "quotafile must be on filesystem root");
1327 kfree(sbi->s_qf_names[qtype]); 1327 kfree(sbi->s_qf_names[qtype]);
1328 sbi->s_qf_names[qtype] = NULL; 1328 sbi->s_qf_names[qtype] = NULL;
1329 return 0; 1329 return -1;
1330 } 1330 }
1331 set_opt(sb, QUOTA); 1331 set_opt(sb, QUOTA);
1332 return 1; 1332 return 1;
@@ -1341,7 +1341,7 @@ static int clear_qf_name(struct super_block *sb, int qtype)
1341 sbi->s_qf_names[qtype]) { 1341 sbi->s_qf_names[qtype]) {
1342 ext4_msg(sb, KERN_ERR, "Cannot change journaled quota options" 1342 ext4_msg(sb, KERN_ERR, "Cannot change journaled quota options"
1343 " when quota turned on"); 1343 " when quota turned on");
1344 return 0; 1344 return -1;
1345 } 1345 }
1346 /* 1346 /*
1347 * The space will be released later when all options are confirmed 1347 * The space will be released later when all options are confirmed
@@ -1450,6 +1450,16 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
1450 const struct mount_opts *m; 1450 const struct mount_opts *m;
1451 int arg = 0; 1451 int arg = 0;
1452 1452
1453#ifdef CONFIG_QUOTA
1454 if (token == Opt_usrjquota)
1455 return set_qf_name(sb, USRQUOTA, &args[0]);
1456 else if (token == Opt_grpjquota)
1457 return set_qf_name(sb, GRPQUOTA, &args[0]);
1458 else if (token == Opt_offusrjquota)
1459 return clear_qf_name(sb, USRQUOTA);
1460 else if (token == Opt_offgrpjquota)
1461 return clear_qf_name(sb, GRPQUOTA);
1462#endif
1453 if (args->from && match_int(args, &arg)) 1463 if (args->from && match_int(args, &arg))
1454 return -1; 1464 return -1;
1455 switch (token) { 1465 switch (token) {
@@ -1549,18 +1559,6 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
1549 sbi->s_mount_opt |= m->mount_opt; 1559 sbi->s_mount_opt |= m->mount_opt;
1550 } 1560 }
1551#ifdef CONFIG_QUOTA 1561#ifdef CONFIG_QUOTA
1552 } else if (token == Opt_usrjquota) {
1553 if (!set_qf_name(sb, USRQUOTA, &args[0]))
1554 return -1;
1555 } else if (token == Opt_grpjquota) {
1556 if (!set_qf_name(sb, GRPQUOTA, &args[0]))
1557 return -1;
1558 } else if (token == Opt_offusrjquota) {
1559 if (!clear_qf_name(sb, USRQUOTA))
1560 return -1;
1561 } else if (token == Opt_offgrpjquota) {
1562 if (!clear_qf_name(sb, GRPQUOTA))
1563 return -1;
1564 } else if (m->flags & MOPT_QFMT) { 1562 } else if (m->flags & MOPT_QFMT) {
1565 if (sb_any_quota_loaded(sb) && 1563 if (sb_any_quota_loaded(sb) &&
1566 sbi->s_jquota_fmt != m->mount_opt) { 1564 sbi->s_jquota_fmt != m->mount_opt) {
@@ -2366,18 +2364,6 @@ static ssize_t lifetime_write_kbytes_show(struct ext4_attr *a,
2366 EXT4_SB(sb)->s_sectors_written_start) >> 1))); 2364 EXT4_SB(sb)->s_sectors_written_start) >> 1)));
2367} 2365}
2368 2366
2369static ssize_t extent_cache_hits_show(struct ext4_attr *a,
2370 struct ext4_sb_info *sbi, char *buf)
2371{
2372 return snprintf(buf, PAGE_SIZE, "%lu\n", sbi->extent_cache_hits);
2373}
2374
2375static ssize_t extent_cache_misses_show(struct ext4_attr *a,
2376 struct ext4_sb_info *sbi, char *buf)
2377{
2378 return snprintf(buf, PAGE_SIZE, "%lu\n", sbi->extent_cache_misses);
2379}
2380
2381static ssize_t inode_readahead_blks_store(struct ext4_attr *a, 2367static ssize_t inode_readahead_blks_store(struct ext4_attr *a,
2382 struct ext4_sb_info *sbi, 2368 struct ext4_sb_info *sbi,
2383 const char *buf, size_t count) 2369 const char *buf, size_t count)
@@ -2435,8 +2421,6 @@ static struct ext4_attr ext4_attr_##name = __ATTR(name, mode, show, store)
2435EXT4_RO_ATTR(delayed_allocation_blocks); 2421EXT4_RO_ATTR(delayed_allocation_blocks);
2436EXT4_RO_ATTR(session_write_kbytes); 2422EXT4_RO_ATTR(session_write_kbytes);
2437EXT4_RO_ATTR(lifetime_write_kbytes); 2423EXT4_RO_ATTR(lifetime_write_kbytes);
2438EXT4_RO_ATTR(extent_cache_hits);
2439EXT4_RO_ATTR(extent_cache_misses);
2440EXT4_ATTR_OFFSET(inode_readahead_blks, 0644, sbi_ui_show, 2424EXT4_ATTR_OFFSET(inode_readahead_blks, 0644, sbi_ui_show,
2441 inode_readahead_blks_store, s_inode_readahead_blks); 2425 inode_readahead_blks_store, s_inode_readahead_blks);
2442EXT4_RW_ATTR_SBI_UI(inode_goal, s_inode_goal); 2426EXT4_RW_ATTR_SBI_UI(inode_goal, s_inode_goal);
@@ -2452,8 +2436,6 @@ static struct attribute *ext4_attrs[] = {
2452 ATTR_LIST(delayed_allocation_blocks), 2436 ATTR_LIST(delayed_allocation_blocks),
2453 ATTR_LIST(session_write_kbytes), 2437 ATTR_LIST(session_write_kbytes),
2454 ATTR_LIST(lifetime_write_kbytes), 2438 ATTR_LIST(lifetime_write_kbytes),
2455 ATTR_LIST(extent_cache_hits),
2456 ATTR_LIST(extent_cache_misses),
2457 ATTR_LIST(inode_readahead_blks), 2439 ATTR_LIST(inode_readahead_blks),
2458 ATTR_LIST(inode_goal), 2440 ATTR_LIST(inode_goal),
2459 ATTR_LIST(mb_stats), 2441 ATTR_LIST(mb_stats),
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 206632887bb4..df5ac048dc74 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -387,9 +387,6 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry,
387 if (fc->no_create) 387 if (fc->no_create)
388 return -ENOSYS; 388 return -ENOSYS;
389 389
390 if (flags & O_DIRECT)
391 return -EINVAL;
392
393 forget = fuse_alloc_forget(); 390 forget = fuse_alloc_forget();
394 if (!forget) 391 if (!forget)
395 return -ENOMEM; 392 return -ENOMEM;
@@ -644,13 +641,12 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry)
644 fuse_put_request(fc, req); 641 fuse_put_request(fc, req);
645 if (!err) { 642 if (!err) {
646 struct inode *inode = entry->d_inode; 643 struct inode *inode = entry->d_inode;
644 struct fuse_inode *fi = get_fuse_inode(inode);
647 645
648 /* 646 spin_lock(&fc->lock);
649 * Set nlink to zero so the inode can be cleared, if the inode 647 fi->attr_version = ++fc->attr_version;
650 * does have more links this will be discovered at the next 648 drop_nlink(inode);
651 * lookup/getattr. 649 spin_unlock(&fc->lock);
652 */
653 clear_nlink(inode);
654 fuse_invalidate_attr(inode); 650 fuse_invalidate_attr(inode);
655 fuse_invalidate_attr(dir); 651 fuse_invalidate_attr(dir);
656 fuse_invalidate_entry_cache(entry); 652 fuse_invalidate_entry_cache(entry);
@@ -762,8 +758,17 @@ static int fuse_link(struct dentry *entry, struct inode *newdir,
762 will reflect changes in the backing inode (link count, 758 will reflect changes in the backing inode (link count,
763 etc.) 759 etc.)
764 */ 760 */
765 if (!err || err == -EINTR) 761 if (!err) {
762 struct fuse_inode *fi = get_fuse_inode(inode);
763
764 spin_lock(&fc->lock);
765 fi->attr_version = ++fc->attr_version;
766 inc_nlink(inode);
767 spin_unlock(&fc->lock);
768 fuse_invalidate_attr(inode);
769 } else if (err == -EINTR) {
766 fuse_invalidate_attr(inode); 770 fuse_invalidate_attr(inode);
771 }
767 return err; 772 return err;
768} 773}
769 774
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index a841868bf9ce..504e61b7fd75 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -194,10 +194,6 @@ int fuse_open_common(struct inode *inode, struct file *file, bool isdir)
194 struct fuse_conn *fc = get_fuse_conn(inode); 194 struct fuse_conn *fc = get_fuse_conn(inode);
195 int err; 195 int err;
196 196
197 /* VFS checks this, but only _after_ ->open() */
198 if (file->f_flags & O_DIRECT)
199 return -EINVAL;
200
201 err = generic_file_open(inode, file); 197 err = generic_file_open(inode, file);
202 if (err) 198 if (err)
203 return err; 199 return err;
@@ -932,17 +928,23 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
932 struct file *file = iocb->ki_filp; 928 struct file *file = iocb->ki_filp;
933 struct address_space *mapping = file->f_mapping; 929 struct address_space *mapping = file->f_mapping;
934 size_t count = 0; 930 size_t count = 0;
931 size_t ocount = 0;
935 ssize_t written = 0; 932 ssize_t written = 0;
933 ssize_t written_buffered = 0;
936 struct inode *inode = mapping->host; 934 struct inode *inode = mapping->host;
937 ssize_t err; 935 ssize_t err;
938 struct iov_iter i; 936 struct iov_iter i;
937 loff_t endbyte = 0;
939 938
940 WARN_ON(iocb->ki_pos != pos); 939 WARN_ON(iocb->ki_pos != pos);
941 940
942 err = generic_segment_checks(iov, &nr_segs, &count, VERIFY_READ); 941 ocount = 0;
942 err = generic_segment_checks(iov, &nr_segs, &ocount, VERIFY_READ);
943 if (err) 943 if (err)
944 return err; 944 return err;
945 945
946 count = ocount;
947
946 mutex_lock(&inode->i_mutex); 948 mutex_lock(&inode->i_mutex);
947 vfs_check_frozen(inode->i_sb, SB_FREEZE_WRITE); 949 vfs_check_frozen(inode->i_sb, SB_FREEZE_WRITE);
948 950
@@ -962,11 +964,41 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
962 964
963 file_update_time(file); 965 file_update_time(file);
964 966
965 iov_iter_init(&i, iov, nr_segs, count, 0); 967 if (file->f_flags & O_DIRECT) {
966 written = fuse_perform_write(file, mapping, &i, pos); 968 written = generic_file_direct_write(iocb, iov, &nr_segs,
967 if (written >= 0) 969 pos, &iocb->ki_pos,
968 iocb->ki_pos = pos + written; 970 count, ocount);
971 if (written < 0 || written == count)
972 goto out;
973
974 pos += written;
975 count -= written;
969 976
977 iov_iter_init(&i, iov, nr_segs, count, written);
978 written_buffered = fuse_perform_write(file, mapping, &i, pos);
979 if (written_buffered < 0) {
980 err = written_buffered;
981 goto out;
982 }
983 endbyte = pos + written_buffered - 1;
984
985 err = filemap_write_and_wait_range(file->f_mapping, pos,
986 endbyte);
987 if (err)
988 goto out;
989
990 invalidate_mapping_pages(file->f_mapping,
991 pos >> PAGE_CACHE_SHIFT,
992 endbyte >> PAGE_CACHE_SHIFT);
993
994 written += written_buffered;
995 iocb->ki_pos = pos + written_buffered;
996 } else {
997 iov_iter_init(&i, iov, nr_segs, count, 0);
998 written = fuse_perform_write(file, mapping, &i, pos);
999 if (written >= 0)
1000 iocb->ki_pos = pos + written;
1001 }
970out: 1002out:
971 current->backing_dev_info = NULL; 1003 current->backing_dev_info = NULL;
972 mutex_unlock(&inode->i_mutex); 1004 mutex_unlock(&inode->i_mutex);
@@ -1101,30 +1133,41 @@ static ssize_t fuse_direct_read(struct file *file, char __user *buf,
1101 return res; 1133 return res;
1102} 1134}
1103 1135
1104static ssize_t fuse_direct_write(struct file *file, const char __user *buf, 1136static ssize_t __fuse_direct_write(struct file *file, const char __user *buf,
1105 size_t count, loff_t *ppos) 1137 size_t count, loff_t *ppos)
1106{ 1138{
1107 struct inode *inode = file->f_path.dentry->d_inode; 1139 struct inode *inode = file->f_path.dentry->d_inode;
1108 ssize_t res; 1140 ssize_t res;
1109 1141
1110 if (is_bad_inode(inode))
1111 return -EIO;
1112
1113 /* Don't allow parallel writes to the same file */
1114 mutex_lock(&inode->i_mutex);
1115 res = generic_write_checks(file, ppos, &count, 0); 1142 res = generic_write_checks(file, ppos, &count, 0);
1116 if (!res) { 1143 if (!res) {
1117 res = fuse_direct_io(file, buf, count, ppos, 1); 1144 res = fuse_direct_io(file, buf, count, ppos, 1);
1118 if (res > 0) 1145 if (res > 0)
1119 fuse_write_update_size(inode, *ppos); 1146 fuse_write_update_size(inode, *ppos);
1120 } 1147 }
1121 mutex_unlock(&inode->i_mutex);
1122 1148
1123 fuse_invalidate_attr(inode); 1149 fuse_invalidate_attr(inode);
1124 1150
1125 return res; 1151 return res;
1126} 1152}
1127 1153
1154static ssize_t fuse_direct_write(struct file *file, const char __user *buf,
1155 size_t count, loff_t *ppos)
1156{
1157 struct inode *inode = file->f_path.dentry->d_inode;
1158 ssize_t res;
1159
1160 if (is_bad_inode(inode))
1161 return -EIO;
1162
1163 /* Don't allow parallel writes to the same file */
1164 mutex_lock(&inode->i_mutex);
1165 res = __fuse_direct_write(file, buf, count, ppos);
1166 mutex_unlock(&inode->i_mutex);
1167
1168 return res;
1169}
1170
1128static void fuse_writepage_free(struct fuse_conn *fc, struct fuse_req *req) 1171static void fuse_writepage_free(struct fuse_conn *fc, struct fuse_req *req)
1129{ 1172{
1130 __free_page(req->pages[0]); 1173 __free_page(req->pages[0]);
@@ -2077,6 +2120,57 @@ int fuse_notify_poll_wakeup(struct fuse_conn *fc,
2077 return 0; 2120 return 0;
2078} 2121}
2079 2122
2123static ssize_t fuse_loop_dio(struct file *filp, const struct iovec *iov,
2124 unsigned long nr_segs, loff_t *ppos, int rw)
2125{
2126 const struct iovec *vector = iov;
2127 ssize_t ret = 0;
2128
2129 while (nr_segs > 0) {
2130 void __user *base;
2131 size_t len;
2132 ssize_t nr;
2133
2134 base = vector->iov_base;
2135 len = vector->iov_len;
2136 vector++;
2137 nr_segs--;
2138
2139 if (rw == WRITE)
2140 nr = __fuse_direct_write(filp, base, len, ppos);
2141 else
2142 nr = fuse_direct_read(filp, base, len, ppos);
2143
2144 if (nr < 0) {
2145 if (!ret)
2146 ret = nr;
2147 break;
2148 }
2149 ret += nr;
2150 if (nr != len)
2151 break;
2152 }
2153
2154 return ret;
2155}
2156
2157
2158static ssize_t
2159fuse_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
2160 loff_t offset, unsigned long nr_segs)
2161{
2162 ssize_t ret = 0;
2163 struct file *file = NULL;
2164 loff_t pos = 0;
2165
2166 file = iocb->ki_filp;
2167 pos = offset;
2168
2169 ret = fuse_loop_dio(file, iov, nr_segs, &pos, rw);
2170
2171 return ret;
2172}
2173
2080static const struct file_operations fuse_file_operations = { 2174static const struct file_operations fuse_file_operations = {
2081 .llseek = fuse_file_llseek, 2175 .llseek = fuse_file_llseek,
2082 .read = do_sync_read, 2176 .read = do_sync_read,
@@ -2120,6 +2214,7 @@ static const struct address_space_operations fuse_file_aops = {
2120 .readpages = fuse_readpages, 2214 .readpages = fuse_readpages,
2121 .set_page_dirty = __set_page_dirty_nobuffers, 2215 .set_page_dirty = __set_page_dirty_nobuffers,
2122 .bmap = fuse_bmap, 2216 .bmap = fuse_bmap,
2217 .direct_IO = fuse_direct_IO,
2123}; 2218};
2124 2219
2125void fuse_init_file_inode(struct inode *inode) 2220void fuse_init_file_inode(struct inode *inode)
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 4aec5995867e..26783eb2b1fc 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -947,6 +947,7 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
947 sb->s_magic = FUSE_SUPER_MAGIC; 947 sb->s_magic = FUSE_SUPER_MAGIC;
948 sb->s_op = &fuse_super_operations; 948 sb->s_op = &fuse_super_operations;
949 sb->s_maxbytes = MAX_LFS_FILESIZE; 949 sb->s_maxbytes = MAX_LFS_FILESIZE;
950 sb->s_time_gran = 1;
950 sb->s_export_op = &fuse_export_operations; 951 sb->s_export_op = &fuse_export_operations;
951 952
952 file = fget(d.fd); 953 file = fget(d.fd);
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/lockd/clnt4xdr.c b/fs/lockd/clnt4xdr.c
index 3ddcbb1c0a43..13ad1539fbf2 100644
--- a/fs/lockd/clnt4xdr.c
+++ b/fs/lockd/clnt4xdr.c
@@ -241,7 +241,7 @@ static int decode_nlm4_stat(struct xdr_stream *xdr, __be32 *stat)
241 p = xdr_inline_decode(xdr, 4); 241 p = xdr_inline_decode(xdr, 4);
242 if (unlikely(p == NULL)) 242 if (unlikely(p == NULL))
243 goto out_overflow; 243 goto out_overflow;
244 if (unlikely(*p > nlm4_failed)) 244 if (unlikely(ntohl(*p) > ntohl(nlm4_failed)))
245 goto out_bad_xdr; 245 goto out_bad_xdr;
246 *stat = *p; 246 *stat = *p;
247 return 0; 247 return 0;
diff --git a/fs/lockd/clntxdr.c b/fs/lockd/clntxdr.c
index 3d35e3e80c1c..d269ada7670e 100644
--- a/fs/lockd/clntxdr.c
+++ b/fs/lockd/clntxdr.c
@@ -236,7 +236,7 @@ static int decode_nlm_stat(struct xdr_stream *xdr,
236 p = xdr_inline_decode(xdr, 4); 236 p = xdr_inline_decode(xdr, 4);
237 if (unlikely(p == NULL)) 237 if (unlikely(p == NULL))
238 goto out_overflow; 238 goto out_overflow;
239 if (unlikely(*p > nlm_lck_denied_grace_period)) 239 if (unlikely(ntohl(*p) > ntohl(nlm_lck_denied_grace_period)))
240 goto out_enum; 240 goto out_enum;
241 *stat = *p; 241 *stat = *p;
242 return 0; 242 return 0;
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index 08c6e36ab2eb..43f46cd9edea 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -803,13 +803,13 @@ encode_entry_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name,
803 return p; 803 return p;
804} 804}
805 805
806static int 806static __be32
807compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp, 807compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp,
808 const char *name, int namlen) 808 const char *name, int namlen)
809{ 809{
810 struct svc_export *exp; 810 struct svc_export *exp;
811 struct dentry *dparent, *dchild; 811 struct dentry *dparent, *dchild;
812 int rv = 0; 812 __be32 rv = nfserr_noent;
813 813
814 dparent = cd->fh.fh_dentry; 814 dparent = cd->fh.fh_dentry;
815 exp = cd->fh.fh_export; 815 exp = cd->fh.fh_export;
@@ -817,26 +817,20 @@ compose_entry_fh(struct nfsd3_readdirres *cd, struct svc_fh *fhp,
817 if (isdotent(name, namlen)) { 817 if (isdotent(name, namlen)) {
818 if (namlen == 2) { 818 if (namlen == 2) {
819 dchild = dget_parent(dparent); 819 dchild = dget_parent(dparent);
820 if (dchild == dparent) { 820 /* filesystem root - cannot return filehandle for ".." */
821 /* filesystem root - cannot return filehandle for ".." */ 821 if (dchild == dparent)
822 dput(dchild); 822 goto out;
823 return -ENOENT;
824 }
825 } else 823 } else
826 dchild = dget(dparent); 824 dchild = dget(dparent);
827 } else 825 } else
828 dchild = lookup_one_len(name, dparent, namlen); 826 dchild = lookup_one_len(name, dparent, namlen);
829 if (IS_ERR(dchild)) 827 if (IS_ERR(dchild))
830 return -ENOENT; 828 return rv;
831 rv = -ENOENT;
832 if (d_mountpoint(dchild)) 829 if (d_mountpoint(dchild))
833 goto out; 830 goto out;
834 rv = fh_compose(fhp, exp, dchild, &cd->fh);
835 if (rv)
836 goto out;
837 if (!dchild->d_inode) 831 if (!dchild->d_inode)
838 goto out; 832 goto out;
839 rv = 0; 833 rv = fh_compose(fhp, exp, dchild, &cd->fh);
840out: 834out:
841 dput(dchild); 835 dput(dchild);
842 return rv; 836 return rv;
@@ -845,7 +839,7 @@ out:
845static __be32 *encode_entryplus_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name, int namlen) 839static __be32 *encode_entryplus_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name, int namlen)
846{ 840{
847 struct svc_fh fh; 841 struct svc_fh fh;
848 int err; 842 __be32 err;
849 843
850 fh_init(&fh, NFS3_FHSIZE); 844 fh_init(&fh, NFS3_FHSIZE);
851 err = compose_entry_fh(cd, &fh, name, namlen); 845 err = compose_entry_fh(cd, &fh, name, namlen);
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 2ed14dfd00a2..694d526c8f19 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -841,6 +841,7 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
841 struct nfsd4_setattr *setattr) 841 struct nfsd4_setattr *setattr)
842{ 842{
843 __be32 status = nfs_ok; 843 __be32 status = nfs_ok;
844 int err;
844 845
845 if (setattr->sa_iattr.ia_valid & ATTR_SIZE) { 846 if (setattr->sa_iattr.ia_valid & ATTR_SIZE) {
846 nfs4_lock_state(); 847 nfs4_lock_state();
@@ -852,9 +853,9 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
852 return status; 853 return status;
853 } 854 }
854 } 855 }
855 status = fh_want_write(&cstate->current_fh); 856 err = fh_want_write(&cstate->current_fh);
856 if (status) 857 if (err)
857 return status; 858 return nfserrno(err);
858 status = nfs_ok; 859 status = nfs_ok;
859 860
860 status = check_attr_support(rqstp, cstate, setattr->sa_bmval, 861 status = check_attr_support(rqstp, cstate, setattr->sa_bmval,
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 1841f8bf845e..7f71c69cdcdf 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -4211,16 +4211,14 @@ out:
4211 * vfs_test_lock. (Arguably perhaps test_lock should be done with an 4211 * vfs_test_lock. (Arguably perhaps test_lock should be done with an
4212 * inode operation.) 4212 * inode operation.)
4213 */ 4213 */
4214static int nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file_lock *lock) 4214static __be32 nfsd_test_lock(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file_lock *lock)
4215{ 4215{
4216 struct file *file; 4216 struct file *file;
4217 int err; 4217 __be32 err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_READ, &file);
4218 4218 if (!err) {
4219 err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_READ, &file); 4219 err = nfserrno(vfs_test_lock(file, lock));
4220 if (err) 4220 nfsd_close(file);
4221 return err; 4221 }
4222 err = vfs_test_lock(file, lock);
4223 nfsd_close(file);
4224 return err; 4222 return err;
4225} 4223}
4226 4224
@@ -4234,7 +4232,6 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
4234 struct inode *inode; 4232 struct inode *inode;
4235 struct file_lock file_lock; 4233 struct file_lock file_lock;
4236 struct nfs4_lockowner *lo; 4234 struct nfs4_lockowner *lo;
4237 int error;
4238 __be32 status; 4235 __be32 status;
4239 4236
4240 if (locks_in_grace()) 4237 if (locks_in_grace())
@@ -4280,12 +4277,10 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
4280 4277
4281 nfs4_transform_lock_offset(&file_lock); 4278 nfs4_transform_lock_offset(&file_lock);
4282 4279
4283 status = nfs_ok; 4280 status = nfsd_test_lock(rqstp, &cstate->current_fh, &file_lock);
4284 error = nfsd_test_lock(rqstp, &cstate->current_fh, &file_lock); 4281 if (status)
4285 if (error) {
4286 status = nfserrno(error);
4287 goto out; 4282 goto out;
4288 } 4283
4289 if (file_lock.fl_type != F_UNLCK) { 4284 if (file_lock.fl_type != F_UNLCK) {
4290 status = nfserr_denied; 4285 status = nfserr_denied;
4291 nfs4_set_lock_denied(&file_lock, &lockt->lt_denied); 4286 nfs4_set_lock_denied(&file_lock, &lockt->lt_denied);
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index bcd8904ab1e3..74c00bc92b9a 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1392,7 +1392,7 @@ nfsd4_decode_test_stateid(struct nfsd4_compoundargs *argp, struct nfsd4_test_sta
1392 for (i = 0; i < test_stateid->ts_num_ids; i++) { 1392 for (i = 0; i < test_stateid->ts_num_ids; i++) {
1393 stateid = kmalloc(sizeof(struct nfsd4_test_stateid_id), GFP_KERNEL); 1393 stateid = kmalloc(sizeof(struct nfsd4_test_stateid_id), GFP_KERNEL);
1394 if (!stateid) { 1394 if (!stateid) {
1395 status = PTR_ERR(stateid); 1395 status = nfserrno(-ENOMEM);
1396 goto out; 1396 goto out;
1397 } 1397 }
1398 1398
@@ -3410,7 +3410,7 @@ nfsd4_encode_test_stateid(struct nfsd4_compoundres *resp, int nfserr,
3410 *p++ = htonl(test_stateid->ts_num_ids); 3410 *p++ = htonl(test_stateid->ts_num_ids);
3411 3411
3412 list_for_each_entry_safe(stateid, next, &test_stateid->ts_stateid_list, ts_id_list) { 3412 list_for_each_entry_safe(stateid, next, &test_stateid->ts_stateid_list, ts_id_list) {
3413 *p++ = htonl(stateid->ts_id_status); 3413 *p++ = stateid->ts_id_status;
3414 } 3414 }
3415 3415
3416 ADJUST_ARGS(); 3416 ADJUST_ARGS();
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 3165aebb43c8..31b9463fba1f 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -1134,7 +1134,7 @@ static int ocfs2_adjust_rightmost_branch(handle_t *handle,
1134 } 1134 }
1135 1135
1136 el = path_leaf_el(path); 1136 el = path_leaf_el(path);
1137 rec = &el->l_recs[le32_to_cpu(el->l_next_free_rec) - 1]; 1137 rec = &el->l_recs[le16_to_cpu(el->l_next_free_rec) - 1];
1138 1138
1139 ocfs2_adjust_rightmost_records(handle, et, path, rec); 1139 ocfs2_adjust_rightmost_records(handle, et, path, rec);
1140 1140
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c
index cf7823382664..9f32d7cbb7a3 100644
--- a/fs/ocfs2/refcounttree.c
+++ b/fs/ocfs2/refcounttree.c
@@ -1036,14 +1036,14 @@ static int ocfs2_get_refcount_cpos_end(struct ocfs2_caching_info *ci,
1036 1036
1037 tmp_el = left_path->p_node[subtree_root].el; 1037 tmp_el = left_path->p_node[subtree_root].el;
1038 blkno = left_path->p_node[subtree_root+1].bh->b_blocknr; 1038 blkno = left_path->p_node[subtree_root+1].bh->b_blocknr;
1039 for (i = 0; i < le32_to_cpu(tmp_el->l_next_free_rec); i++) { 1039 for (i = 0; i < le16_to_cpu(tmp_el->l_next_free_rec); i++) {
1040 if (le64_to_cpu(tmp_el->l_recs[i].e_blkno) == blkno) { 1040 if (le64_to_cpu(tmp_el->l_recs[i].e_blkno) == blkno) {
1041 *cpos_end = le32_to_cpu(tmp_el->l_recs[i+1].e_cpos); 1041 *cpos_end = le32_to_cpu(tmp_el->l_recs[i+1].e_cpos);
1042 break; 1042 break;
1043 } 1043 }
1044 } 1044 }
1045 1045
1046 BUG_ON(i == le32_to_cpu(tmp_el->l_next_free_rec)); 1046 BUG_ON(i == le16_to_cpu(tmp_el->l_next_free_rec));
1047 1047
1048out: 1048out:
1049 ocfs2_free_path(left_path); 1049 ocfs2_free_path(left_path);
@@ -1468,7 +1468,7 @@ static int ocfs2_divide_leaf_refcount_block(struct buffer_head *ref_leaf_bh,
1468 1468
1469 trace_ocfs2_divide_leaf_refcount_block( 1469 trace_ocfs2_divide_leaf_refcount_block(
1470 (unsigned long long)ref_leaf_bh->b_blocknr, 1470 (unsigned long long)ref_leaf_bh->b_blocknr,
1471 le32_to_cpu(rl->rl_count), le32_to_cpu(rl->rl_used)); 1471 le16_to_cpu(rl->rl_count), le16_to_cpu(rl->rl_used));
1472 1472
1473 /* 1473 /*
1474 * XXX: Improvement later. 1474 * XXX: Improvement later.
@@ -2411,7 +2411,7 @@ static int ocfs2_calc_refcount_meta_credits(struct super_block *sb,
2411 rb = (struct ocfs2_refcount_block *) 2411 rb = (struct ocfs2_refcount_block *)
2412 prev_bh->b_data; 2412 prev_bh->b_data;
2413 2413
2414 if (le64_to_cpu(rb->rf_records.rl_used) + 2414 if (le16_to_cpu(rb->rf_records.rl_used) +
2415 recs_add > 2415 recs_add >
2416 le16_to_cpu(rb->rf_records.rl_count)) 2416 le16_to_cpu(rb->rf_records.rl_count))
2417 ref_blocks++; 2417 ref_blocks++;
@@ -2476,7 +2476,7 @@ static int ocfs2_calc_refcount_meta_credits(struct super_block *sb,
2476 if (prev_bh) { 2476 if (prev_bh) {
2477 rb = (struct ocfs2_refcount_block *)prev_bh->b_data; 2477 rb = (struct ocfs2_refcount_block *)prev_bh->b_data;
2478 2478
2479 if (le64_to_cpu(rb->rf_records.rl_used) + recs_add > 2479 if (le16_to_cpu(rb->rf_records.rl_used) + recs_add >
2480 le16_to_cpu(rb->rf_records.rl_count)) 2480 le16_to_cpu(rb->rf_records.rl_count))
2481 ref_blocks++; 2481 ref_blocks++;
2482 2482
@@ -3629,7 +3629,7 @@ int ocfs2_refcounted_xattr_delete_need(struct inode *inode,
3629 * one will split a refcount rec, so totally we need 3629 * one will split a refcount rec, so totally we need
3630 * clusters * 2 new refcount rec. 3630 * clusters * 2 new refcount rec.
3631 */ 3631 */
3632 if (le64_to_cpu(rb->rf_records.rl_used) + clusters * 2 > 3632 if (le16_to_cpu(rb->rf_records.rl_used) + clusters * 2 >
3633 le16_to_cpu(rb->rf_records.rl_count)) 3633 le16_to_cpu(rb->rf_records.rl_count))
3634 ref_blocks++; 3634 ref_blocks++;
3635 3635
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index ba5d97e4a73e..f169da4624fd 100644
--- a/fs/ocfs2/suballoc.c
+++ b/fs/ocfs2/suballoc.c
@@ -600,7 +600,7 @@ static void ocfs2_bg_alloc_cleanup(handle_t *handle,
600 ret = ocfs2_free_clusters(handle, cluster_ac->ac_inode, 600 ret = ocfs2_free_clusters(handle, cluster_ac->ac_inode,
601 cluster_ac->ac_bh, 601 cluster_ac->ac_bh,
602 le64_to_cpu(rec->e_blkno), 602 le64_to_cpu(rec->e_blkno),
603 le32_to_cpu(rec->e_leaf_clusters)); 603 le16_to_cpu(rec->e_leaf_clusters));
604 if (ret) 604 if (ret)
605 mlog_errno(ret); 605 mlog_errno(ret);
606 /* Try all the clusters to free */ 606 /* Try all the clusters to free */
@@ -1628,7 +1628,7 @@ static int ocfs2_bg_discontig_fix_by_rec(struct ocfs2_suballoc_result *res,
1628{ 1628{
1629 unsigned int bpc = le16_to_cpu(cl->cl_bpc); 1629 unsigned int bpc = le16_to_cpu(cl->cl_bpc);
1630 unsigned int bitoff = le32_to_cpu(rec->e_cpos) * bpc; 1630 unsigned int bitoff = le32_to_cpu(rec->e_cpos) * bpc;
1631 unsigned int bitcount = le32_to_cpu(rec->e_leaf_clusters) * bpc; 1631 unsigned int bitcount = le16_to_cpu(rec->e_leaf_clusters) * bpc;
1632 1632
1633 if (res->sr_bit_offset < bitoff) 1633 if (res->sr_bit_offset < bitoff)
1634 return 0; 1634 return 0;
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)