diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/binfmt_elf.c | 12 | ||||
-rw-r--r-- | fs/block_dev.c | 14 | ||||
-rw-r--r-- | fs/coda/sysctl.c | 5 | ||||
-rw-r--r-- | fs/dcache.c | 14 | ||||
-rw-r--r-- | fs/dquot.c | 2 | ||||
-rw-r--r-- | fs/ext2/ialloc.c | 8 | ||||
-rw-r--r-- | fs/ext2/inode.c | 2 | ||||
-rw-r--r-- | fs/ext2/ioctl.c | 3 | ||||
-rw-r--r-- | fs/ext2/super.c | 10 | ||||
-rw-r--r-- | fs/ext3/ialloc.c | 8 | ||||
-rw-r--r-- | fs/ext3/ioctl.c | 3 | ||||
-rw-r--r-- | fs/ext3/namei.c | 4 | ||||
-rw-r--r-- | fs/ext3/super.c | 10 | ||||
-rw-r--r-- | fs/ext4/extents.c | 2 | ||||
-rw-r--r-- | fs/ext4/namei.c | 4 | ||||
-rw-r--r-- | fs/jbd/commit.c | 15 | ||||
-rw-r--r-- | fs/jbd/transaction.c | 39 | ||||
-rw-r--r-- | fs/ocfs2/alloc.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/dlmglue.c | 4 | ||||
-rw-r--r-- | fs/ocfs2/file.c | 2 | ||||
-rw-r--r-- | fs/proc/vmcore.c | 2 | ||||
-rw-r--r-- | fs/romfs/inode.c | 12 | ||||
-rw-r--r-- | fs/splice.c | 1 | ||||
-rw-r--r-- | fs/super.c | 2 |
24 files changed, 122 insertions, 58 deletions
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index c41fa2af7677..e3ff2b9e602f 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -152,8 +152,10 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec, | |||
152 | elf_addr_t __user *sp; | 152 | elf_addr_t __user *sp; |
153 | elf_addr_t __user *u_platform; | 153 | elf_addr_t __user *u_platform; |
154 | elf_addr_t __user *u_base_platform; | 154 | elf_addr_t __user *u_base_platform; |
155 | elf_addr_t __user *u_rand_bytes; | ||
155 | const char *k_platform = ELF_PLATFORM; | 156 | const char *k_platform = ELF_PLATFORM; |
156 | const char *k_base_platform = ELF_BASE_PLATFORM; | 157 | const char *k_base_platform = ELF_BASE_PLATFORM; |
158 | unsigned char k_rand_bytes[16]; | ||
157 | int items; | 159 | int items; |
158 | elf_addr_t *elf_info; | 160 | elf_addr_t *elf_info; |
159 | int ei_index = 0; | 161 | int ei_index = 0; |
@@ -196,6 +198,15 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec, | |||
196 | return -EFAULT; | 198 | return -EFAULT; |
197 | } | 199 | } |
198 | 200 | ||
201 | /* | ||
202 | * Generate 16 random bytes for userspace PRNG seeding. | ||
203 | */ | ||
204 | get_random_bytes(k_rand_bytes, sizeof(k_rand_bytes)); | ||
205 | u_rand_bytes = (elf_addr_t __user *) | ||
206 | STACK_ALLOC(p, sizeof(k_rand_bytes)); | ||
207 | if (__copy_to_user(u_rand_bytes, k_rand_bytes, sizeof(k_rand_bytes))) | ||
208 | return -EFAULT; | ||
209 | |||
199 | /* Create the ELF interpreter info */ | 210 | /* Create the ELF interpreter info */ |
200 | elf_info = (elf_addr_t *)current->mm->saved_auxv; | 211 | elf_info = (elf_addr_t *)current->mm->saved_auxv; |
201 | /* update AT_VECTOR_SIZE_BASE if the number of NEW_AUX_ENT() changes */ | 212 | /* update AT_VECTOR_SIZE_BASE if the number of NEW_AUX_ENT() changes */ |
@@ -228,6 +239,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec, | |||
228 | NEW_AUX_ENT(AT_GID, cred->gid); | 239 | NEW_AUX_ENT(AT_GID, cred->gid); |
229 | NEW_AUX_ENT(AT_EGID, cred->egid); | 240 | NEW_AUX_ENT(AT_EGID, cred->egid); |
230 | NEW_AUX_ENT(AT_SECURE, security_bprm_secureexec(bprm)); | 241 | NEW_AUX_ENT(AT_SECURE, security_bprm_secureexec(bprm)); |
242 | NEW_AUX_ENT(AT_RANDOM, (elf_addr_t)(unsigned long)u_rand_bytes); | ||
231 | NEW_AUX_ENT(AT_EXECFN, bprm->exec); | 243 | NEW_AUX_ENT(AT_EXECFN, bprm->exec); |
232 | if (k_platform) { | 244 | if (k_platform) { |
233 | NEW_AUX_ENT(AT_PLATFORM, | 245 | NEW_AUX_ENT(AT_PLATFORM, |
diff --git a/fs/block_dev.c b/fs/block_dev.c index b957717e25ab..8ebbfdf708c2 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -1005,6 +1005,7 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) | |||
1005 | } | 1005 | } |
1006 | 1006 | ||
1007 | lock_kernel(); | 1007 | lock_kernel(); |
1008 | restart: | ||
1008 | 1009 | ||
1009 | ret = -ENXIO; | 1010 | ret = -ENXIO; |
1010 | disk = get_gendisk(bdev->bd_dev, &partno); | 1011 | disk = get_gendisk(bdev->bd_dev, &partno); |
@@ -1025,6 +1026,19 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) | |||
1025 | 1026 | ||
1026 | if (disk->fops->open) { | 1027 | if (disk->fops->open) { |
1027 | ret = disk->fops->open(bdev, mode); | 1028 | ret = disk->fops->open(bdev, mode); |
1029 | if (ret == -ERESTARTSYS) { | ||
1030 | /* Lost a race with 'disk' being | ||
1031 | * deleted, try again. | ||
1032 | * See md.c | ||
1033 | */ | ||
1034 | disk_put_part(bdev->bd_part); | ||
1035 | bdev->bd_part = NULL; | ||
1036 | module_put(disk->fops->owner); | ||
1037 | put_disk(disk); | ||
1038 | bdev->bd_disk = NULL; | ||
1039 | mutex_unlock(&bdev->bd_mutex); | ||
1040 | goto restart; | ||
1041 | } | ||
1028 | if (ret) | 1042 | if (ret) |
1029 | goto out_clear; | 1043 | goto out_clear; |
1030 | } | 1044 | } |
diff --git a/fs/coda/sysctl.c b/fs/coda/sysctl.c index 81b7771c6465..43c96ce29614 100644 --- a/fs/coda/sysctl.c +++ b/fs/coda/sysctl.c | |||
@@ -11,7 +11,9 @@ | |||
11 | 11 | ||
12 | #include "coda_int.h" | 12 | #include "coda_int.h" |
13 | 13 | ||
14 | #ifdef CONFIG_SYSCTL | ||
14 | static struct ctl_table_header *fs_table_header; | 15 | static struct ctl_table_header *fs_table_header; |
16 | #endif | ||
15 | 17 | ||
16 | static ctl_table coda_table[] = { | 18 | static ctl_table coda_table[] = { |
17 | { | 19 | { |
@@ -41,6 +43,7 @@ static ctl_table coda_table[] = { | |||
41 | {} | 43 | {} |
42 | }; | 44 | }; |
43 | 45 | ||
46 | #ifdef CONFIG_SYSCTL | ||
44 | static ctl_table fs_table[] = { | 47 | static ctl_table fs_table[] = { |
45 | { | 48 | { |
46 | .ctl_name = CTL_UNNUMBERED, | 49 | .ctl_name = CTL_UNNUMBERED, |
@@ -50,7 +53,7 @@ static ctl_table fs_table[] = { | |||
50 | }, | 53 | }, |
51 | {} | 54 | {} |
52 | }; | 55 | }; |
53 | 56 | #endif | |
54 | 57 | ||
55 | void coda_sysctl_init(void) | 58 | void coda_sysctl_init(void) |
56 | { | 59 | { |
diff --git a/fs/dcache.c b/fs/dcache.c index e88c23b85a32..4547f66884a0 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -1567,10 +1567,6 @@ void d_rehash(struct dentry * entry) | |||
1567 | spin_unlock(&dcache_lock); | 1567 | spin_unlock(&dcache_lock); |
1568 | } | 1568 | } |
1569 | 1569 | ||
1570 | #define do_switch(x,y) do { \ | ||
1571 | __typeof__ (x) __tmp = x; \ | ||
1572 | x = y; y = __tmp; } while (0) | ||
1573 | |||
1574 | /* | 1570 | /* |
1575 | * When switching names, the actual string doesn't strictly have to | 1571 | * When switching names, the actual string doesn't strictly have to |
1576 | * be preserved in the target - because we're dropping the target | 1572 | * be preserved in the target - because we're dropping the target |
@@ -1589,7 +1585,7 @@ static void switch_names(struct dentry *dentry, struct dentry *target) | |||
1589 | /* | 1585 | /* |
1590 | * Both external: swap the pointers | 1586 | * Both external: swap the pointers |
1591 | */ | 1587 | */ |
1592 | do_switch(target->d_name.name, dentry->d_name.name); | 1588 | swap(target->d_name.name, dentry->d_name.name); |
1593 | } else { | 1589 | } else { |
1594 | /* | 1590 | /* |
1595 | * dentry:internal, target:external. Steal target's | 1591 | * dentry:internal, target:external. Steal target's |
@@ -1620,7 +1616,7 @@ static void switch_names(struct dentry *dentry, struct dentry *target) | |||
1620 | return; | 1616 | return; |
1621 | } | 1617 | } |
1622 | } | 1618 | } |
1623 | do_switch(dentry->d_name.len, target->d_name.len); | 1619 | swap(dentry->d_name.len, target->d_name.len); |
1624 | } | 1620 | } |
1625 | 1621 | ||
1626 | /* | 1622 | /* |
@@ -1680,7 +1676,7 @@ already_unhashed: | |||
1680 | 1676 | ||
1681 | /* Switch the names.. */ | 1677 | /* Switch the names.. */ |
1682 | switch_names(dentry, target); | 1678 | switch_names(dentry, target); |
1683 | do_switch(dentry->d_name.hash, target->d_name.hash); | 1679 | swap(dentry->d_name.hash, target->d_name.hash); |
1684 | 1680 | ||
1685 | /* ... and switch the parents */ | 1681 | /* ... and switch the parents */ |
1686 | if (IS_ROOT(dentry)) { | 1682 | if (IS_ROOT(dentry)) { |
@@ -1688,7 +1684,7 @@ already_unhashed: | |||
1688 | target->d_parent = target; | 1684 | target->d_parent = target; |
1689 | INIT_LIST_HEAD(&target->d_u.d_child); | 1685 | INIT_LIST_HEAD(&target->d_u.d_child); |
1690 | } else { | 1686 | } else { |
1691 | do_switch(dentry->d_parent, target->d_parent); | 1687 | swap(dentry->d_parent, target->d_parent); |
1692 | 1688 | ||
1693 | /* And add them back to the (new) parent lists */ | 1689 | /* And add them back to the (new) parent lists */ |
1694 | list_add(&target->d_u.d_child, &target->d_parent->d_subdirs); | 1690 | list_add(&target->d_u.d_child, &target->d_parent->d_subdirs); |
@@ -1789,7 +1785,7 @@ static void __d_materialise_dentry(struct dentry *dentry, struct dentry *anon) | |||
1789 | struct dentry *dparent, *aparent; | 1785 | struct dentry *dparent, *aparent; |
1790 | 1786 | ||
1791 | switch_names(dentry, anon); | 1787 | switch_names(dentry, anon); |
1792 | do_switch(dentry->d_name.hash, anon->d_name.hash); | 1788 | swap(dentry->d_name.hash, anon->d_name.hash); |
1793 | 1789 | ||
1794 | dparent = dentry->d_parent; | 1790 | dparent = dentry->d_parent; |
1795 | aparent = anon->d_parent; | 1791 | aparent = anon->d_parent; |
diff --git a/fs/dquot.c b/fs/dquot.c index 61bfff64e5af..48c0571f831d 100644 --- a/fs/dquot.c +++ b/fs/dquot.c | |||
@@ -2090,10 +2090,12 @@ static int do_set_dqblk(struct dquot *dquot, struct if_dqblk *di) | |||
2090 | } | 2090 | } |
2091 | if (di->dqb_valid & QIF_BTIME) { | 2091 | if (di->dqb_valid & QIF_BTIME) { |
2092 | dm->dqb_btime = di->dqb_btime; | 2092 | dm->dqb_btime = di->dqb_btime; |
2093 | check_blim = 1; | ||
2093 | __set_bit(DQ_LASTSET_B + QIF_BTIME_B, &dquot->dq_flags); | 2094 | __set_bit(DQ_LASTSET_B + QIF_BTIME_B, &dquot->dq_flags); |
2094 | } | 2095 | } |
2095 | if (di->dqb_valid & QIF_ITIME) { | 2096 | if (di->dqb_valid & QIF_ITIME) { |
2096 | dm->dqb_itime = di->dqb_itime; | 2097 | dm->dqb_itime = di->dqb_itime; |
2098 | check_ilim = 1; | ||
2097 | __set_bit(DQ_LASTSET_B + QIF_ITIME_B, &dquot->dq_flags); | 2099 | __set_bit(DQ_LASTSET_B + QIF_ITIME_B, &dquot->dq_flags); |
2098 | } | 2100 | } |
2099 | 2101 | ||
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c index c454d5db28a5..66321a877e74 100644 --- a/fs/ext2/ialloc.c +++ b/fs/ext2/ialloc.c | |||
@@ -565,12 +565,8 @@ got: | |||
565 | inode->i_blocks = 0; | 565 | inode->i_blocks = 0; |
566 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC; | 566 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC; |
567 | memset(ei->i_data, 0, sizeof(ei->i_data)); | 567 | memset(ei->i_data, 0, sizeof(ei->i_data)); |
568 | ei->i_flags = EXT2_I(dir)->i_flags & ~EXT2_BTREE_FL; | 568 | ei->i_flags = |
569 | if (S_ISLNK(mode)) | 569 | ext2_mask_flags(mode, EXT2_I(dir)->i_flags & EXT2_FL_INHERITED); |
570 | ei->i_flags &= ~(EXT2_IMMUTABLE_FL|EXT2_APPEND_FL); | ||
571 | /* dirsync is only applied to directories */ | ||
572 | if (!S_ISDIR(mode)) | ||
573 | ei->i_flags &= ~EXT2_DIRSYNC_FL; | ||
574 | ei->i_faddr = 0; | 570 | ei->i_faddr = 0; |
575 | ei->i_frag_no = 0; | 571 | ei->i_frag_no = 0; |
576 | ei->i_frag_size = 0; | 572 | ei->i_frag_size = 0; |
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 02b39a5deb74..23fff2f87783 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c | |||
@@ -498,8 +498,6 @@ static int ext2_alloc_branch(struct inode *inode, | |||
498 | * ext2_splice_branch - splice the allocated branch onto inode. | 498 | * ext2_splice_branch - splice the allocated branch onto inode. |
499 | * @inode: owner | 499 | * @inode: owner |
500 | * @block: (logical) number of block we are adding | 500 | * @block: (logical) number of block we are adding |
501 | * @chain: chain of indirect blocks (with a missing link - see | ||
502 | * ext2_alloc_branch) | ||
503 | * @where: location of missing link | 501 | * @where: location of missing link |
504 | * @num: number of indirect blocks we are adding | 502 | * @num: number of indirect blocks we are adding |
505 | * @blks: number of direct blocks we are adding | 503 | * @blks: number of direct blocks we are adding |
diff --git a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c index de876fa793e1..7cb4badef927 100644 --- a/fs/ext2/ioctl.c +++ b/fs/ext2/ioctl.c | |||
@@ -50,8 +50,7 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
50 | goto setflags_out; | 50 | goto setflags_out; |
51 | } | 51 | } |
52 | 52 | ||
53 | if (!S_ISDIR(inode->i_mode)) | 53 | flags = ext2_mask_flags(inode->i_mode, flags); |
54 | flags &= ~EXT2_DIRSYNC_FL; | ||
55 | 54 | ||
56 | mutex_lock(&inode->i_mutex); | 55 | mutex_lock(&inode->i_mutex); |
57 | /* Is it quota file? Do not allow user to mess with it */ | 56 | /* Is it quota file? Do not allow user to mess with it */ |
diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 647cd888ac87..da8bdeaa2e6d 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c | |||
@@ -132,6 +132,7 @@ static void ext2_put_super (struct super_block * sb) | |||
132 | percpu_counter_destroy(&sbi->s_dirs_counter); | 132 | percpu_counter_destroy(&sbi->s_dirs_counter); |
133 | brelse (sbi->s_sbh); | 133 | brelse (sbi->s_sbh); |
134 | sb->s_fs_info = NULL; | 134 | sb->s_fs_info = NULL; |
135 | kfree(sbi->s_blockgroup_lock); | ||
135 | kfree(sbi); | 136 | kfree(sbi); |
136 | 137 | ||
137 | return; | 138 | return; |
@@ -756,6 +757,13 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
756 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); | 757 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); |
757 | if (!sbi) | 758 | if (!sbi) |
758 | return -ENOMEM; | 759 | return -ENOMEM; |
760 | |||
761 | sbi->s_blockgroup_lock = | ||
762 | kzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL); | ||
763 | if (!sbi->s_blockgroup_lock) { | ||
764 | kfree(sbi); | ||
765 | return -ENOMEM; | ||
766 | } | ||
759 | sb->s_fs_info = sbi; | 767 | sb->s_fs_info = sbi; |
760 | sbi->s_sb_block = sb_block; | 768 | sbi->s_sb_block = sb_block; |
761 | 769 | ||
@@ -983,7 +991,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent) | |||
983 | printk ("EXT2-fs: not enough memory\n"); | 991 | printk ("EXT2-fs: not enough memory\n"); |
984 | goto failed_mount; | 992 | goto failed_mount; |
985 | } | 993 | } |
986 | bgl_lock_init(&sbi->s_blockgroup_lock); | 994 | bgl_lock_init(sbi->s_blockgroup_lock); |
987 | sbi->s_debts = kcalloc(sbi->s_groups_count, sizeof(*sbi->s_debts), GFP_KERNEL); | 995 | sbi->s_debts = kcalloc(sbi->s_groups_count, sizeof(*sbi->s_debts), GFP_KERNEL); |
988 | if (!sbi->s_debts) { | 996 | if (!sbi->s_debts) { |
989 | printk ("EXT2-fs: not enough memory\n"); | 997 | printk ("EXT2-fs: not enough memory\n"); |
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c index 5655fbcbd11f..8de6c720e510 100644 --- a/fs/ext3/ialloc.c +++ b/fs/ext3/ialloc.c | |||
@@ -559,12 +559,8 @@ got: | |||
559 | ei->i_dir_start_lookup = 0; | 559 | ei->i_dir_start_lookup = 0; |
560 | ei->i_disksize = 0; | 560 | ei->i_disksize = 0; |
561 | 561 | ||
562 | ei->i_flags = EXT3_I(dir)->i_flags & ~EXT3_INDEX_FL; | 562 | ei->i_flags = |
563 | if (S_ISLNK(mode)) | 563 | ext3_mask_flags(mode, EXT3_I(dir)->i_flags & EXT3_FL_INHERITED); |
564 | ei->i_flags &= ~(EXT3_IMMUTABLE_FL|EXT3_APPEND_FL); | ||
565 | /* dirsync only applies to directories */ | ||
566 | if (!S_ISDIR(mode)) | ||
567 | ei->i_flags &= ~EXT3_DIRSYNC_FL; | ||
568 | #ifdef EXT3_FRAGMENTS | 564 | #ifdef EXT3_FRAGMENTS |
569 | ei->i_faddr = 0; | 565 | ei->i_faddr = 0; |
570 | ei->i_frag_no = 0; | 566 | ei->i_frag_no = 0; |
diff --git a/fs/ext3/ioctl.c b/fs/ext3/ioctl.c index b7394d05ee8e..5e86ce9a86e0 100644 --- a/fs/ext3/ioctl.c +++ b/fs/ext3/ioctl.c | |||
@@ -53,8 +53,7 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, | |||
53 | goto flags_out; | 53 | goto flags_out; |
54 | } | 54 | } |
55 | 55 | ||
56 | if (!S_ISDIR(inode->i_mode)) | 56 | flags = ext3_mask_flags(inode->i_mode, flags); |
57 | flags &= ~EXT3_DIRSYNC_FL; | ||
58 | 57 | ||
59 | mutex_lock(&inode->i_mutex); | 58 | mutex_lock(&inode->i_mutex); |
60 | /* Is it quota file? Do not allow user to mess with it */ | 59 | /* Is it quota file? Do not allow user to mess with it */ |
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c index 1dd2abe6313e..8d6f965e502c 100644 --- a/fs/ext3/namei.c +++ b/fs/ext3/namei.c | |||
@@ -74,10 +74,6 @@ static struct buffer_head *ext3_append(handle_t *handle, | |||
74 | #define assert(test) J_ASSERT(test) | 74 | #define assert(test) J_ASSERT(test) |
75 | #endif | 75 | #endif |
76 | 76 | ||
77 | #ifndef swap | ||
78 | #define swap(x, y) do { typeof(x) z = x; x = y; y = z; } while (0) | ||
79 | #endif | ||
80 | |||
81 | #ifdef DX_DEBUG | 77 | #ifdef DX_DEBUG |
82 | #define dxtrace(command) command | 78 | #define dxtrace(command) command |
83 | #else | 79 | #else |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index c22d01467bd1..01c235bc2054 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -439,6 +439,7 @@ static void ext3_put_super (struct super_block * sb) | |||
439 | ext3_blkdev_remove(sbi); | 439 | ext3_blkdev_remove(sbi); |
440 | } | 440 | } |
441 | sb->s_fs_info = NULL; | 441 | sb->s_fs_info = NULL; |
442 | kfree(sbi->s_blockgroup_lock); | ||
442 | kfree(sbi); | 443 | kfree(sbi); |
443 | return; | 444 | return; |
444 | } | 445 | } |
@@ -1546,6 +1547,13 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1546 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); | 1547 | sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); |
1547 | if (!sbi) | 1548 | if (!sbi) |
1548 | return -ENOMEM; | 1549 | return -ENOMEM; |
1550 | |||
1551 | sbi->s_blockgroup_lock = | ||
1552 | kzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL); | ||
1553 | if (!sbi->s_blockgroup_lock) { | ||
1554 | kfree(sbi); | ||
1555 | return -ENOMEM; | ||
1556 | } | ||
1549 | sb->s_fs_info = sbi; | 1557 | sb->s_fs_info = sbi; |
1550 | sbi->s_mount_opt = 0; | 1558 | sbi->s_mount_opt = 0; |
1551 | sbi->s_resuid = EXT3_DEF_RESUID; | 1559 | sbi->s_resuid = EXT3_DEF_RESUID; |
@@ -1786,7 +1794,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1786 | goto failed_mount; | 1794 | goto failed_mount; |
1787 | } | 1795 | } |
1788 | 1796 | ||
1789 | bgl_lock_init(&sbi->s_blockgroup_lock); | 1797 | bgl_lock_init(sbi->s_blockgroup_lock); |
1790 | 1798 | ||
1791 | for (i = 0; i < db_count; i++) { | 1799 | for (i = 0; i < db_count; i++) { |
1792 | block = descriptor_loc(sb, logic_sb_block, i); | 1800 | block = descriptor_loc(sb, logic_sb_block, i); |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index ea2ce3c0ae66..3f54db31cdc2 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -2536,7 +2536,7 @@ static int ext4_ext_convert_to_initialized(handle_t *handle, | |||
2536 | */ | 2536 | */ |
2537 | newdepth = ext_depth(inode); | 2537 | newdepth = ext_depth(inode); |
2538 | /* | 2538 | /* |
2539 | * update the extent length after successfull insert of the | 2539 | * update the extent length after successful insert of the |
2540 | * split extent | 2540 | * split extent |
2541 | */ | 2541 | */ |
2542 | orig_ex.ee_len = cpu_to_le16(ee_len - | 2542 | orig_ex.ee_len = cpu_to_le16(ee_len - |
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 9fd2a5e1be4d..4b8d431d7dff 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
@@ -74,10 +74,6 @@ static struct buffer_head *ext4_append(handle_t *handle, | |||
74 | #define assert(test) J_ASSERT(test) | 74 | #define assert(test) J_ASSERT(test) |
75 | #endif | 75 | #endif |
76 | 76 | ||
77 | #ifndef swap | ||
78 | #define swap(x, y) do { typeof(x) z = x; x = y; y = z; } while (0) | ||
79 | #endif | ||
80 | |||
81 | #ifdef DX_DEBUG | 77 | #ifdef DX_DEBUG |
82 | #define dxtrace(command) command | 78 | #define dxtrace(command) command |
83 | #else | 79 | #else |
diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c index 25719d902c51..3fbffb1ea714 100644 --- a/fs/jbd/commit.c +++ b/fs/jbd/commit.c | |||
@@ -306,6 +306,8 @@ void journal_commit_transaction(journal_t *journal) | |||
306 | int flags; | 306 | int flags; |
307 | int err; | 307 | int err; |
308 | unsigned long blocknr; | 308 | unsigned long blocknr; |
309 | ktime_t start_time; | ||
310 | u64 commit_time; | ||
309 | char *tagp = NULL; | 311 | char *tagp = NULL; |
310 | journal_header_t *header; | 312 | journal_header_t *header; |
311 | journal_block_tag_t *tag = NULL; | 313 | journal_block_tag_t *tag = NULL; |
@@ -418,6 +420,7 @@ void journal_commit_transaction(journal_t *journal) | |||
418 | commit_transaction->t_state = T_FLUSH; | 420 | commit_transaction->t_state = T_FLUSH; |
419 | journal->j_committing_transaction = commit_transaction; | 421 | journal->j_committing_transaction = commit_transaction; |
420 | journal->j_running_transaction = NULL; | 422 | journal->j_running_transaction = NULL; |
423 | start_time = ktime_get(); | ||
421 | commit_transaction->t_log_start = journal->j_head; | 424 | commit_transaction->t_log_start = journal->j_head; |
422 | wake_up(&journal->j_wait_transaction_locked); | 425 | wake_up(&journal->j_wait_transaction_locked); |
423 | spin_unlock(&journal->j_state_lock); | 426 | spin_unlock(&journal->j_state_lock); |
@@ -913,6 +916,18 @@ restart_loop: | |||
913 | J_ASSERT(commit_transaction == journal->j_committing_transaction); | 916 | J_ASSERT(commit_transaction == journal->j_committing_transaction); |
914 | journal->j_commit_sequence = commit_transaction->t_tid; | 917 | journal->j_commit_sequence = commit_transaction->t_tid; |
915 | journal->j_committing_transaction = NULL; | 918 | journal->j_committing_transaction = NULL; |
919 | commit_time = ktime_to_ns(ktime_sub(ktime_get(), start_time)); | ||
920 | |||
921 | /* | ||
922 | * weight the commit time higher than the average time so we don't | ||
923 | * react too strongly to vast changes in commit time | ||
924 | */ | ||
925 | if (likely(journal->j_average_commit_time)) | ||
926 | journal->j_average_commit_time = (commit_time*3 + | ||
927 | journal->j_average_commit_time) / 4; | ||
928 | else | ||
929 | journal->j_average_commit_time = commit_time; | ||
930 | |||
916 | spin_unlock(&journal->j_state_lock); | 931 | spin_unlock(&journal->j_state_lock); |
917 | 932 | ||
918 | if (commit_transaction->t_checkpoint_list == NULL && | 933 | if (commit_transaction->t_checkpoint_list == NULL && |
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c index 60d4c32c8808..e6a117431277 100644 --- a/fs/jbd/transaction.c +++ b/fs/jbd/transaction.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/timer.h> | 25 | #include <linux/timer.h> |
26 | #include <linux/mm.h> | 26 | #include <linux/mm.h> |
27 | #include <linux/highmem.h> | 27 | #include <linux/highmem.h> |
28 | #include <linux/hrtimer.h> | ||
28 | 29 | ||
29 | static void __journal_temp_unlink_buffer(struct journal_head *jh); | 30 | static void __journal_temp_unlink_buffer(struct journal_head *jh); |
30 | 31 | ||
@@ -49,6 +50,7 @@ get_transaction(journal_t *journal, transaction_t *transaction) | |||
49 | { | 50 | { |
50 | transaction->t_journal = journal; | 51 | transaction->t_journal = journal; |
51 | transaction->t_state = T_RUNNING; | 52 | transaction->t_state = T_RUNNING; |
53 | transaction->t_start_time = ktime_get(); | ||
52 | transaction->t_tid = journal->j_transaction_sequence++; | 54 | transaction->t_tid = journal->j_transaction_sequence++; |
53 | transaction->t_expires = jiffies + journal->j_commit_interval; | 55 | transaction->t_expires = jiffies + journal->j_commit_interval; |
54 | spin_lock_init(&transaction->t_handle_lock); | 56 | spin_lock_init(&transaction->t_handle_lock); |
@@ -752,7 +754,6 @@ out: | |||
752 | * int journal_get_write_access() - notify intent to modify a buffer for metadata (not data) update. | 754 | * int journal_get_write_access() - notify intent to modify a buffer for metadata (not data) update. |
753 | * @handle: transaction to add buffer modifications to | 755 | * @handle: transaction to add buffer modifications to |
754 | * @bh: bh to be used for metadata writes | 756 | * @bh: bh to be used for metadata writes |
755 | * @credits: variable that will receive credits for the buffer | ||
756 | * | 757 | * |
757 | * Returns an error code or 0 on success. | 758 | * Returns an error code or 0 on success. |
758 | * | 759 | * |
@@ -1370,7 +1371,7 @@ int journal_stop(handle_t *handle) | |||
1370 | { | 1371 | { |
1371 | transaction_t *transaction = handle->h_transaction; | 1372 | transaction_t *transaction = handle->h_transaction; |
1372 | journal_t *journal = transaction->t_journal; | 1373 | journal_t *journal = transaction->t_journal; |
1373 | int old_handle_count, err; | 1374 | int err; |
1374 | pid_t pid; | 1375 | pid_t pid; |
1375 | 1376 | ||
1376 | J_ASSERT(journal_current_handle() == handle); | 1377 | J_ASSERT(journal_current_handle() == handle); |
@@ -1399,6 +1400,17 @@ int journal_stop(handle_t *handle) | |||
1399 | * on IO anyway. Speeds up many-threaded, many-dir operations | 1400 | * on IO anyway. Speeds up many-threaded, many-dir operations |
1400 | * by 30x or more... | 1401 | * by 30x or more... |
1401 | * | 1402 | * |
1403 | * We try and optimize the sleep time against what the underlying disk | ||
1404 | * can do, instead of having a static sleep time. This is usefull for | ||
1405 | * the case where our storage is so fast that it is more optimal to go | ||
1406 | * ahead and force a flush and wait for the transaction to be committed | ||
1407 | * than it is to wait for an arbitrary amount of time for new writers to | ||
1408 | * join the transaction. We acheive this by measuring how long it takes | ||
1409 | * to commit a transaction, and compare it with how long this | ||
1410 | * transaction has been running, and if run time < commit time then we | ||
1411 | * sleep for the delta and commit. This greatly helps super fast disks | ||
1412 | * that would see slowdowns as more threads started doing fsyncs. | ||
1413 | * | ||
1402 | * But don't do this if this process was the most recent one to | 1414 | * But don't do this if this process was the most recent one to |
1403 | * perform a synchronous write. We do this to detect the case where a | 1415 | * perform a synchronous write. We do this to detect the case where a |
1404 | * single process is doing a stream of sync writes. No point in waiting | 1416 | * single process is doing a stream of sync writes. No point in waiting |
@@ -1406,11 +1418,26 @@ int journal_stop(handle_t *handle) | |||
1406 | */ | 1418 | */ |
1407 | pid = current->pid; | 1419 | pid = current->pid; |
1408 | if (handle->h_sync && journal->j_last_sync_writer != pid) { | 1420 | if (handle->h_sync && journal->j_last_sync_writer != pid) { |
1421 | u64 commit_time, trans_time; | ||
1422 | |||
1409 | journal->j_last_sync_writer = pid; | 1423 | journal->j_last_sync_writer = pid; |
1410 | do { | 1424 | |
1411 | old_handle_count = transaction->t_handle_count; | 1425 | spin_lock(&journal->j_state_lock); |
1412 | schedule_timeout_uninterruptible(1); | 1426 | commit_time = journal->j_average_commit_time; |
1413 | } while (old_handle_count != transaction->t_handle_count); | 1427 | spin_unlock(&journal->j_state_lock); |
1428 | |||
1429 | trans_time = ktime_to_ns(ktime_sub(ktime_get(), | ||
1430 | transaction->t_start_time)); | ||
1431 | |||
1432 | commit_time = min_t(u64, commit_time, | ||
1433 | 1000*jiffies_to_usecs(1)); | ||
1434 | |||
1435 | if (trans_time < commit_time) { | ||
1436 | ktime_t expires = ktime_add_ns(ktime_get(), | ||
1437 | commit_time); | ||
1438 | set_current_state(TASK_UNINTERRUPTIBLE); | ||
1439 | schedule_hrtimeout(&expires, HRTIMER_MODE_ABS); | ||
1440 | } | ||
1414 | } | 1441 | } |
1415 | 1442 | ||
1416 | current->journal_info = NULL; | 1443 | current->journal_info = NULL; |
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 54ff4c77aaa3..d861096c9d81 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -3868,7 +3868,7 @@ static void ocfs2_split_record(struct inode *inode, | |||
3868 | struct ocfs2_extent_list *left_el = NULL, *right_el, *insert_el, *el; | 3868 | struct ocfs2_extent_list *left_el = NULL, *right_el, *insert_el, *el; |
3869 | struct ocfs2_extent_rec *rec, *tmprec; | 3869 | struct ocfs2_extent_rec *rec, *tmprec; |
3870 | 3870 | ||
3871 | right_el = path_leaf_el(right_path);; | 3871 | right_el = path_leaf_el(right_path); |
3872 | if (left_path) | 3872 | if (left_path) |
3873 | left_el = path_leaf_el(left_path); | 3873 | left_el = path_leaf_el(left_path); |
3874 | 3874 | ||
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c index f731ab491795..b0c4cadd4c45 100644 --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c | |||
@@ -1324,7 +1324,7 @@ again: | |||
1324 | goto out; | 1324 | goto out; |
1325 | } | 1325 | } |
1326 | 1326 | ||
1327 | mlog(0, "lock %s, successfull return from ocfs2_dlm_lock\n", | 1327 | mlog(0, "lock %s, successful return from ocfs2_dlm_lock\n", |
1328 | lockres->l_name); | 1328 | lockres->l_name); |
1329 | 1329 | ||
1330 | /* At this point we've gone inside the dlm and need to | 1330 | /* At this point we've gone inside the dlm and need to |
@@ -2951,7 +2951,7 @@ static int ocfs2_drop_lock(struct ocfs2_super *osb, | |||
2951 | ocfs2_dlm_dump_lksb(&lockres->l_lksb); | 2951 | ocfs2_dlm_dump_lksb(&lockres->l_lksb); |
2952 | BUG(); | 2952 | BUG(); |
2953 | } | 2953 | } |
2954 | mlog(0, "lock %s, successfull return from ocfs2_dlm_unlock\n", | 2954 | mlog(0, "lock %s, successful return from ocfs2_dlm_unlock\n", |
2955 | lockres->l_name); | 2955 | lockres->l_name); |
2956 | 2956 | ||
2957 | ocfs2_wait_on_busy_lock(lockres); | 2957 | ocfs2_wait_on_busy_lock(lockres); |
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index e8f795f978aa..a5887df2cd8a 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -1605,7 +1605,7 @@ int ocfs2_change_file_space(struct file *file, unsigned int cmd, | |||
1605 | struct ocfs2_space_resv *sr) | 1605 | struct ocfs2_space_resv *sr) |
1606 | { | 1606 | { |
1607 | struct inode *inode = file->f_path.dentry->d_inode; | 1607 | struct inode *inode = file->f_path.dentry->d_inode; |
1608 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);; | 1608 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
1609 | 1609 | ||
1610 | if ((cmd == OCFS2_IOC_RESVSP || cmd == OCFS2_IOC_RESVSP64) && | 1610 | if ((cmd == OCFS2_IOC_RESVSP || cmd == OCFS2_IOC_RESVSP64) && |
1611 | !ocfs2_writes_unwritten_extents(osb)) | 1611 | !ocfs2_writes_unwritten_extents(osb)) |
diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c index 03ec59504906..5edcc3f92ba7 100644 --- a/fs/proc/vmcore.c +++ b/fs/proc/vmcore.c | |||
@@ -47,8 +47,6 @@ static ssize_t read_from_oldmem(char *buf, size_t count, | |||
47 | 47 | ||
48 | offset = (unsigned long)(*ppos % PAGE_SIZE); | 48 | offset = (unsigned long)(*ppos % PAGE_SIZE); |
49 | pfn = (unsigned long)(*ppos / PAGE_SIZE); | 49 | pfn = (unsigned long)(*ppos / PAGE_SIZE); |
50 | if (pfn > saved_max_pfn) | ||
51 | return -EINVAL; | ||
52 | 50 | ||
53 | do { | 51 | do { |
54 | if (count > (PAGE_SIZE - offset)) | 52 | if (count > (PAGE_SIZE - offset)) |
diff --git a/fs/romfs/inode.c b/fs/romfs/inode.c index c97d4c931715..98a232f7196b 100644 --- a/fs/romfs/inode.c +++ b/fs/romfs/inode.c | |||
@@ -490,7 +490,7 @@ static mode_t romfs_modemap[] = | |||
490 | static struct inode * | 490 | static struct inode * |
491 | romfs_iget(struct super_block *sb, unsigned long ino) | 491 | romfs_iget(struct super_block *sb, unsigned long ino) |
492 | { | 492 | { |
493 | int nextfh; | 493 | int nextfh, ret; |
494 | struct romfs_inode ri; | 494 | struct romfs_inode ri; |
495 | struct inode *i; | 495 | struct inode *i; |
496 | 496 | ||
@@ -526,11 +526,11 @@ romfs_iget(struct super_block *sb, unsigned long ino) | |||
526 | i->i_mtime.tv_nsec = i->i_atime.tv_nsec = i->i_ctime.tv_nsec = 0; | 526 | i->i_mtime.tv_nsec = i->i_atime.tv_nsec = i->i_ctime.tv_nsec = 0; |
527 | 527 | ||
528 | /* Precalculate the data offset */ | 528 | /* Precalculate the data offset */ |
529 | ino = romfs_strnlen(i, ino+ROMFH_SIZE, ROMFS_MAXFN); | 529 | ret = romfs_strnlen(i, ino + ROMFH_SIZE, ROMFS_MAXFN); |
530 | if (ino >= 0) | 530 | if (ret >= 0) |
531 | ino = ((ROMFH_SIZE+ino+1+ROMFH_PAD)&ROMFH_MASK); | 531 | ino = (ROMFH_SIZE + ret + 1 + ROMFH_PAD) & ROMFH_MASK; |
532 | else | 532 | else |
533 | ino = 0; | 533 | ino = 0; |
534 | 534 | ||
535 | ROMFS_I(i)->i_metasize = ino; | 535 | ROMFS_I(i)->i_metasize = ino; |
536 | ROMFS_I(i)->i_dataoffset = ino+(i->i_ino&ROMFH_MASK); | 536 | ROMFS_I(i)->i_dataoffset = ino+(i->i_ino&ROMFH_MASK); |
diff --git a/fs/splice.c b/fs/splice.c index 1abab5cee4ba..a54b3e3f10a7 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/file.h> | 21 | #include <linux/file.h> |
22 | #include <linux/pagemap.h> | 22 | #include <linux/pagemap.h> |
23 | #include <linux/splice.h> | 23 | #include <linux/splice.h> |
24 | #include <linux/memcontrol.h> | ||
24 | #include <linux/mm_inline.h> | 25 | #include <linux/mm_inline.h> |
25 | #include <linux/swap.h> | 26 | #include <linux/swap.h> |
26 | #include <linux/writeback.h> | 27 | #include <linux/writeback.h> |
diff --git a/fs/super.c b/fs/super.c index cb20744ec789..7d67387496cb 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -458,7 +458,6 @@ void sync_filesystems(int wait) | |||
458 | if (sb->s_flags & MS_RDONLY) | 458 | if (sb->s_flags & MS_RDONLY) |
459 | continue; | 459 | continue; |
460 | sb->s_need_sync_fs = 1; | 460 | sb->s_need_sync_fs = 1; |
461 | async_synchronize_full_special(&sb->s_async_list); | ||
462 | } | 461 | } |
463 | 462 | ||
464 | restart: | 463 | restart: |
@@ -471,6 +470,7 @@ restart: | |||
471 | sb->s_count++; | 470 | sb->s_count++; |
472 | spin_unlock(&sb_lock); | 471 | spin_unlock(&sb_lock); |
473 | down_read(&sb->s_umount); | 472 | down_read(&sb->s_umount); |
473 | async_synchronize_full_special(&sb->s_async_list); | ||
474 | if (sb->s_root && (wait || sb->s_dirt)) | 474 | if (sb->s_root && (wait || sb->s_dirt)) |
475 | sb->s_op->sync_fs(sb, wait); | 475 | sb->s_op->sync_fs(sb, wait); |
476 | up_read(&sb->s_umount); | 476 | up_read(&sb->s_umount); |