diff options
author | Tejun Heo <tj@kernel.org> | 2014-02-10 19:34:30 -0500 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2014-02-10 19:34:30 -0500 |
commit | a8fa94e0f2ab665f9aa665195618178b61ed8304 (patch) | |
tree | 4060502fffd7f56d379372d517f8dcc31bf63955 /fs | |
parent | 9561a8961c708ff6ba3e71a817af0f16bdc1d885 (diff) | |
parent | b28a960c42fcd9cfc987441fa6d1c1a471f0f9ed (diff) |
Merge branch 'master' into driver-core-next-test-merge-rc2
da9846ae1518 ("kernfs: make kernfs_deactivate() honor KERNFS_LOCKDEP
flag") in driver-core-linus conflicts with kernfs_drain() updates in
driver-core-next. The former just adds the missing KERNFS_LOCKDEP
checks which are already handled by kernfs_lockdep() checks in
driver-core-next. The conflict can be resolved by taking code from
driver-core-next.
Conflicts:
fs/kernfs/dir.c
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/check-integrity.c | 4 | ||||
-rw-r--r-- | fs/btrfs/compression.c | 2 | ||||
-rw-r--r-- | fs/btrfs/disk-io.c | 4 | ||||
-rw-r--r-- | fs/btrfs/extent-tree.c | 1 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 2 | ||||
-rw-r--r-- | fs/btrfs/ioctl.c | 6 | ||||
-rw-r--r-- | fs/btrfs/send.c | 12 | ||||
-rw-r--r-- | fs/btrfs/super.c | 2 | ||||
-rw-r--r-- | fs/buffer.c | 6 | ||||
-rw-r--r-- | fs/cifs/file.c | 4 | ||||
-rw-r--r-- | fs/exec.c | 45 | ||||
-rw-r--r-- | fs/ext4/file.c | 2 | ||||
-rw-r--r-- | fs/jfs/xattr.c | 14 | ||||
-rw-r--r-- | fs/namei.c | 30 | ||||
-rw-r--r-- | fs/nfs/nfs3acl.c | 34 | ||||
-rw-r--r-- | fs/nfs/nfs4client.c | 2 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 8 | ||||
-rw-r--r-- | fs/nfs/nfs4session.c | 25 | ||||
-rw-r--r-- | fs/nfs/nfs4session.h | 2 | ||||
-rw-r--r-- | fs/ntfs/file.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/alloc.c | 38 | ||||
-rw-r--r-- | fs/ocfs2/localalloc.c | 42 | ||||
-rw-r--r-- | fs/ocfs2/localalloc.h | 6 | ||||
-rw-r--r-- | fs/posix_acl.c | 18 | ||||
-rw-r--r-- | fs/sync.c | 17 | ||||
-rw-r--r-- | fs/xfs/xfs_file.c | 2 |
26 files changed, 217 insertions, 113 deletions
diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c index 49a62b4dda3b..0e8388e72d8d 100644 --- a/fs/btrfs/check-integrity.c +++ b/fs/btrfs/check-integrity.c | |||
@@ -92,11 +92,11 @@ | |||
92 | #include <linux/slab.h> | 92 | #include <linux/slab.h> |
93 | #include <linux/buffer_head.h> | 93 | #include <linux/buffer_head.h> |
94 | #include <linux/mutex.h> | 94 | #include <linux/mutex.h> |
95 | #include <linux/crc32c.h> | ||
96 | #include <linux/genhd.h> | 95 | #include <linux/genhd.h> |
97 | #include <linux/blkdev.h> | 96 | #include <linux/blkdev.h> |
98 | #include "ctree.h" | 97 | #include "ctree.h" |
99 | #include "disk-io.h" | 98 | #include "disk-io.h" |
99 | #include "hash.h" | ||
100 | #include "transaction.h" | 100 | #include "transaction.h" |
101 | #include "extent_io.h" | 101 | #include "extent_io.h" |
102 | #include "volumes.h" | 102 | #include "volumes.h" |
@@ -1823,7 +1823,7 @@ static int btrfsic_test_for_metadata(struct btrfsic_state *state, | |||
1823 | size_t sublen = i ? PAGE_CACHE_SIZE : | 1823 | size_t sublen = i ? PAGE_CACHE_SIZE : |
1824 | (PAGE_CACHE_SIZE - BTRFS_CSUM_SIZE); | 1824 | (PAGE_CACHE_SIZE - BTRFS_CSUM_SIZE); |
1825 | 1825 | ||
1826 | crc = crc32c(crc, data, sublen); | 1826 | crc = btrfs_crc32c(crc, data, sublen); |
1827 | } | 1827 | } |
1828 | btrfs_csum_final(crc, csum); | 1828 | btrfs_csum_final(crc, csum); |
1829 | if (memcmp(csum, h->csum, state->csum_size)) | 1829 | if (memcmp(csum, h->csum, state->csum_size)) |
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index e2600cdb6c25..b01fb6c527e3 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c | |||
@@ -1010,6 +1010,8 @@ int btrfs_decompress_buf2page(char *buf, unsigned long buf_start, | |||
1010 | bytes = min(bytes, working_bytes); | 1010 | bytes = min(bytes, working_bytes); |
1011 | kaddr = kmap_atomic(page_out); | 1011 | kaddr = kmap_atomic(page_out); |
1012 | memcpy(kaddr + *pg_offset, buf + buf_offset, bytes); | 1012 | memcpy(kaddr + *pg_offset, buf + buf_offset, bytes); |
1013 | if (*pg_index == (vcnt - 1) && *pg_offset == 0) | ||
1014 | memset(kaddr + bytes, 0, PAGE_CACHE_SIZE - bytes); | ||
1013 | kunmap_atomic(kaddr); | 1015 | kunmap_atomic(kaddr); |
1014 | flush_dcache_page(page_out); | 1016 | flush_dcache_page(page_out); |
1015 | 1017 | ||
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 0e69295d0031..5215f04260b2 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/workqueue.h> | 26 | #include <linux/workqueue.h> |
27 | #include <linux/kthread.h> | 27 | #include <linux/kthread.h> |
28 | #include <linux/freezer.h> | 28 | #include <linux/freezer.h> |
29 | #include <linux/crc32c.h> | ||
30 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
31 | #include <linux/migrate.h> | 30 | #include <linux/migrate.h> |
32 | #include <linux/ratelimit.h> | 31 | #include <linux/ratelimit.h> |
@@ -35,6 +34,7 @@ | |||
35 | #include <asm/unaligned.h> | 34 | #include <asm/unaligned.h> |
36 | #include "ctree.h" | 35 | #include "ctree.h" |
37 | #include "disk-io.h" | 36 | #include "disk-io.h" |
37 | #include "hash.h" | ||
38 | #include "transaction.h" | 38 | #include "transaction.h" |
39 | #include "btrfs_inode.h" | 39 | #include "btrfs_inode.h" |
40 | #include "volumes.h" | 40 | #include "volumes.h" |
@@ -244,7 +244,7 @@ out: | |||
244 | 244 | ||
245 | u32 btrfs_csum_data(char *data, u32 seed, size_t len) | 245 | u32 btrfs_csum_data(char *data, u32 seed, size_t len) |
246 | { | 246 | { |
247 | return crc32c(seed, data, len); | 247 | return btrfs_crc32c(seed, data, len); |
248 | } | 248 | } |
249 | 249 | ||
250 | void btrfs_csum_final(u32 crc, char *result) | 250 | void btrfs_csum_final(u32 crc, char *result) |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 9c9ecc93ae2c..32312e09f0f5 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -2385,6 +2385,7 @@ static noinline int __btrfs_run_delayed_refs(struct btrfs_trans_handle *trans, | |||
2385 | spin_unlock(&delayed_refs->lock); | 2385 | spin_unlock(&delayed_refs->lock); |
2386 | locked_ref = NULL; | 2386 | locked_ref = NULL; |
2387 | cond_resched(); | 2387 | cond_resched(); |
2388 | count++; | ||
2388 | continue; | 2389 | continue; |
2389 | } | 2390 | } |
2390 | 2391 | ||
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 5c4ab9c18940..184e9cb39647 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -2629,7 +2629,7 @@ static int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent) | |||
2629 | EXTENT_DEFRAG, 1, cached_state); | 2629 | EXTENT_DEFRAG, 1, cached_state); |
2630 | if (ret) { | 2630 | if (ret) { |
2631 | u64 last_snapshot = btrfs_root_last_snapshot(&root->root_item); | 2631 | u64 last_snapshot = btrfs_root_last_snapshot(&root->root_item); |
2632 | if (last_snapshot >= BTRFS_I(inode)->generation) | 2632 | if (0 && last_snapshot >= BTRFS_I(inode)->generation) |
2633 | /* the inode is shared */ | 2633 | /* the inode is shared */ |
2634 | new = record_old_file_extents(inode, ordered_extent); | 2634 | new = record_old_file_extents(inode, ordered_extent); |
2635 | 2635 | ||
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index b0134892dc70..383ab455bfa7 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -4525,7 +4525,7 @@ static int btrfs_ioctl_set_fslabel(struct file *file, void __user *arg) | |||
4525 | spin_lock(&root->fs_info->super_lock); | 4525 | spin_lock(&root->fs_info->super_lock); |
4526 | strcpy(super_block->label, label); | 4526 | strcpy(super_block->label, label); |
4527 | spin_unlock(&root->fs_info->super_lock); | 4527 | spin_unlock(&root->fs_info->super_lock); |
4528 | ret = btrfs_end_transaction(trans, root); | 4528 | ret = btrfs_commit_transaction(trans, root); |
4529 | 4529 | ||
4530 | out_unlock: | 4530 | out_unlock: |
4531 | mnt_drop_write_file(file); | 4531 | mnt_drop_write_file(file); |
@@ -4668,7 +4668,7 @@ static int btrfs_ioctl_set_features(struct file *file, void __user *arg) | |||
4668 | if (ret) | 4668 | if (ret) |
4669 | return ret; | 4669 | return ret; |
4670 | 4670 | ||
4671 | trans = btrfs_start_transaction(root, 1); | 4671 | trans = btrfs_start_transaction(root, 0); |
4672 | if (IS_ERR(trans)) | 4672 | if (IS_ERR(trans)) |
4673 | return PTR_ERR(trans); | 4673 | return PTR_ERR(trans); |
4674 | 4674 | ||
@@ -4689,7 +4689,7 @@ static int btrfs_ioctl_set_features(struct file *file, void __user *arg) | |||
4689 | btrfs_set_super_incompat_flags(super_block, newflags); | 4689 | btrfs_set_super_incompat_flags(super_block, newflags); |
4690 | spin_unlock(&root->fs_info->super_lock); | 4690 | spin_unlock(&root->fs_info->super_lock); |
4691 | 4691 | ||
4692 | return btrfs_end_transaction(trans, root); | 4692 | return btrfs_commit_transaction(trans, root); |
4693 | } | 4693 | } |
4694 | 4694 | ||
4695 | long btrfs_ioctl(struct file *file, unsigned int | 4695 | long btrfs_ioctl(struct file *file, unsigned int |
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index 730dce395858..9c8d1a3fdc3a 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c | |||
@@ -24,12 +24,12 @@ | |||
24 | #include <linux/xattr.h> | 24 | #include <linux/xattr.h> |
25 | #include <linux/posix_acl_xattr.h> | 25 | #include <linux/posix_acl_xattr.h> |
26 | #include <linux/radix-tree.h> | 26 | #include <linux/radix-tree.h> |
27 | #include <linux/crc32c.h> | ||
28 | #include <linux/vmalloc.h> | 27 | #include <linux/vmalloc.h> |
29 | #include <linux/string.h> | 28 | #include <linux/string.h> |
30 | 29 | ||
31 | #include "send.h" | 30 | #include "send.h" |
32 | #include "backref.h" | 31 | #include "backref.h" |
32 | #include "hash.h" | ||
33 | #include "locking.h" | 33 | #include "locking.h" |
34 | #include "disk-io.h" | 34 | #include "disk-io.h" |
35 | #include "btrfs_inode.h" | 35 | #include "btrfs_inode.h" |
@@ -620,7 +620,7 @@ static int send_cmd(struct send_ctx *sctx) | |||
620 | hdr->len = cpu_to_le32(sctx->send_size - sizeof(*hdr)); | 620 | hdr->len = cpu_to_le32(sctx->send_size - sizeof(*hdr)); |
621 | hdr->crc = 0; | 621 | hdr->crc = 0; |
622 | 622 | ||
623 | crc = crc32c(0, (unsigned char *)sctx->send_buf, sctx->send_size); | 623 | crc = btrfs_crc32c(0, (unsigned char *)sctx->send_buf, sctx->send_size); |
624 | hdr->crc = cpu_to_le32(crc); | 624 | hdr->crc = cpu_to_le32(crc); |
625 | 625 | ||
626 | ret = write_buf(sctx->send_filp, sctx->send_buf, sctx->send_size, | 626 | ret = write_buf(sctx->send_filp, sctx->send_buf, sctx->send_size, |
@@ -2774,8 +2774,6 @@ static int add_waiting_dir_move(struct send_ctx *sctx, u64 ino) | |||
2774 | return 0; | 2774 | return 0; |
2775 | } | 2775 | } |
2776 | 2776 | ||
2777 | #ifdef CONFIG_BTRFS_ASSERT | ||
2778 | |||
2779 | static int del_waiting_dir_move(struct send_ctx *sctx, u64 ino) | 2777 | static int del_waiting_dir_move(struct send_ctx *sctx, u64 ino) |
2780 | { | 2778 | { |
2781 | struct rb_node *n = sctx->waiting_dir_moves.rb_node; | 2779 | struct rb_node *n = sctx->waiting_dir_moves.rb_node; |
@@ -2796,8 +2794,6 @@ static int del_waiting_dir_move(struct send_ctx *sctx, u64 ino) | |||
2796 | return -ENOENT; | 2794 | return -ENOENT; |
2797 | } | 2795 | } |
2798 | 2796 | ||
2799 | #endif | ||
2800 | |||
2801 | static int add_pending_dir_move(struct send_ctx *sctx, u64 parent_ino) | 2797 | static int add_pending_dir_move(struct send_ctx *sctx, u64 parent_ino) |
2802 | { | 2798 | { |
2803 | struct rb_node **p = &sctx->pending_dir_moves.rb_node; | 2799 | struct rb_node **p = &sctx->pending_dir_moves.rb_node; |
@@ -2902,7 +2898,9 @@ static int apply_dir_move(struct send_ctx *sctx, struct pending_dir_move *pm) | |||
2902 | } | 2898 | } |
2903 | 2899 | ||
2904 | sctx->send_progress = sctx->cur_ino + 1; | 2900 | sctx->send_progress = sctx->cur_ino + 1; |
2905 | ASSERT(del_waiting_dir_move(sctx, pm->ino) == 0); | 2901 | ret = del_waiting_dir_move(sctx, pm->ino); |
2902 | ASSERT(ret == 0); | ||
2903 | |||
2906 | ret = get_cur_path(sctx, pm->ino, pm->gen, to_path); | 2904 | ret = get_cur_path(sctx, pm->ino, pm->gen, to_path); |
2907 | if (ret < 0) | 2905 | if (ret < 0) |
2908 | goto out; | 2906 | goto out; |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index c02f63356895..97cc24198554 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -1996,7 +1996,7 @@ static void __exit exit_btrfs_fs(void) | |||
1996 | btrfs_hash_exit(); | 1996 | btrfs_hash_exit(); |
1997 | } | 1997 | } |
1998 | 1998 | ||
1999 | module_init(init_btrfs_fs) | 1999 | late_initcall(init_btrfs_fs); |
2000 | module_exit(exit_btrfs_fs) | 2000 | module_exit(exit_btrfs_fs) |
2001 | 2001 | ||
2002 | MODULE_LICENSE("GPL"); | 2002 | MODULE_LICENSE("GPL"); |
diff --git a/fs/buffer.c b/fs/buffer.c index 651dba10b9c2..27265a8b43c1 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -654,14 +654,16 @@ EXPORT_SYMBOL(mark_buffer_dirty_inode); | |||
654 | static void __set_page_dirty(struct page *page, | 654 | static void __set_page_dirty(struct page *page, |
655 | struct address_space *mapping, int warn) | 655 | struct address_space *mapping, int warn) |
656 | { | 656 | { |
657 | spin_lock_irq(&mapping->tree_lock); | 657 | unsigned long flags; |
658 | |||
659 | spin_lock_irqsave(&mapping->tree_lock, flags); | ||
658 | if (page->mapping) { /* Race with truncate? */ | 660 | if (page->mapping) { /* Race with truncate? */ |
659 | WARN_ON_ONCE(warn && !PageUptodate(page)); | 661 | WARN_ON_ONCE(warn && !PageUptodate(page)); |
660 | account_page_dirtied(page, mapping); | 662 | account_page_dirtied(page, mapping); |
661 | radix_tree_tag_set(&mapping->page_tree, | 663 | radix_tree_tag_set(&mapping->page_tree, |
662 | page_index(page), PAGECACHE_TAG_DIRTY); | 664 | page_index(page), PAGECACHE_TAG_DIRTY); |
663 | } | 665 | } |
664 | spin_unlock_irq(&mapping->tree_lock); | 666 | spin_unlock_irqrestore(&mapping->tree_lock, flags); |
665 | __mark_inode_dirty(mapping->host, I_DIRTY_PAGES); | 667 | __mark_inode_dirty(mapping->host, I_DIRTY_PAGES); |
666 | } | 668 | } |
667 | 669 | ||
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 853d6d1cc822..a7eda8ebfacc 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -2559,8 +2559,8 @@ cifs_writev(struct kiocb *iocb, const struct iovec *iov, | |||
2559 | if (rc > 0) { | 2559 | if (rc > 0) { |
2560 | ssize_t err; | 2560 | ssize_t err; |
2561 | 2561 | ||
2562 | err = generic_write_sync(file, pos, rc); | 2562 | err = generic_write_sync(file, iocb->ki_pos - rc, rc); |
2563 | if (err < 0 && rc > 0) | 2563 | if (err < 0) |
2564 | rc = err; | 2564 | rc = err; |
2565 | } | 2565 | } |
2566 | 2566 | ||
@@ -748,11 +748,10 @@ EXPORT_SYMBOL(setup_arg_pages); | |||
748 | 748 | ||
749 | #endif /* CONFIG_MMU */ | 749 | #endif /* CONFIG_MMU */ |
750 | 750 | ||
751 | struct file *open_exec(const char *name) | 751 | static struct file *do_open_exec(struct filename *name) |
752 | { | 752 | { |
753 | struct file *file; | 753 | struct file *file; |
754 | int err; | 754 | int err; |
755 | struct filename tmp = { .name = name }; | ||
756 | static const struct open_flags open_exec_flags = { | 755 | static const struct open_flags open_exec_flags = { |
757 | .open_flag = O_LARGEFILE | O_RDONLY | __FMODE_EXEC, | 756 | .open_flag = O_LARGEFILE | O_RDONLY | __FMODE_EXEC, |
758 | .acc_mode = MAY_EXEC | MAY_OPEN, | 757 | .acc_mode = MAY_EXEC | MAY_OPEN, |
@@ -760,7 +759,7 @@ struct file *open_exec(const char *name) | |||
760 | .lookup_flags = LOOKUP_FOLLOW, | 759 | .lookup_flags = LOOKUP_FOLLOW, |
761 | }; | 760 | }; |
762 | 761 | ||
763 | file = do_filp_open(AT_FDCWD, &tmp, &open_exec_flags); | 762 | file = do_filp_open(AT_FDCWD, name, &open_exec_flags); |
764 | if (IS_ERR(file)) | 763 | if (IS_ERR(file)) |
765 | goto out; | 764 | goto out; |
766 | 765 | ||
@@ -784,6 +783,12 @@ exit: | |||
784 | fput(file); | 783 | fput(file); |
785 | return ERR_PTR(err); | 784 | return ERR_PTR(err); |
786 | } | 785 | } |
786 | |||
787 | struct file *open_exec(const char *name) | ||
788 | { | ||
789 | struct filename tmp = { .name = name }; | ||
790 | return do_open_exec(&tmp); | ||
791 | } | ||
787 | EXPORT_SYMBOL(open_exec); | 792 | EXPORT_SYMBOL(open_exec); |
788 | 793 | ||
789 | int kernel_read(struct file *file, loff_t offset, | 794 | int kernel_read(struct file *file, loff_t offset, |
@@ -1162,7 +1167,7 @@ int prepare_bprm_creds(struct linux_binprm *bprm) | |||
1162 | return -ENOMEM; | 1167 | return -ENOMEM; |
1163 | } | 1168 | } |
1164 | 1169 | ||
1165 | void free_bprm(struct linux_binprm *bprm) | 1170 | static void free_bprm(struct linux_binprm *bprm) |
1166 | { | 1171 | { |
1167 | free_arg_pages(bprm); | 1172 | free_arg_pages(bprm); |
1168 | if (bprm->cred) { | 1173 | if (bprm->cred) { |
@@ -1432,7 +1437,7 @@ static int exec_binprm(struct linux_binprm *bprm) | |||
1432 | /* | 1437 | /* |
1433 | * sys_execve() executes a new program. | 1438 | * sys_execve() executes a new program. |
1434 | */ | 1439 | */ |
1435 | static int do_execve_common(const char *filename, | 1440 | static int do_execve_common(struct filename *filename, |
1436 | struct user_arg_ptr argv, | 1441 | struct user_arg_ptr argv, |
1437 | struct user_arg_ptr envp) | 1442 | struct user_arg_ptr envp) |
1438 | { | 1443 | { |
@@ -1441,6 +1446,9 @@ static int do_execve_common(const char *filename, | |||
1441 | struct files_struct *displaced; | 1446 | struct files_struct *displaced; |
1442 | int retval; | 1447 | int retval; |
1443 | 1448 | ||
1449 | if (IS_ERR(filename)) | ||
1450 | return PTR_ERR(filename); | ||
1451 | |||
1444 | /* | 1452 | /* |
1445 | * We move the actual failure in case of RLIMIT_NPROC excess from | 1453 | * We move the actual failure in case of RLIMIT_NPROC excess from |
1446 | * set*uid() to execve() because too many poorly written programs | 1454 | * set*uid() to execve() because too many poorly written programs |
@@ -1473,7 +1481,7 @@ static int do_execve_common(const char *filename, | |||
1473 | check_unsafe_exec(bprm); | 1481 | check_unsafe_exec(bprm); |
1474 | current->in_execve = 1; | 1482 | current->in_execve = 1; |
1475 | 1483 | ||
1476 | file = open_exec(filename); | 1484 | file = do_open_exec(filename); |
1477 | retval = PTR_ERR(file); | 1485 | retval = PTR_ERR(file); |
1478 | if (IS_ERR(file)) | 1486 | if (IS_ERR(file)) |
1479 | goto out_unmark; | 1487 | goto out_unmark; |
@@ -1481,8 +1489,7 @@ static int do_execve_common(const char *filename, | |||
1481 | sched_exec(); | 1489 | sched_exec(); |
1482 | 1490 | ||
1483 | bprm->file = file; | 1491 | bprm->file = file; |
1484 | bprm->filename = filename; | 1492 | bprm->filename = bprm->interp = filename->name; |
1485 | bprm->interp = filename; | ||
1486 | 1493 | ||
1487 | retval = bprm_mm_init(bprm); | 1494 | retval = bprm_mm_init(bprm); |
1488 | if (retval) | 1495 | if (retval) |
@@ -1523,6 +1530,7 @@ static int do_execve_common(const char *filename, | |||
1523 | acct_update_integrals(current); | 1530 | acct_update_integrals(current); |
1524 | task_numa_free(current); | 1531 | task_numa_free(current); |
1525 | free_bprm(bprm); | 1532 | free_bprm(bprm); |
1533 | putname(filename); | ||
1526 | if (displaced) | 1534 | if (displaced) |
1527 | put_files_struct(displaced); | 1535 | put_files_struct(displaced); |
1528 | return retval; | 1536 | return retval; |
@@ -1544,10 +1552,11 @@ out_files: | |||
1544 | if (displaced) | 1552 | if (displaced) |
1545 | reset_files_struct(displaced); | 1553 | reset_files_struct(displaced); |
1546 | out_ret: | 1554 | out_ret: |
1555 | putname(filename); | ||
1547 | return retval; | 1556 | return retval; |
1548 | } | 1557 | } |
1549 | 1558 | ||
1550 | int do_execve(const char *filename, | 1559 | int do_execve(struct filename *filename, |
1551 | const char __user *const __user *__argv, | 1560 | const char __user *const __user *__argv, |
1552 | const char __user *const __user *__envp) | 1561 | const char __user *const __user *__envp) |
1553 | { | 1562 | { |
@@ -1557,7 +1566,7 @@ int do_execve(const char *filename, | |||
1557 | } | 1566 | } |
1558 | 1567 | ||
1559 | #ifdef CONFIG_COMPAT | 1568 | #ifdef CONFIG_COMPAT |
1560 | static int compat_do_execve(const char *filename, | 1569 | static int compat_do_execve(struct filename *filename, |
1561 | const compat_uptr_t __user *__argv, | 1570 | const compat_uptr_t __user *__argv, |
1562 | const compat_uptr_t __user *__envp) | 1571 | const compat_uptr_t __user *__envp) |
1563 | { | 1572 | { |
@@ -1607,25 +1616,13 @@ SYSCALL_DEFINE3(execve, | |||
1607 | const char __user *const __user *, argv, | 1616 | const char __user *const __user *, argv, |
1608 | const char __user *const __user *, envp) | 1617 | const char __user *const __user *, envp) |
1609 | { | 1618 | { |
1610 | struct filename *path = getname(filename); | 1619 | return do_execve(getname(filename), argv, envp); |
1611 | int error = PTR_ERR(path); | ||
1612 | if (!IS_ERR(path)) { | ||
1613 | error = do_execve(path->name, argv, envp); | ||
1614 | putname(path); | ||
1615 | } | ||
1616 | return error; | ||
1617 | } | 1620 | } |
1618 | #ifdef CONFIG_COMPAT | 1621 | #ifdef CONFIG_COMPAT |
1619 | asmlinkage long compat_sys_execve(const char __user * filename, | 1622 | asmlinkage long compat_sys_execve(const char __user * filename, |
1620 | const compat_uptr_t __user * argv, | 1623 | const compat_uptr_t __user * argv, |
1621 | const compat_uptr_t __user * envp) | 1624 | const compat_uptr_t __user * envp) |
1622 | { | 1625 | { |
1623 | struct filename *path = getname(filename); | 1626 | return compat_do_execve(getname(filename), argv, envp); |
1624 | int error = PTR_ERR(path); | ||
1625 | if (!IS_ERR(path)) { | ||
1626 | error = compat_do_execve(path->name, argv, envp); | ||
1627 | putname(path); | ||
1628 | } | ||
1629 | return error; | ||
1630 | } | 1627 | } |
1631 | #endif | 1628 | #endif |
diff --git a/fs/ext4/file.c b/fs/ext4/file.c index 43e64f6022eb..1a5073959f32 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c | |||
@@ -152,7 +152,7 @@ ext4_file_dio_write(struct kiocb *iocb, const struct iovec *iov, | |||
152 | if (ret > 0) { | 152 | if (ret > 0) { |
153 | ssize_t err; | 153 | ssize_t err; |
154 | 154 | ||
155 | err = generic_write_sync(file, pos, ret); | 155 | err = generic_write_sync(file, iocb->ki_pos - ret, ret); |
156 | if (err < 0 && ret > 0) | 156 | if (err < 0 && ret > 0) |
157 | ret = err; | 157 | ret = err; |
158 | } | 158 | } |
diff --git a/fs/jfs/xattr.c b/fs/jfs/xattr.c index 3bd5ee45f7b3..46325d5c34fc 100644 --- a/fs/jfs/xattr.c +++ b/fs/jfs/xattr.c | |||
@@ -854,9 +854,6 @@ int jfs_setxattr(struct dentry *dentry, const char *name, const void *value, | |||
854 | int rc; | 854 | int rc; |
855 | tid_t tid; | 855 | tid_t tid; |
856 | 856 | ||
857 | if ((rc = can_set_xattr(inode, name, value, value_len))) | ||
858 | return rc; | ||
859 | |||
860 | /* | 857 | /* |
861 | * If this is a request for a synthetic attribute in the system.* | 858 | * If this is a request for a synthetic attribute in the system.* |
862 | * namespace use the generic infrastructure to resolve a handler | 859 | * namespace use the generic infrastructure to resolve a handler |
@@ -865,6 +862,9 @@ int jfs_setxattr(struct dentry *dentry, const char *name, const void *value, | |||
865 | if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) | 862 | if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) |
866 | return generic_setxattr(dentry, name, value, value_len, flags); | 863 | return generic_setxattr(dentry, name, value, value_len, flags); |
867 | 864 | ||
865 | if ((rc = can_set_xattr(inode, name, value, value_len))) | ||
866 | return rc; | ||
867 | |||
868 | if (value == NULL) { /* empty EA, do not remove */ | 868 | if (value == NULL) { /* empty EA, do not remove */ |
869 | value = ""; | 869 | value = ""; |
870 | value_len = 0; | 870 | value_len = 0; |
@@ -1034,9 +1034,6 @@ int jfs_removexattr(struct dentry *dentry, const char *name) | |||
1034 | int rc; | 1034 | int rc; |
1035 | tid_t tid; | 1035 | tid_t tid; |
1036 | 1036 | ||
1037 | if ((rc = can_set_xattr(inode, name, NULL, 0))) | ||
1038 | return rc; | ||
1039 | |||
1040 | /* | 1037 | /* |
1041 | * If this is a request for a synthetic attribute in the system.* | 1038 | * If this is a request for a synthetic attribute in the system.* |
1042 | * namespace use the generic infrastructure to resolve a handler | 1039 | * namespace use the generic infrastructure to resolve a handler |
@@ -1045,6 +1042,9 @@ int jfs_removexattr(struct dentry *dentry, const char *name) | |||
1045 | if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) | 1042 | if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) |
1046 | return generic_removexattr(dentry, name); | 1043 | return generic_removexattr(dentry, name); |
1047 | 1044 | ||
1045 | if ((rc = can_set_xattr(inode, name, NULL, 0))) | ||
1046 | return rc; | ||
1047 | |||
1048 | tid = txBegin(inode->i_sb, 0); | 1048 | tid = txBegin(inode->i_sb, 0); |
1049 | mutex_lock(&ji->commit_mutex); | 1049 | mutex_lock(&ji->commit_mutex); |
1050 | rc = __jfs_setxattr(tid, dentry->d_inode, name, NULL, 0, XATTR_REPLACE); | 1050 | rc = __jfs_setxattr(tid, dentry->d_inode, name, NULL, 0, XATTR_REPLACE); |
@@ -1061,7 +1061,7 @@ int jfs_removexattr(struct dentry *dentry, const char *name) | |||
1061 | * attributes are handled directly. | 1061 | * attributes are handled directly. |
1062 | */ | 1062 | */ |
1063 | const struct xattr_handler *jfs_xattr_handlers[] = { | 1063 | const struct xattr_handler *jfs_xattr_handlers[] = { |
1064 | #ifdef JFS_POSIX_ACL | 1064 | #ifdef CONFIG_JFS_POSIX_ACL |
1065 | &posix_acl_access_xattr_handler, | 1065 | &posix_acl_access_xattr_handler, |
1066 | &posix_acl_default_xattr_handler, | 1066 | &posix_acl_default_xattr_handler, |
1067 | #endif | 1067 | #endif |
diff --git a/fs/namei.c b/fs/namei.c index d580df2e6804..385f7817bfcc 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -196,6 +196,7 @@ recopy: | |||
196 | goto error; | 196 | goto error; |
197 | 197 | ||
198 | result->uptr = filename; | 198 | result->uptr = filename; |
199 | result->aname = NULL; | ||
199 | audit_getname(result); | 200 | audit_getname(result); |
200 | return result; | 201 | return result; |
201 | 202 | ||
@@ -210,6 +211,35 @@ getname(const char __user * filename) | |||
210 | return getname_flags(filename, 0, NULL); | 211 | return getname_flags(filename, 0, NULL); |
211 | } | 212 | } |
212 | 213 | ||
214 | /* | ||
215 | * The "getname_kernel()" interface doesn't do pathnames longer | ||
216 | * than EMBEDDED_NAME_MAX. Deal with it - you're a kernel user. | ||
217 | */ | ||
218 | struct filename * | ||
219 | getname_kernel(const char * filename) | ||
220 | { | ||
221 | struct filename *result; | ||
222 | char *kname; | ||
223 | int len; | ||
224 | |||
225 | len = strlen(filename); | ||
226 | if (len >= EMBEDDED_NAME_MAX) | ||
227 | return ERR_PTR(-ENAMETOOLONG); | ||
228 | |||
229 | result = __getname(); | ||
230 | if (unlikely(!result)) | ||
231 | return ERR_PTR(-ENOMEM); | ||
232 | |||
233 | kname = (char *)result + sizeof(*result); | ||
234 | result->name = kname; | ||
235 | result->uptr = NULL; | ||
236 | result->aname = NULL; | ||
237 | result->separate = false; | ||
238 | |||
239 | strlcpy(kname, filename, EMBEDDED_NAME_MAX); | ||
240 | return result; | ||
241 | } | ||
242 | |||
213 | #ifdef CONFIG_AUDITSYSCALL | 243 | #ifdef CONFIG_AUDITSYSCALL |
214 | void putname(struct filename *name) | 244 | void putname(struct filename *name) |
215 | { | 245 | { |
diff --git a/fs/nfs/nfs3acl.c b/fs/nfs/nfs3acl.c index 9a5ca03fa539..871d6eda8dba 100644 --- a/fs/nfs/nfs3acl.c +++ b/fs/nfs/nfs3acl.c | |||
@@ -80,7 +80,7 @@ struct posix_acl *nfs3_get_acl(struct inode *inode, int type) | |||
80 | } | 80 | } |
81 | 81 | ||
82 | if (res.acl_access != NULL) { | 82 | if (res.acl_access != NULL) { |
83 | if (posix_acl_equiv_mode(res.acl_access, NULL) || | 83 | if ((posix_acl_equiv_mode(res.acl_access, NULL) == 0) || |
84 | res.acl_access->a_count == 0) { | 84 | res.acl_access->a_count == 0) { |
85 | posix_acl_release(res.acl_access); | 85 | posix_acl_release(res.acl_access); |
86 | res.acl_access = NULL; | 86 | res.acl_access = NULL; |
@@ -113,7 +113,7 @@ getout: | |||
113 | return ERR_PTR(status); | 113 | return ERR_PTR(status); |
114 | } | 114 | } |
115 | 115 | ||
116 | int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl, | 116 | static int __nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl, |
117 | struct posix_acl *dfacl) | 117 | struct posix_acl *dfacl) |
118 | { | 118 | { |
119 | struct nfs_server *server = NFS_SERVER(inode); | 119 | struct nfs_server *server = NFS_SERVER(inode); |
@@ -198,6 +198,15 @@ out: | |||
198 | return status; | 198 | return status; |
199 | } | 199 | } |
200 | 200 | ||
201 | int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl, | ||
202 | struct posix_acl *dfacl) | ||
203 | { | ||
204 | int ret; | ||
205 | ret = __nfs3_proc_setacls(inode, acl, dfacl); | ||
206 | return (ret == -EOPNOTSUPP) ? 0 : ret; | ||
207 | |||
208 | } | ||
209 | |||
201 | int nfs3_set_acl(struct inode *inode, struct posix_acl *acl, int type) | 210 | int nfs3_set_acl(struct inode *inode, struct posix_acl *acl, int type) |
202 | { | 211 | { |
203 | struct posix_acl *alloc = NULL, *dfacl = NULL; | 212 | struct posix_acl *alloc = NULL, *dfacl = NULL; |
@@ -225,7 +234,7 @@ int nfs3_set_acl(struct inode *inode, struct posix_acl *acl, int type) | |||
225 | if (IS_ERR(alloc)) | 234 | if (IS_ERR(alloc)) |
226 | goto fail; | 235 | goto fail; |
227 | } | 236 | } |
228 | status = nfs3_proc_setacls(inode, acl, dfacl); | 237 | status = __nfs3_proc_setacls(inode, acl, dfacl); |
229 | posix_acl_release(alloc); | 238 | posix_acl_release(alloc); |
230 | return status; | 239 | return status; |
231 | 240 | ||
@@ -233,25 +242,6 @@ fail: | |||
233 | return PTR_ERR(alloc); | 242 | return PTR_ERR(alloc); |
234 | } | 243 | } |
235 | 244 | ||
236 | int nfs3_proc_set_default_acl(struct inode *dir, struct inode *inode, | ||
237 | umode_t mode) | ||
238 | { | ||
239 | struct posix_acl *default_acl, *acl; | ||
240 | int error; | ||
241 | |||
242 | error = posix_acl_create(dir, &mode, &default_acl, &acl); | ||
243 | if (error) | ||
244 | return (error == -EOPNOTSUPP) ? 0 : error; | ||
245 | |||
246 | error = nfs3_proc_setacls(inode, acl, default_acl); | ||
247 | |||
248 | if (acl) | ||
249 | posix_acl_release(acl); | ||
250 | if (default_acl) | ||
251 | posix_acl_release(default_acl); | ||
252 | return error; | ||
253 | } | ||
254 | |||
255 | const struct xattr_handler *nfs3_xattr_handlers[] = { | 245 | const struct xattr_handler *nfs3_xattr_handlers[] = { |
256 | &posix_acl_access_xattr_handler, | 246 | &posix_acl_access_xattr_handler, |
257 | &posix_acl_default_xattr_handler, | 247 | &posix_acl_default_xattr_handler, |
diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index dbb3e1f30c68..860ad26a5590 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c | |||
@@ -170,7 +170,7 @@ void nfs41_shutdown_client(struct nfs_client *clp) | |||
170 | void nfs40_shutdown_client(struct nfs_client *clp) | 170 | void nfs40_shutdown_client(struct nfs_client *clp) |
171 | { | 171 | { |
172 | if (clp->cl_slot_tbl) { | 172 | if (clp->cl_slot_tbl) { |
173 | nfs4_release_slot_table(clp->cl_slot_tbl); | 173 | nfs4_shutdown_slot_table(clp->cl_slot_tbl); |
174 | kfree(clp->cl_slot_tbl); | 174 | kfree(clp->cl_slot_tbl); |
175 | } | 175 | } |
176 | } | 176 | } |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 42da6af77587..2da6a698b8f7 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -1620,15 +1620,15 @@ static void nfs4_open_confirm_prepare(struct rpc_task *task, void *calldata) | |||
1620 | { | 1620 | { |
1621 | struct nfs4_opendata *data = calldata; | 1621 | struct nfs4_opendata *data = calldata; |
1622 | 1622 | ||
1623 | nfs40_setup_sequence(data->o_arg.server, &data->o_arg.seq_args, | 1623 | nfs40_setup_sequence(data->o_arg.server, &data->c_arg.seq_args, |
1624 | &data->o_res.seq_res, task); | 1624 | &data->c_res.seq_res, task); |
1625 | } | 1625 | } |
1626 | 1626 | ||
1627 | static void nfs4_open_confirm_done(struct rpc_task *task, void *calldata) | 1627 | static void nfs4_open_confirm_done(struct rpc_task *task, void *calldata) |
1628 | { | 1628 | { |
1629 | struct nfs4_opendata *data = calldata; | 1629 | struct nfs4_opendata *data = calldata; |
1630 | 1630 | ||
1631 | nfs40_sequence_done(task, &data->o_res.seq_res); | 1631 | nfs40_sequence_done(task, &data->c_res.seq_res); |
1632 | 1632 | ||
1633 | data->rpc_status = task->tk_status; | 1633 | data->rpc_status = task->tk_status; |
1634 | if (data->rpc_status == 0) { | 1634 | if (data->rpc_status == 0) { |
@@ -1686,7 +1686,7 @@ static int _nfs4_proc_open_confirm(struct nfs4_opendata *data) | |||
1686 | }; | 1686 | }; |
1687 | int status; | 1687 | int status; |
1688 | 1688 | ||
1689 | nfs4_init_sequence(&data->o_arg.seq_args, &data->o_res.seq_res, 1); | 1689 | nfs4_init_sequence(&data->c_arg.seq_args, &data->c_res.seq_res, 1); |
1690 | kref_get(&data->kref); | 1690 | kref_get(&data->kref); |
1691 | data->rpc_done = 0; | 1691 | data->rpc_done = 0; |
1692 | data->rpc_status = 0; | 1692 | data->rpc_status = 0; |
diff --git a/fs/nfs/nfs4session.c b/fs/nfs/nfs4session.c index cf883c7ae053..e799dc3c3b1d 100644 --- a/fs/nfs/nfs4session.c +++ b/fs/nfs/nfs4session.c | |||
@@ -231,14 +231,23 @@ out: | |||
231 | return ret; | 231 | return ret; |
232 | } | 232 | } |
233 | 233 | ||
234 | /* | ||
235 | * nfs4_release_slot_table - release all slot table entries | ||
236 | */ | ||
237 | static void nfs4_release_slot_table(struct nfs4_slot_table *tbl) | ||
238 | { | ||
239 | nfs4_shrink_slot_table(tbl, 0); | ||
240 | } | ||
241 | |||
234 | /** | 242 | /** |
235 | * nfs4_release_slot_table - release resources attached to a slot table | 243 | * nfs4_shutdown_slot_table - release resources attached to a slot table |
236 | * @tbl: slot table to shut down | 244 | * @tbl: slot table to shut down |
237 | * | 245 | * |
238 | */ | 246 | */ |
239 | void nfs4_release_slot_table(struct nfs4_slot_table *tbl) | 247 | void nfs4_shutdown_slot_table(struct nfs4_slot_table *tbl) |
240 | { | 248 | { |
241 | nfs4_shrink_slot_table(tbl, 0); | 249 | nfs4_release_slot_table(tbl); |
250 | rpc_destroy_wait_queue(&tbl->slot_tbl_waitq); | ||
242 | } | 251 | } |
243 | 252 | ||
244 | /** | 253 | /** |
@@ -422,7 +431,7 @@ void nfs41_update_target_slotid(struct nfs4_slot_table *tbl, | |||
422 | spin_unlock(&tbl->slot_tbl_lock); | 431 | spin_unlock(&tbl->slot_tbl_lock); |
423 | } | 432 | } |
424 | 433 | ||
425 | static void nfs4_destroy_session_slot_tables(struct nfs4_session *session) | 434 | static void nfs4_release_session_slot_tables(struct nfs4_session *session) |
426 | { | 435 | { |
427 | nfs4_release_slot_table(&session->fc_slot_table); | 436 | nfs4_release_slot_table(&session->fc_slot_table); |
428 | nfs4_release_slot_table(&session->bc_slot_table); | 437 | nfs4_release_slot_table(&session->bc_slot_table); |
@@ -450,7 +459,7 @@ int nfs4_setup_session_slot_tables(struct nfs4_session *ses) | |||
450 | if (status && tbl->slots == NULL) | 459 | if (status && tbl->slots == NULL) |
451 | /* Fore and back channel share a connection so get | 460 | /* Fore and back channel share a connection so get |
452 | * both slot tables or neither */ | 461 | * both slot tables or neither */ |
453 | nfs4_destroy_session_slot_tables(ses); | 462 | nfs4_release_session_slot_tables(ses); |
454 | return status; | 463 | return status; |
455 | } | 464 | } |
456 | 465 | ||
@@ -470,6 +479,12 @@ struct nfs4_session *nfs4_alloc_session(struct nfs_client *clp) | |||
470 | return session; | 479 | return session; |
471 | } | 480 | } |
472 | 481 | ||
482 | static void nfs4_destroy_session_slot_tables(struct nfs4_session *session) | ||
483 | { | ||
484 | nfs4_shutdown_slot_table(&session->fc_slot_table); | ||
485 | nfs4_shutdown_slot_table(&session->bc_slot_table); | ||
486 | } | ||
487 | |||
473 | void nfs4_destroy_session(struct nfs4_session *session) | 488 | void nfs4_destroy_session(struct nfs4_session *session) |
474 | { | 489 | { |
475 | struct rpc_xprt *xprt; | 490 | struct rpc_xprt *xprt; |
diff --git a/fs/nfs/nfs4session.h b/fs/nfs/nfs4session.h index 232306100651..b34ada9bc6a2 100644 --- a/fs/nfs/nfs4session.h +++ b/fs/nfs/nfs4session.h | |||
@@ -74,7 +74,7 @@ enum nfs4_session_state { | |||
74 | 74 | ||
75 | extern int nfs4_setup_slot_table(struct nfs4_slot_table *tbl, | 75 | extern int nfs4_setup_slot_table(struct nfs4_slot_table *tbl, |
76 | unsigned int max_reqs, const char *queue); | 76 | unsigned int max_reqs, const char *queue); |
77 | extern void nfs4_release_slot_table(struct nfs4_slot_table *tbl); | 77 | extern void nfs4_shutdown_slot_table(struct nfs4_slot_table *tbl); |
78 | extern struct nfs4_slot *nfs4_alloc_slot(struct nfs4_slot_table *tbl); | 78 | extern struct nfs4_slot *nfs4_alloc_slot(struct nfs4_slot_table *tbl); |
79 | extern void nfs4_free_slot(struct nfs4_slot_table *tbl, struct nfs4_slot *slot); | 79 | extern void nfs4_free_slot(struct nfs4_slot_table *tbl, struct nfs4_slot *slot); |
80 | extern void nfs4_slot_tbl_drain_complete(struct nfs4_slot_table *tbl); | 80 | extern void nfs4_slot_tbl_drain_complete(struct nfs4_slot_table *tbl); |
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c index ea4ba9daeb47..db9bd8a31725 100644 --- a/fs/ntfs/file.c +++ b/fs/ntfs/file.c | |||
@@ -2134,7 +2134,7 @@ static ssize_t ntfs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
2134 | ret = ntfs_file_aio_write_nolock(iocb, iov, nr_segs, &iocb->ki_pos); | 2134 | ret = ntfs_file_aio_write_nolock(iocb, iov, nr_segs, &iocb->ki_pos); |
2135 | mutex_unlock(&inode->i_mutex); | 2135 | mutex_unlock(&inode->i_mutex); |
2136 | if (ret > 0) { | 2136 | if (ret > 0) { |
2137 | int err = generic_write_sync(file, pos, ret); | 2137 | int err = generic_write_sync(file, iocb->ki_pos - ret, ret); |
2138 | if (err < 0) | 2138 | if (err < 0) |
2139 | ret = err; | 2139 | ret = err; |
2140 | } | 2140 | } |
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 8750ae1b8636..aada5801567a 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -4742,6 +4742,7 @@ int ocfs2_add_clusters_in_btree(handle_t *handle, | |||
4742 | enum ocfs2_alloc_restarted *reason_ret) | 4742 | enum ocfs2_alloc_restarted *reason_ret) |
4743 | { | 4743 | { |
4744 | int status = 0, err = 0; | 4744 | int status = 0, err = 0; |
4745 | int need_free = 0; | ||
4745 | int free_extents; | 4746 | int free_extents; |
4746 | enum ocfs2_alloc_restarted reason = RESTART_NONE; | 4747 | enum ocfs2_alloc_restarted reason = RESTART_NONE; |
4747 | u32 bit_off, num_bits; | 4748 | u32 bit_off, num_bits; |
@@ -4796,7 +4797,8 @@ int ocfs2_add_clusters_in_btree(handle_t *handle, | |||
4796 | OCFS2_JOURNAL_ACCESS_WRITE); | 4797 | OCFS2_JOURNAL_ACCESS_WRITE); |
4797 | if (status < 0) { | 4798 | if (status < 0) { |
4798 | mlog_errno(status); | 4799 | mlog_errno(status); |
4799 | goto leave; | 4800 | need_free = 1; |
4801 | goto bail; | ||
4800 | } | 4802 | } |
4801 | 4803 | ||
4802 | block = ocfs2_clusters_to_blocks(osb->sb, bit_off); | 4804 | block = ocfs2_clusters_to_blocks(osb->sb, bit_off); |
@@ -4807,7 +4809,8 @@ int ocfs2_add_clusters_in_btree(handle_t *handle, | |||
4807 | num_bits, flags, meta_ac); | 4809 | num_bits, flags, meta_ac); |
4808 | if (status < 0) { | 4810 | if (status < 0) { |
4809 | mlog_errno(status); | 4811 | mlog_errno(status); |
4810 | goto leave; | 4812 | need_free = 1; |
4813 | goto bail; | ||
4811 | } | 4814 | } |
4812 | 4815 | ||
4813 | ocfs2_journal_dirty(handle, et->et_root_bh); | 4816 | ocfs2_journal_dirty(handle, et->et_root_bh); |
@@ -4821,6 +4824,19 @@ int ocfs2_add_clusters_in_btree(handle_t *handle, | |||
4821 | reason = RESTART_TRANS; | 4824 | reason = RESTART_TRANS; |
4822 | } | 4825 | } |
4823 | 4826 | ||
4827 | bail: | ||
4828 | if (need_free) { | ||
4829 | if (data_ac->ac_which == OCFS2_AC_USE_LOCAL) | ||
4830 | ocfs2_free_local_alloc_bits(osb, handle, data_ac, | ||
4831 | bit_off, num_bits); | ||
4832 | else | ||
4833 | ocfs2_free_clusters(handle, | ||
4834 | data_ac->ac_inode, | ||
4835 | data_ac->ac_bh, | ||
4836 | ocfs2_clusters_to_blocks(osb->sb, bit_off), | ||
4837 | num_bits); | ||
4838 | } | ||
4839 | |||
4824 | leave: | 4840 | leave: |
4825 | if (reason_ret) | 4841 | if (reason_ret) |
4826 | *reason_ret = reason; | 4842 | *reason_ret = reason; |
@@ -6805,6 +6821,8 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode, | |||
6805 | struct buffer_head *di_bh) | 6821 | struct buffer_head *di_bh) |
6806 | { | 6822 | { |
6807 | int ret, i, has_data, num_pages = 0; | 6823 | int ret, i, has_data, num_pages = 0; |
6824 | int need_free = 0; | ||
6825 | u32 bit_off, num; | ||
6808 | handle_t *handle; | 6826 | handle_t *handle; |
6809 | u64 uninitialized_var(block); | 6827 | u64 uninitialized_var(block); |
6810 | struct ocfs2_inode_info *oi = OCFS2_I(inode); | 6828 | struct ocfs2_inode_info *oi = OCFS2_I(inode); |
@@ -6850,7 +6868,6 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode, | |||
6850 | } | 6868 | } |
6851 | 6869 | ||
6852 | if (has_data) { | 6870 | if (has_data) { |
6853 | u32 bit_off, num; | ||
6854 | unsigned int page_end; | 6871 | unsigned int page_end; |
6855 | u64 phys; | 6872 | u64 phys; |
6856 | 6873 | ||
@@ -6886,6 +6903,7 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode, | |||
6886 | ret = ocfs2_grab_eof_pages(inode, 0, end, pages, &num_pages); | 6903 | ret = ocfs2_grab_eof_pages(inode, 0, end, pages, &num_pages); |
6887 | if (ret) { | 6904 | if (ret) { |
6888 | mlog_errno(ret); | 6905 | mlog_errno(ret); |
6906 | need_free = 1; | ||
6889 | goto out_commit; | 6907 | goto out_commit; |
6890 | } | 6908 | } |
6891 | 6909 | ||
@@ -6896,6 +6914,7 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode, | |||
6896 | ret = ocfs2_read_inline_data(inode, pages[0], di_bh); | 6914 | ret = ocfs2_read_inline_data(inode, pages[0], di_bh); |
6897 | if (ret) { | 6915 | if (ret) { |
6898 | mlog_errno(ret); | 6916 | mlog_errno(ret); |
6917 | need_free = 1; | ||
6899 | goto out_commit; | 6918 | goto out_commit; |
6900 | } | 6919 | } |
6901 | 6920 | ||
@@ -6927,6 +6946,7 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode, | |||
6927 | ret = ocfs2_insert_extent(handle, &et, 0, block, 1, 0, NULL); | 6946 | ret = ocfs2_insert_extent(handle, &et, 0, block, 1, 0, NULL); |
6928 | if (ret) { | 6947 | if (ret) { |
6929 | mlog_errno(ret); | 6948 | mlog_errno(ret); |
6949 | need_free = 1; | ||
6930 | goto out_commit; | 6950 | goto out_commit; |
6931 | } | 6951 | } |
6932 | 6952 | ||
@@ -6938,6 +6958,18 @@ out_commit: | |||
6938 | dquot_free_space_nodirty(inode, | 6958 | dquot_free_space_nodirty(inode, |
6939 | ocfs2_clusters_to_bytes(osb->sb, 1)); | 6959 | ocfs2_clusters_to_bytes(osb->sb, 1)); |
6940 | 6960 | ||
6961 | if (need_free) { | ||
6962 | if (data_ac->ac_which == OCFS2_AC_USE_LOCAL) | ||
6963 | ocfs2_free_local_alloc_bits(osb, handle, data_ac, | ||
6964 | bit_off, num); | ||
6965 | else | ||
6966 | ocfs2_free_clusters(handle, | ||
6967 | data_ac->ac_inode, | ||
6968 | data_ac->ac_bh, | ||
6969 | ocfs2_clusters_to_blocks(osb->sb, bit_off), | ||
6970 | num); | ||
6971 | } | ||
6972 | |||
6941 | ocfs2_commit_trans(osb, handle); | 6973 | ocfs2_commit_trans(osb, handle); |
6942 | 6974 | ||
6943 | out_unlock: | 6975 | out_unlock: |
diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c index cd5496b7a0a3..044013455621 100644 --- a/fs/ocfs2/localalloc.c +++ b/fs/ocfs2/localalloc.c | |||
@@ -781,6 +781,48 @@ bail: | |||
781 | return status; | 781 | return status; |
782 | } | 782 | } |
783 | 783 | ||
784 | int ocfs2_free_local_alloc_bits(struct ocfs2_super *osb, | ||
785 | handle_t *handle, | ||
786 | struct ocfs2_alloc_context *ac, | ||
787 | u32 bit_off, | ||
788 | u32 num_bits) | ||
789 | { | ||
790 | int status, start; | ||
791 | u32 clear_bits; | ||
792 | struct inode *local_alloc_inode; | ||
793 | void *bitmap; | ||
794 | struct ocfs2_dinode *alloc; | ||
795 | struct ocfs2_local_alloc *la; | ||
796 | |||
797 | BUG_ON(ac->ac_which != OCFS2_AC_USE_LOCAL); | ||
798 | |||
799 | local_alloc_inode = ac->ac_inode; | ||
800 | alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data; | ||
801 | la = OCFS2_LOCAL_ALLOC(alloc); | ||
802 | |||
803 | bitmap = la->la_bitmap; | ||
804 | start = bit_off - le32_to_cpu(la->la_bm_off); | ||
805 | clear_bits = num_bits; | ||
806 | |||
807 | status = ocfs2_journal_access_di(handle, | ||
808 | INODE_CACHE(local_alloc_inode), | ||
809 | osb->local_alloc_bh, | ||
810 | OCFS2_JOURNAL_ACCESS_WRITE); | ||
811 | if (status < 0) { | ||
812 | mlog_errno(status); | ||
813 | goto bail; | ||
814 | } | ||
815 | |||
816 | while (clear_bits--) | ||
817 | ocfs2_clear_bit(start++, bitmap); | ||
818 | |||
819 | le32_add_cpu(&alloc->id1.bitmap1.i_used, -num_bits); | ||
820 | ocfs2_journal_dirty(handle, osb->local_alloc_bh); | ||
821 | |||
822 | bail: | ||
823 | return status; | ||
824 | } | ||
825 | |||
784 | static u32 ocfs2_local_alloc_count_bits(struct ocfs2_dinode *alloc) | 826 | static u32 ocfs2_local_alloc_count_bits(struct ocfs2_dinode *alloc) |
785 | { | 827 | { |
786 | u32 count; | 828 | u32 count; |
diff --git a/fs/ocfs2/localalloc.h b/fs/ocfs2/localalloc.h index 1be9b5864460..44a7d1fb2dec 100644 --- a/fs/ocfs2/localalloc.h +++ b/fs/ocfs2/localalloc.h | |||
@@ -55,6 +55,12 @@ int ocfs2_claim_local_alloc_bits(struct ocfs2_super *osb, | |||
55 | u32 *bit_off, | 55 | u32 *bit_off, |
56 | u32 *num_bits); | 56 | u32 *num_bits); |
57 | 57 | ||
58 | int ocfs2_free_local_alloc_bits(struct ocfs2_super *osb, | ||
59 | handle_t *handle, | ||
60 | struct ocfs2_alloc_context *ac, | ||
61 | u32 bit_off, | ||
62 | u32 num_bits); | ||
63 | |||
58 | void ocfs2_local_alloc_seen_free_bits(struct ocfs2_super *osb, | 64 | void ocfs2_local_alloc_seen_free_bits(struct ocfs2_super *osb, |
59 | unsigned int num_clusters); | 65 | unsigned int num_clusters); |
60 | void ocfs2_la_enable_worker(struct work_struct *work); | 66 | void ocfs2_la_enable_worker(struct work_struct *work); |
diff --git a/fs/posix_acl.c b/fs/posix_acl.c index 38bae5a0ea25..11c54fd51e16 100644 --- a/fs/posix_acl.c +++ b/fs/posix_acl.c | |||
@@ -521,8 +521,11 @@ posix_acl_chmod(struct inode *inode, umode_t mode) | |||
521 | return -EOPNOTSUPP; | 521 | return -EOPNOTSUPP; |
522 | 522 | ||
523 | acl = get_acl(inode, ACL_TYPE_ACCESS); | 523 | acl = get_acl(inode, ACL_TYPE_ACCESS); |
524 | if (IS_ERR_OR_NULL(acl)) | 524 | if (IS_ERR_OR_NULL(acl)) { |
525 | if (acl == ERR_PTR(-EOPNOTSUPP)) | ||
526 | return 0; | ||
525 | return PTR_ERR(acl); | 527 | return PTR_ERR(acl); |
528 | } | ||
526 | 529 | ||
527 | ret = __posix_acl_chmod(&acl, GFP_KERNEL, mode); | 530 | ret = __posix_acl_chmod(&acl, GFP_KERNEL, mode); |
528 | if (ret) | 531 | if (ret) |
@@ -544,14 +547,15 @@ posix_acl_create(struct inode *dir, umode_t *mode, | |||
544 | goto no_acl; | 547 | goto no_acl; |
545 | 548 | ||
546 | p = get_acl(dir, ACL_TYPE_DEFAULT); | 549 | p = get_acl(dir, ACL_TYPE_DEFAULT); |
547 | if (IS_ERR(p)) | 550 | if (IS_ERR(p)) { |
551 | if (p == ERR_PTR(-EOPNOTSUPP)) | ||
552 | goto apply_umask; | ||
548 | return PTR_ERR(p); | 553 | return PTR_ERR(p); |
549 | |||
550 | if (!p) { | ||
551 | *mode &= ~current_umask(); | ||
552 | goto no_acl; | ||
553 | } | 554 | } |
554 | 555 | ||
556 | if (!p) | ||
557 | goto apply_umask; | ||
558 | |||
555 | *acl = posix_acl_clone(p, GFP_NOFS); | 559 | *acl = posix_acl_clone(p, GFP_NOFS); |
556 | if (!*acl) | 560 | if (!*acl) |
557 | return -ENOMEM; | 561 | return -ENOMEM; |
@@ -575,6 +579,8 @@ posix_acl_create(struct inode *dir, umode_t *mode, | |||
575 | } | 579 | } |
576 | return 0; | 580 | return 0; |
577 | 581 | ||
582 | apply_umask: | ||
583 | *mode &= ~current_umask(); | ||
578 | no_acl: | 584 | no_acl: |
579 | *default_acl = NULL; | 585 | *default_acl = NULL; |
580 | *acl = NULL; | 586 | *acl = NULL; |
@@ -222,23 +222,6 @@ SYSCALL_DEFINE1(fdatasync, unsigned int, fd) | |||
222 | return do_fsync(fd, 1); | 222 | return do_fsync(fd, 1); |
223 | } | 223 | } |
224 | 224 | ||
225 | /** | ||
226 | * generic_write_sync - perform syncing after a write if file / inode is sync | ||
227 | * @file: file to which the write happened | ||
228 | * @pos: offset where the write started | ||
229 | * @count: length of the write | ||
230 | * | ||
231 | * This is just a simple wrapper about our general syncing function. | ||
232 | */ | ||
233 | int generic_write_sync(struct file *file, loff_t pos, loff_t count) | ||
234 | { | ||
235 | if (!(file->f_flags & O_DSYNC) && !IS_SYNC(file->f_mapping->host)) | ||
236 | return 0; | ||
237 | return vfs_fsync_range(file, pos, pos + count - 1, | ||
238 | (file->f_flags & __O_SYNC) ? 0 : 1); | ||
239 | } | ||
240 | EXPORT_SYMBOL(generic_write_sync); | ||
241 | |||
242 | /* | 225 | /* |
243 | * sys_sync_file_range() permits finely controlled syncing over a segment of | 226 | * sys_sync_file_range() permits finely controlled syncing over a segment of |
244 | * a file in the range offset .. (offset+nbytes-1) inclusive. If nbytes is | 227 | * a file in the range offset .. (offset+nbytes-1) inclusive. If nbytes is |
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 2e7989e3a2d6..64b48eade91d 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c | |||
@@ -799,7 +799,7 @@ xfs_file_aio_write( | |||
799 | XFS_STATS_ADD(xs_write_bytes, ret); | 799 | XFS_STATS_ADD(xs_write_bytes, ret); |
800 | 800 | ||
801 | /* Handle various SYNC-type writes */ | 801 | /* Handle various SYNC-type writes */ |
802 | err = generic_write_sync(file, pos, ret); | 802 | err = generic_write_sync(file, iocb->ki_pos - ret, ret); |
803 | if (err < 0) | 803 | if (err < 0) |
804 | ret = err; | 804 | ret = err; |
805 | } | 805 | } |