diff options
Diffstat (limited to 'fs')
35 files changed, 293 insertions, 157 deletions
diff --git a/fs/Kconfig.binfmt b/fs/Kconfig.binfmt index 55e8ee1900a5..3263084eef9e 100644 --- a/fs/Kconfig.binfmt +++ b/fs/Kconfig.binfmt | |||
@@ -42,7 +42,7 @@ config BINFMT_ELF_FDPIC | |||
42 | 42 | ||
43 | config BINFMT_FLAT | 43 | config BINFMT_FLAT |
44 | bool "Kernel support for flat binaries" | 44 | bool "Kernel support for flat binaries" |
45 | depends on !MMU | 45 | depends on !MMU && (!FRV || BROKEN) |
46 | help | 46 | help |
47 | Support uClinux FLAT format binaries. | 47 | Support uClinux FLAT format binaries. |
48 | 48 | ||
diff --git a/fs/afs/callback.c b/fs/afs/callback.c index a78d5b236bb1..587ef5123cd8 100644 --- a/fs/afs/callback.c +++ b/fs/afs/callback.c | |||
@@ -8,7 +8,7 @@ | |||
8 | * along with this program; if not, write to the Free Software | 8 | * along with this program; if not, write to the Free Software |
9 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 9 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
10 | * | 10 | * |
11 | * Authors: David Woodhouse <dwmw2@cambridge.redhat.com> | 11 | * Authors: David Woodhouse <dwmw2@infradead.org> |
12 | * David Howells <dhowells@redhat.com> | 12 | * David Howells <dhowells@redhat.com> |
13 | * | 13 | * |
14 | */ | 14 | */ |
diff --git a/fs/afs/inode.c b/fs/afs/inode.c index 08db82e1343a..bb47217f6a18 100644 --- a/fs/afs/inode.c +++ b/fs/afs/inode.c | |||
@@ -8,7 +8,7 @@ | |||
8 | * along with this program; if not, write to the Free Software | 8 | * along with this program; if not, write to the Free Software |
9 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 9 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
10 | * | 10 | * |
11 | * Authors: David Woodhouse <dwmw2@cambridge.redhat.com> | 11 | * Authors: David Woodhouse <dwmw2@infradead.org> |
12 | * David Howells <dhowells@redhat.com> | 12 | * David Howells <dhowells@redhat.com> |
13 | * | 13 | * |
14 | */ | 14 | */ |
diff --git a/fs/afs/super.c b/fs/afs/super.c index 4b572b801d8d..7e3faeef6818 100644 --- a/fs/afs/super.c +++ b/fs/afs/super.c | |||
@@ -10,7 +10,7 @@ | |||
10 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 10 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
11 | * | 11 | * |
12 | * Authors: David Howells <dhowells@redhat.com> | 12 | * Authors: David Howells <dhowells@redhat.com> |
13 | * David Woodhouse <dwmw2@redhat.com> | 13 | * David Woodhouse <dwmw2@infradead.org> |
14 | * | 14 | * |
15 | */ | 15 | */ |
16 | 16 | ||
@@ -591,10 +591,6 @@ static void use_mm(struct mm_struct *mm) | |||
591 | atomic_inc(&mm->mm_count); | 591 | atomic_inc(&mm->mm_count); |
592 | tsk->mm = mm; | 592 | tsk->mm = mm; |
593 | tsk->active_mm = mm; | 593 | tsk->active_mm = mm; |
594 | /* | ||
595 | * Note that on UML this *requires* PF_BORROWED_MM to be set, otherwise | ||
596 | * it won't work. Update it accordingly if you change it here | ||
597 | */ | ||
598 | switch_mm(active_mm, mm, tsk); | 594 | switch_mm(active_mm, mm, tsk); |
599 | task_unlock(tsk); | 595 | task_unlock(tsk); |
600 | 596 | ||
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index ddd35d873391..d051a32e6270 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c | |||
@@ -390,7 +390,7 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm, | |||
390 | } | 390 | } |
391 | 391 | ||
392 | /* expand the stack mapping to use up the entire allocation granule */ | 392 | /* expand the stack mapping to use up the entire allocation granule */ |
393 | fullsize = ksize((char *) current->mm->start_brk); | 393 | fullsize = kobjsize((char *) current->mm->start_brk); |
394 | if (!IS_ERR_VALUE(do_mremap(current->mm->start_brk, stack_size, | 394 | if (!IS_ERR_VALUE(do_mremap(current->mm->start_brk, stack_size, |
395 | fullsize, 0, 0))) | 395 | fullsize, 0, 0))) |
396 | stack_size = fullsize; | 396 | stack_size = fullsize; |
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c index 3b40d45a3a16..2cb1acda3a82 100644 --- a/fs/binfmt_flat.c +++ b/fs/binfmt_flat.c | |||
@@ -548,7 +548,7 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
548 | PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 0); | 548 | PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 0); |
549 | /* Remap to use all availabe slack region space */ | 549 | /* Remap to use all availabe slack region space */ |
550 | if (realdatastart && (realdatastart < (unsigned long)-4096)) { | 550 | if (realdatastart && (realdatastart < (unsigned long)-4096)) { |
551 | reallen = ksize((void *)realdatastart); | 551 | reallen = kobjsize((void *)realdatastart); |
552 | if (reallen > len) { | 552 | if (reallen > len) { |
553 | realdatastart = do_mremap(realdatastart, len, | 553 | realdatastart = do_mremap(realdatastart, len, |
554 | reallen, MREMAP_FIXED, realdatastart); | 554 | reallen, MREMAP_FIXED, realdatastart); |
@@ -600,7 +600,7 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
600 | PROT_READ | PROT_EXEC | PROT_WRITE, MAP_PRIVATE, 0); | 600 | PROT_READ | PROT_EXEC | PROT_WRITE, MAP_PRIVATE, 0); |
601 | /* Remap to use all availabe slack region space */ | 601 | /* Remap to use all availabe slack region space */ |
602 | if (textpos && (textpos < (unsigned long) -4096)) { | 602 | if (textpos && (textpos < (unsigned long) -4096)) { |
603 | reallen = ksize((void *)textpos); | 603 | reallen = kobjsize((void *)textpos); |
604 | if (reallen > len) { | 604 | if (reallen > len) { |
605 | textpos = do_mremap(textpos, len, reallen, | 605 | textpos = do_mremap(textpos, len, reallen, |
606 | MREMAP_FIXED, textpos); | 606 | MREMAP_FIXED, textpos); |
@@ -683,7 +683,7 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
683 | */ | 683 | */ |
684 | current->mm->start_brk = datapos + data_len + bss_len; | 684 | current->mm->start_brk = datapos + data_len + bss_len; |
685 | current->mm->brk = (current->mm->start_brk + 3) & ~3; | 685 | current->mm->brk = (current->mm->start_brk + 3) & ~3; |
686 | current->mm->context.end_brk = memp + ksize((void *) memp) - stack_len; | 686 | current->mm->context.end_brk = memp + kobjsize((void *) memp) - stack_len; |
687 | } | 687 | } |
688 | 688 | ||
689 | if (flags & FLAT_FLAG_KTRACE) | 689 | if (flags & FLAT_FLAG_KTRACE) |
@@ -790,7 +790,7 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
790 | 790 | ||
791 | /* zero the BSS, BRK and stack areas */ | 791 | /* zero the BSS, BRK and stack areas */ |
792 | memset((void*)(datapos + data_len), 0, bss_len + | 792 | memset((void*)(datapos + data_len), 0, bss_len + |
793 | (memp + ksize((void *) memp) - stack_len - /* end brk */ | 793 | (memp + kobjsize((void *) memp) - stack_len - /* end brk */ |
794 | libinfo->lib_list[id].start_brk) + /* start brk */ | 794 | libinfo->lib_list[id].start_brk) + /* start brk */ |
795 | stack_len); | 795 | stack_len); |
796 | 796 | ||
diff --git a/fs/block_dev.c b/fs/block_dev.c index 7d822fae7765..470c10ceb0fb 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/kmod.h> | 12 | #include <linux/kmod.h> |
13 | #include <linux/major.h> | 13 | #include <linux/major.h> |
14 | #include <linux/smp_lock.h> | 14 | #include <linux/smp_lock.h> |
15 | #include <linux/device_cgroup.h> | ||
15 | #include <linux/highmem.h> | 16 | #include <linux/highmem.h> |
16 | #include <linux/blkdev.h> | 17 | #include <linux/blkdev.h> |
17 | #include <linux/module.h> | 18 | #include <linux/module.h> |
@@ -928,9 +929,14 @@ static int do_open(struct block_device *bdev, struct file *file, int for_part) | |||
928 | { | 929 | { |
929 | struct module *owner = NULL; | 930 | struct module *owner = NULL; |
930 | struct gendisk *disk; | 931 | struct gendisk *disk; |
931 | int ret = -ENXIO; | 932 | int ret; |
932 | int part; | 933 | int part; |
933 | 934 | ||
935 | ret = devcgroup_inode_permission(bdev->bd_inode, file->f_mode); | ||
936 | if (ret != 0) | ||
937 | return ret; | ||
938 | |||
939 | ret = -ENXIO; | ||
934 | file->f_mapping = bdev->bd_inode->i_mapping; | 940 | file->f_mapping = bdev->bd_inode->i_mapping; |
935 | lock_kernel(); | 941 | lock_kernel(); |
936 | disk = get_gendisk(bdev->bd_dev, &part); | 942 | disk = get_gendisk(bdev->bd_dev, &part); |
diff --git a/fs/cifs/asn1.c b/fs/cifs/asn1.c index cb52cbbe45ff..f58e41d3ba48 100644 --- a/fs/cifs/asn1.c +++ b/fs/cifs/asn1.c | |||
@@ -186,6 +186,11 @@ asn1_length_decode(struct asn1_ctx *ctx, unsigned int *def, unsigned int *len) | |||
186 | } | 186 | } |
187 | } | 187 | } |
188 | } | 188 | } |
189 | |||
190 | /* don't trust len bigger than ctx buffer */ | ||
191 | if (*len > ctx->end - ctx->pointer) | ||
192 | return 0; | ||
193 | |||
189 | return 1; | 194 | return 1; |
190 | } | 195 | } |
191 | 196 | ||
@@ -203,6 +208,10 @@ asn1_header_decode(struct asn1_ctx *ctx, | |||
203 | if (!asn1_length_decode(ctx, &def, &len)) | 208 | if (!asn1_length_decode(ctx, &def, &len)) |
204 | return 0; | 209 | return 0; |
205 | 210 | ||
211 | /* primitive shall be definite, indefinite shall be constructed */ | ||
212 | if (*con == ASN1_PRI && !def) | ||
213 | return 0; | ||
214 | |||
206 | if (def) | 215 | if (def) |
207 | *eoc = ctx->pointer + len; | 216 | *eoc = ctx->pointer + len; |
208 | else | 217 | else |
@@ -389,6 +398,11 @@ asn1_oid_decode(struct asn1_ctx *ctx, | |||
389 | unsigned long *optr; | 398 | unsigned long *optr; |
390 | 399 | ||
391 | size = eoc - ctx->pointer + 1; | 400 | size = eoc - ctx->pointer + 1; |
401 | |||
402 | /* first subid actually encodes first two subids */ | ||
403 | if (size < 2 || size > ULONG_MAX/sizeof(unsigned long)) | ||
404 | return 0; | ||
405 | |||
392 | *oid = kmalloc(size * sizeof(unsigned long), GFP_ATOMIC); | 406 | *oid = kmalloc(size * sizeof(unsigned long), GFP_ATOMIC); |
393 | if (*oid == NULL) | 407 | if (*oid == NULL) |
394 | return 0; | 408 | return 0; |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 174bf8aca237..4511b708f0f3 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -3925,9 +3925,9 @@ parse_DFS_referrals(TRANSACTION2_GET_DFS_REFER_RSP *pSMBr, | |||
3925 | } | 3925 | } |
3926 | 3926 | ||
3927 | ref = (struct dfs_referral_level_3 *) &(pSMBr->referrals); | 3927 | ref = (struct dfs_referral_level_3 *) &(pSMBr->referrals); |
3928 | if (ref->VersionNumber != 3) { | 3928 | if (ref->VersionNumber != cpu_to_le16(3)) { |
3929 | cERROR(1, ("Referrals of V%d version are not supported," | 3929 | cERROR(1, ("Referrals of V%d version are not supported," |
3930 | "should be V3", ref->VersionNumber)); | 3930 | "should be V3", le16_to_cpu(ref->VersionNumber))); |
3931 | rc = -EINVAL; | 3931 | rc = -EINVAL; |
3932 | goto parse_DFS_referrals_exit; | 3932 | goto parse_DFS_referrals_exit; |
3933 | } | 3933 | } |
@@ -3975,7 +3975,7 @@ parse_DFS_referrals(TRANSACTION2_GET_DFS_REFER_RSP *pSMBr, | |||
3975 | if (rc) | 3975 | if (rc) |
3976 | goto parse_DFS_referrals_exit; | 3976 | goto parse_DFS_referrals_exit; |
3977 | 3977 | ||
3978 | ref += ref->Size; | 3978 | ref += le16_to_cpu(ref->Size); |
3979 | } | 3979 | } |
3980 | 3980 | ||
3981 | parse_DFS_referrals_exit: | 3981 | parse_DFS_referrals_exit: |
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index cd62d75b2cc0..e2832bc7869a 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c | |||
@@ -1906,9 +1906,9 @@ int ecryptfs_get_tfm_and_mutex_for_cipher_name(struct crypto_blkcipher **tfm, | |||
1906 | goto out; | 1906 | goto out; |
1907 | } | 1907 | } |
1908 | } | 1908 | } |
1909 | mutex_unlock(&key_tfm_list_mutex); | ||
1910 | (*tfm) = key_tfm->key_tfm; | 1909 | (*tfm) = key_tfm->key_tfm; |
1911 | (*tfm_mutex) = &key_tfm->key_tfm_mutex; | 1910 | (*tfm_mutex) = &key_tfm->key_tfm_mutex; |
1912 | out: | 1911 | out: |
1912 | mutex_unlock(&key_tfm_list_mutex); | ||
1913 | return rc; | 1913 | return rc; |
1914 | } | 1914 | } |
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h index 951ee33a022d..c15c25745e05 100644 --- a/fs/ecryptfs/ecryptfs_kernel.h +++ b/fs/ecryptfs/ecryptfs_kernel.h | |||
@@ -660,8 +660,6 @@ int ecryptfs_get_tfm_and_mutex_for_cipher_name(struct crypto_blkcipher **tfm, | |||
660 | int ecryptfs_keyring_auth_tok_for_sig(struct key **auth_tok_key, | 660 | int ecryptfs_keyring_auth_tok_for_sig(struct key **auth_tok_key, |
661 | struct ecryptfs_auth_tok **auth_tok, | 661 | struct ecryptfs_auth_tok **auth_tok, |
662 | char *sig); | 662 | char *sig); |
663 | int ecryptfs_write_zeros(struct file *file, pgoff_t index, int start, | ||
664 | int num_zeros); | ||
665 | int ecryptfs_write_lower(struct inode *ecryptfs_inode, char *data, | 663 | int ecryptfs_write_lower(struct inode *ecryptfs_inode, char *data, |
666 | loff_t offset, size_t size); | 664 | loff_t offset, size_t size); |
667 | int ecryptfs_write_lower_page_segment(struct inode *ecryptfs_inode, | 665 | int ecryptfs_write_lower_page_segment(struct inode *ecryptfs_inode, |
diff --git a/fs/ecryptfs/read_write.c b/fs/ecryptfs/read_write.c index ebf55150be56..75c2ea9fee35 100644 --- a/fs/ecryptfs/read_write.c +++ b/fs/ecryptfs/read_write.c | |||
@@ -157,20 +157,6 @@ int ecryptfs_write(struct file *ecryptfs_file, char *data, loff_t offset, | |||
157 | ecryptfs_page_idx, rc); | 157 | ecryptfs_page_idx, rc); |
158 | goto out; | 158 | goto out; |
159 | } | 159 | } |
160 | if (start_offset_in_page) { | ||
161 | /* Read in the page from the lower | ||
162 | * into the eCryptfs inode page cache, | ||
163 | * decrypting */ | ||
164 | rc = ecryptfs_decrypt_page(ecryptfs_page); | ||
165 | if (rc) { | ||
166 | printk(KERN_ERR "%s: Error decrypting " | ||
167 | "page; rc = [%d]\n", | ||
168 | __func__, rc); | ||
169 | ClearPageUptodate(ecryptfs_page); | ||
170 | page_cache_release(ecryptfs_page); | ||
171 | goto out; | ||
172 | } | ||
173 | } | ||
174 | ecryptfs_page_virt = kmap_atomic(ecryptfs_page, KM_USER0); | 160 | ecryptfs_page_virt = kmap_atomic(ecryptfs_page, KM_USER0); |
175 | 161 | ||
176 | /* | 162 | /* |
@@ -349,14 +335,6 @@ int ecryptfs_read(char *data, loff_t offset, size_t size, | |||
349 | ecryptfs_page_idx, rc); | 335 | ecryptfs_page_idx, rc); |
350 | goto out; | 336 | goto out; |
351 | } | 337 | } |
352 | rc = ecryptfs_decrypt_page(ecryptfs_page); | ||
353 | if (rc) { | ||
354 | printk(KERN_ERR "%s: Error decrypting " | ||
355 | "page; rc = [%d]\n", __func__, rc); | ||
356 | ClearPageUptodate(ecryptfs_page); | ||
357 | page_cache_release(ecryptfs_page); | ||
358 | goto out; | ||
359 | } | ||
360 | ecryptfs_page_virt = kmap_atomic(ecryptfs_page, KM_USER0); | 338 | ecryptfs_page_virt = kmap_atomic(ecryptfs_page, KM_USER0); |
361 | memcpy((data + data_offset), | 339 | memcpy((data + data_offset), |
362 | ((char *)ecryptfs_page_virt + start_offset_in_page), | 340 | ((char *)ecryptfs_page_virt + start_offset_in_page), |
@@ -860,6 +860,7 @@ static int de_thread(struct task_struct *tsk) | |||
860 | 860 | ||
861 | no_thread_group: | 861 | no_thread_group: |
862 | exit_itimers(sig); | 862 | exit_itimers(sig); |
863 | flush_itimer_signals(); | ||
863 | if (leader) | 864 | if (leader) |
864 | release_task(leader); | 865 | release_task(leader); |
865 | 866 | ||
diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c index 28cfd0b40527..77278e947e94 100644 --- a/fs/ext3/resize.c +++ b/fs/ext3/resize.c | |||
@@ -580,7 +580,8 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode, | |||
580 | } | 580 | } |
581 | 581 | ||
582 | blk = EXT3_SB(sb)->s_sbh->b_blocknr + 1 + EXT3_SB(sb)->s_gdb_count; | 582 | blk = EXT3_SB(sb)->s_sbh->b_blocknr + 1 + EXT3_SB(sb)->s_gdb_count; |
583 | data = (__le32 *)dind->b_data + EXT3_SB(sb)->s_gdb_count; | 583 | data = (__le32 *)dind->b_data + (EXT3_SB(sb)->s_gdb_count % |
584 | EXT3_ADDR_PER_BLOCK(sb)); | ||
584 | end = (__le32 *)dind->b_data + EXT3_ADDR_PER_BLOCK(sb); | 585 | end = (__le32 *)dind->b_data + EXT3_ADDR_PER_BLOCK(sb); |
585 | 586 | ||
586 | /* Get each reserved primary GDT block and verify it holds backups */ | 587 | /* Get each reserved primary GDT block and verify it holds backups */ |
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index 30494c5da843..9cc80b9cc8d8 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c | |||
@@ -43,6 +43,46 @@ void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr, | |||
43 | 43 | ||
44 | } | 44 | } |
45 | 45 | ||
46 | static int ext4_block_in_group(struct super_block *sb, ext4_fsblk_t block, | ||
47 | ext4_group_t block_group) | ||
48 | { | ||
49 | ext4_group_t actual_group; | ||
50 | ext4_get_group_no_and_offset(sb, block, &actual_group, 0); | ||
51 | if (actual_group == block_group) | ||
52 | return 1; | ||
53 | return 0; | ||
54 | } | ||
55 | |||
56 | static int ext4_group_used_meta_blocks(struct super_block *sb, | ||
57 | ext4_group_t block_group) | ||
58 | { | ||
59 | ext4_fsblk_t tmp; | ||
60 | struct ext4_sb_info *sbi = EXT4_SB(sb); | ||
61 | /* block bitmap, inode bitmap, and inode table blocks */ | ||
62 | int used_blocks = sbi->s_itb_per_group + 2; | ||
63 | |||
64 | if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)) { | ||
65 | struct ext4_group_desc *gdp; | ||
66 | struct buffer_head *bh; | ||
67 | |||
68 | gdp = ext4_get_group_desc(sb, block_group, &bh); | ||
69 | if (!ext4_block_in_group(sb, ext4_block_bitmap(sb, gdp), | ||
70 | block_group)) | ||
71 | used_blocks--; | ||
72 | |||
73 | if (!ext4_block_in_group(sb, ext4_inode_bitmap(sb, gdp), | ||
74 | block_group)) | ||
75 | used_blocks--; | ||
76 | |||
77 | tmp = ext4_inode_table(sb, gdp); | ||
78 | for (; tmp < ext4_inode_table(sb, gdp) + | ||
79 | sbi->s_itb_per_group; tmp++) { | ||
80 | if (!ext4_block_in_group(sb, tmp, block_group)) | ||
81 | used_blocks -= 1; | ||
82 | } | ||
83 | } | ||
84 | return used_blocks; | ||
85 | } | ||
46 | /* Initializes an uninitialized block bitmap if given, and returns the | 86 | /* Initializes an uninitialized block bitmap if given, and returns the |
47 | * number of blocks free in the group. */ | 87 | * number of blocks free in the group. */ |
48 | unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh, | 88 | unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh, |
@@ -105,20 +145,34 @@ unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh, | |||
105 | free_blocks = group_blocks - bit_max; | 145 | free_blocks = group_blocks - bit_max; |
106 | 146 | ||
107 | if (bh) { | 147 | if (bh) { |
108 | ext4_fsblk_t start; | 148 | ext4_fsblk_t start, tmp; |
149 | int flex_bg = 0; | ||
109 | 150 | ||
110 | for (bit = 0; bit < bit_max; bit++) | 151 | for (bit = 0; bit < bit_max; bit++) |
111 | ext4_set_bit(bit, bh->b_data); | 152 | ext4_set_bit(bit, bh->b_data); |
112 | 153 | ||
113 | start = ext4_group_first_block_no(sb, block_group); | 154 | start = ext4_group_first_block_no(sb, block_group); |
114 | 155 | ||
115 | /* Set bits for block and inode bitmaps, and inode table */ | 156 | if (EXT4_HAS_INCOMPAT_FEATURE(sb, |
116 | ext4_set_bit(ext4_block_bitmap(sb, gdp) - start, bh->b_data); | 157 | EXT4_FEATURE_INCOMPAT_FLEX_BG)) |
117 | ext4_set_bit(ext4_inode_bitmap(sb, gdp) - start, bh->b_data); | 158 | flex_bg = 1; |
118 | for (bit = (ext4_inode_table(sb, gdp) - start), | ||
119 | bit_max = bit + sbi->s_itb_per_group; bit < bit_max; bit++) | ||
120 | ext4_set_bit(bit, bh->b_data); | ||
121 | 159 | ||
160 | /* Set bits for block and inode bitmaps, and inode table */ | ||
161 | tmp = ext4_block_bitmap(sb, gdp); | ||
162 | if (!flex_bg || ext4_block_in_group(sb, tmp, block_group)) | ||
163 | ext4_set_bit(tmp - start, bh->b_data); | ||
164 | |||
165 | tmp = ext4_inode_bitmap(sb, gdp); | ||
166 | if (!flex_bg || ext4_block_in_group(sb, tmp, block_group)) | ||
167 | ext4_set_bit(tmp - start, bh->b_data); | ||
168 | |||
169 | tmp = ext4_inode_table(sb, gdp); | ||
170 | for (; tmp < ext4_inode_table(sb, gdp) + | ||
171 | sbi->s_itb_per_group; tmp++) { | ||
172 | if (!flex_bg || | ||
173 | ext4_block_in_group(sb, tmp, block_group)) | ||
174 | ext4_set_bit(tmp - start, bh->b_data); | ||
175 | } | ||
122 | /* | 176 | /* |
123 | * Also if the number of blocks within the group is | 177 | * Also if the number of blocks within the group is |
124 | * less than the blocksize * 8 ( which is the size | 178 | * less than the blocksize * 8 ( which is the size |
@@ -126,8 +180,7 @@ unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh, | |||
126 | */ | 180 | */ |
127 | mark_bitmap_end(group_blocks, sb->s_blocksize * 8, bh->b_data); | 181 | mark_bitmap_end(group_blocks, sb->s_blocksize * 8, bh->b_data); |
128 | } | 182 | } |
129 | 183 | return free_blocks - ext4_group_used_meta_blocks(sb, block_group); | |
130 | return free_blocks - sbi->s_itb_per_group - 2; | ||
131 | } | 184 | } |
132 | 185 | ||
133 | 186 | ||
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 873ad9b3418c..c9900aade150 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -2745,8 +2745,6 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac, | |||
2745 | sbi = EXT4_SB(sb); | 2745 | sbi = EXT4_SB(sb); |
2746 | es = sbi->s_es; | 2746 | es = sbi->s_es; |
2747 | 2747 | ||
2748 | ext4_debug("using block group %lu(%d)\n", ac->ac_b_ex.fe_group, | ||
2749 | gdp->bg_free_blocks_count); | ||
2750 | 2748 | ||
2751 | err = -EIO; | 2749 | err = -EIO; |
2752 | bitmap_bh = read_block_bitmap(sb, ac->ac_b_ex.fe_group); | 2750 | bitmap_bh = read_block_bitmap(sb, ac->ac_b_ex.fe_group); |
@@ -2762,6 +2760,9 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac, | |||
2762 | if (!gdp) | 2760 | if (!gdp) |
2763 | goto out_err; | 2761 | goto out_err; |
2764 | 2762 | ||
2763 | ext4_debug("using block group %lu(%d)\n", ac->ac_b_ex.fe_group, | ||
2764 | gdp->bg_free_blocks_count); | ||
2765 | |||
2765 | err = ext4_journal_get_write_access(handle, gdp_bh); | 2766 | err = ext4_journal_get_write_access(handle, gdp_bh); |
2766 | if (err) | 2767 | if (err) |
2767 | goto out_err; | 2768 | goto out_err; |
@@ -3094,8 +3095,7 @@ static void ext4_mb_use_inode_pa(struct ext4_allocation_context *ac, | |||
3094 | static void ext4_mb_use_group_pa(struct ext4_allocation_context *ac, | 3095 | static void ext4_mb_use_group_pa(struct ext4_allocation_context *ac, |
3095 | struct ext4_prealloc_space *pa) | 3096 | struct ext4_prealloc_space *pa) |
3096 | { | 3097 | { |
3097 | unsigned len = ac->ac_o_ex.fe_len; | 3098 | unsigned int len = ac->ac_o_ex.fe_len; |
3098 | |||
3099 | ext4_get_group_no_and_offset(ac->ac_sb, pa->pa_pstart, | 3099 | ext4_get_group_no_and_offset(ac->ac_sb, pa->pa_pstart, |
3100 | &ac->ac_b_ex.fe_group, | 3100 | &ac->ac_b_ex.fe_group, |
3101 | &ac->ac_b_ex.fe_start); | 3101 | &ac->ac_b_ex.fe_start); |
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index 9f086a6a472b..9ecb92f68543 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c | |||
@@ -563,7 +563,8 @@ static int reserve_backup_gdb(handle_t *handle, struct inode *inode, | |||
563 | } | 563 | } |
564 | 564 | ||
565 | blk = EXT4_SB(sb)->s_sbh->b_blocknr + 1 + EXT4_SB(sb)->s_gdb_count; | 565 | blk = EXT4_SB(sb)->s_sbh->b_blocknr + 1 + EXT4_SB(sb)->s_gdb_count; |
566 | data = (__le32 *)dind->b_data + EXT4_SB(sb)->s_gdb_count; | 566 | data = (__le32 *)dind->b_data + (EXT4_SB(sb)->s_gdb_count % |
567 | EXT4_ADDR_PER_BLOCK(sb)); | ||
567 | end = (__le32 *)dind->b_data + EXT4_ADDR_PER_BLOCK(sb); | 568 | end = (__le32 *)dind->b_data + EXT4_ADDR_PER_BLOCK(sb); |
568 | 569 | ||
569 | /* Get each reserved primary GDT block and verify it holds backups */ | 570 | /* Get each reserved primary GDT block and verify it holds backups */ |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 09d9359c8055..cb96f127c366 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -671,6 +671,7 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs) | |||
671 | unsigned long def_mount_opts; | 671 | unsigned long def_mount_opts; |
672 | struct super_block *sb = vfs->mnt_sb; | 672 | struct super_block *sb = vfs->mnt_sb; |
673 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 673 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
674 | journal_t *journal = sbi->s_journal; | ||
674 | struct ext4_super_block *es = sbi->s_es; | 675 | struct ext4_super_block *es = sbi->s_es; |
675 | 676 | ||
676 | def_mount_opts = le32_to_cpu(es->s_default_mount_opts); | 677 | def_mount_opts = le32_to_cpu(es->s_default_mount_opts); |
@@ -729,8 +730,15 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs) | |||
729 | seq_printf(seq, ",commit=%u", | 730 | seq_printf(seq, ",commit=%u", |
730 | (unsigned) (sbi->s_commit_interval / HZ)); | 731 | (unsigned) (sbi->s_commit_interval / HZ)); |
731 | } | 732 | } |
732 | if (test_opt(sb, BARRIER)) | 733 | /* |
733 | seq_puts(seq, ",barrier=1"); | 734 | * We're changing the default of barrier mount option, so |
735 | * let's always display its mount state so it's clear what its | ||
736 | * status is. | ||
737 | */ | ||
738 | seq_puts(seq, ",barrier="); | ||
739 | seq_puts(seq, test_opt(sb, BARRIER) ? "1" : "0"); | ||
740 | if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) | ||
741 | seq_puts(seq, ",journal_async_commit"); | ||
734 | if (test_opt(sb, NOBH)) | 742 | if (test_opt(sb, NOBH)) |
735 | seq_puts(seq, ",nobh"); | 743 | seq_puts(seq, ",nobh"); |
736 | if (!test_opt(sb, EXTENTS)) | 744 | if (!test_opt(sb, EXTENTS)) |
@@ -1907,6 +1915,7 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent) | |||
1907 | sbi->s_resgid = le16_to_cpu(es->s_def_resgid); | 1915 | sbi->s_resgid = le16_to_cpu(es->s_def_resgid); |
1908 | 1916 | ||
1909 | set_opt(sbi->s_mount_opt, RESERVATION); | 1917 | set_opt(sbi->s_mount_opt, RESERVATION); |
1918 | set_opt(sbi->s_mount_opt, BARRIER); | ||
1910 | 1919 | ||
1911 | /* | 1920 | /* |
1912 | * turn on extents feature by default in ext4 filesystem | 1921 | * turn on extents feature by default in ext4 filesystem |
@@ -2189,6 +2198,29 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent) | |||
2189 | EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) { | 2198 | EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) { |
2190 | if (ext4_load_journal(sb, es, journal_devnum)) | 2199 | if (ext4_load_journal(sb, es, journal_devnum)) |
2191 | goto failed_mount3; | 2200 | goto failed_mount3; |
2201 | if (!(sb->s_flags & MS_RDONLY) && | ||
2202 | EXT4_SB(sb)->s_journal->j_failed_commit) { | ||
2203 | printk(KERN_CRIT "EXT4-fs error (device %s): " | ||
2204 | "ext4_fill_super: Journal transaction " | ||
2205 | "%u is corrupt\n", sb->s_id, | ||
2206 | EXT4_SB(sb)->s_journal->j_failed_commit); | ||
2207 | if (test_opt (sb, ERRORS_RO)) { | ||
2208 | printk (KERN_CRIT | ||
2209 | "Mounting filesystem read-only\n"); | ||
2210 | sb->s_flags |= MS_RDONLY; | ||
2211 | EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS; | ||
2212 | es->s_state |= cpu_to_le16(EXT4_ERROR_FS); | ||
2213 | } | ||
2214 | if (test_opt(sb, ERRORS_PANIC)) { | ||
2215 | EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS; | ||
2216 | es->s_state |= cpu_to_le16(EXT4_ERROR_FS); | ||
2217 | ext4_commit_super(sb, es, 1); | ||
2218 | printk(KERN_CRIT | ||
2219 | "EXT4-fs (device %s): mount failed\n", | ||
2220 | sb->s_id); | ||
2221 | goto failed_mount4; | ||
2222 | } | ||
2223 | } | ||
2192 | } else if (journal_inum) { | 2224 | } else if (journal_inum) { |
2193 | if (ext4_create_journal(sb, es, journal_inum)) | 2225 | if (ext4_create_journal(sb, es, journal_inum)) |
2194 | goto failed_mount3; | 2226 | goto failed_mount3; |
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index fb77e0962132..43e99513334a 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
@@ -488,7 +488,12 @@ static struct fuse_conn *new_conn(struct super_block *sb) | |||
488 | err = bdi_init(&fc->bdi); | 488 | err = bdi_init(&fc->bdi); |
489 | if (err) | 489 | if (err) |
490 | goto error_kfree; | 490 | goto error_kfree; |
491 | err = bdi_register_dev(&fc->bdi, fc->dev); | 491 | if (sb->s_bdev) { |
492 | err = bdi_register(&fc->bdi, NULL, "%u:%u-fuseblk", | ||
493 | MAJOR(fc->dev), MINOR(fc->dev)); | ||
494 | } else { | ||
495 | err = bdi_register_dev(&fc->bdi, fc->dev); | ||
496 | } | ||
492 | if (err) | 497 | if (err) |
493 | goto error_bdi_destroy; | 498 | goto error_bdi_destroy; |
494 | /* | 499 | /* |
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 4d99685fdce4..a2ed72f7ceee 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
@@ -168,6 +168,7 @@ static int journal_submit_commit_record(journal_t *journal, | |||
168 | spin_unlock(&journal->j_state_lock); | 168 | spin_unlock(&journal->j_state_lock); |
169 | 169 | ||
170 | /* And try again, without the barrier */ | 170 | /* And try again, without the barrier */ |
171 | lock_buffer(bh); | ||
171 | set_buffer_uptodate(bh); | 172 | set_buffer_uptodate(bh); |
172 | set_buffer_dirty(bh); | 173 | set_buffer_dirty(bh); |
173 | ret = submit_bh(WRITE, bh); | 174 | ret = submit_bh(WRITE, bh); |
diff --git a/fs/jbd2/recovery.c b/fs/jbd2/recovery.c index 5d0405a9e7ca..058f50f65b76 100644 --- a/fs/jbd2/recovery.c +++ b/fs/jbd2/recovery.c | |||
@@ -344,6 +344,7 @@ static int calc_chksums(journal_t *journal, struct buffer_head *bh, | |||
344 | *crc32_sum = crc32_be(*crc32_sum, (void *)obh->b_data, | 344 | *crc32_sum = crc32_be(*crc32_sum, (void *)obh->b_data, |
345 | obh->b_size); | 345 | obh->b_size); |
346 | } | 346 | } |
347 | put_bh(obh); | ||
347 | } | 348 | } |
348 | return 0; | 349 | return 0; |
349 | } | 350 | } |
@@ -610,9 +611,8 @@ static int do_one_pass(journal_t *journal, | |||
610 | chksum_err = chksum_seen = 0; | 611 | chksum_err = chksum_seen = 0; |
611 | 612 | ||
612 | if (info->end_transaction) { | 613 | if (info->end_transaction) { |
613 | printk(KERN_ERR "JBD: Transaction %u " | 614 | journal->j_failed_commit = |
614 | "found to be corrupt.\n", | 615 | info->end_transaction; |
615 | next_commit_ID - 1); | ||
616 | brelse(bh); | 616 | brelse(bh); |
617 | break; | 617 | break; |
618 | } | 618 | } |
@@ -643,10 +643,8 @@ static int do_one_pass(journal_t *journal, | |||
643 | 643 | ||
644 | if (!JBD2_HAS_INCOMPAT_FEATURE(journal, | 644 | if (!JBD2_HAS_INCOMPAT_FEATURE(journal, |
645 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)){ | 645 | JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)){ |
646 | printk(KERN_ERR | 646 | journal->j_failed_commit = |
647 | "JBD: Transaction %u " | 647 | next_commit_ID; |
648 | "found to be corrupt.\n", | ||
649 | next_commit_ID); | ||
650 | brelse(bh); | 648 | brelse(bh); |
651 | break; | 649 | break; |
652 | } | 650 | } |
diff --git a/fs/libfs.c b/fs/libfs.c index b004dfadd891..892d41cb3382 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -528,6 +528,23 @@ ssize_t simple_read_from_buffer(void __user *to, size_t count, loff_t *ppos, | |||
528 | return count; | 528 | return count; |
529 | } | 529 | } |
530 | 530 | ||
531 | ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, | ||
532 | const void *from, size_t available) | ||
533 | { | ||
534 | loff_t pos = *ppos; | ||
535 | |||
536 | if (pos < 0) | ||
537 | return -EINVAL; | ||
538 | if (pos >= available) | ||
539 | return 0; | ||
540 | if (count > available - pos) | ||
541 | count = available - pos; | ||
542 | memcpy(to, from + pos, count); | ||
543 | *ppos = pos + count; | ||
544 | |||
545 | return count; | ||
546 | } | ||
547 | |||
531 | /* | 548 | /* |
532 | * Transaction based IO. | 549 | * Transaction based IO. |
533 | * The file expects a single write which triggers the transaction, and then | 550 | * The file expects a single write which triggers the transaction, and then |
@@ -800,6 +817,7 @@ EXPORT_SYMBOL(simple_statfs); | |||
800 | EXPORT_SYMBOL(simple_sync_file); | 817 | EXPORT_SYMBOL(simple_sync_file); |
801 | EXPORT_SYMBOL(simple_unlink); | 818 | EXPORT_SYMBOL(simple_unlink); |
802 | EXPORT_SYMBOL(simple_read_from_buffer); | 819 | EXPORT_SYMBOL(simple_read_from_buffer); |
820 | EXPORT_SYMBOL(memory_read_from_buffer); | ||
803 | EXPORT_SYMBOL(simple_transaction_get); | 821 | EXPORT_SYMBOL(simple_transaction_get); |
804 | EXPORT_SYMBOL(simple_transaction_read); | 822 | EXPORT_SYMBOL(simple_transaction_read); |
805 | EXPORT_SYMBOL(simple_transaction_release); | 823 | EXPORT_SYMBOL(simple_transaction_release); |
diff --git a/fs/ntfs/upcase.c b/fs/ntfs/upcase.c index 9101807dc81a..e2f72ca98037 100644 --- a/fs/ntfs/upcase.c +++ b/fs/ntfs/upcase.c | |||
@@ -77,11 +77,10 @@ ntfschar *generate_default_upcase(void) | |||
77 | uc[i] = cpu_to_le16(i); | 77 | uc[i] = cpu_to_le16(i); |
78 | for (r = 0; uc_run_table[r][0]; r++) | 78 | for (r = 0; uc_run_table[r][0]; r++) |
79 | for (i = uc_run_table[r][0]; i < uc_run_table[r][1]; i++) | 79 | for (i = uc_run_table[r][0]; i < uc_run_table[r][1]; i++) |
80 | uc[i] = cpu_to_le16(le16_to_cpu(uc[i]) + | 80 | le16_add_cpu(&uc[i], uc_run_table[r][2]); |
81 | uc_run_table[r][2]); | ||
82 | for (r = 0; uc_dup_table[r][0]; r++) | 81 | for (r = 0; uc_dup_table[r][0]; r++) |
83 | for (i = uc_dup_table[r][0]; i < uc_dup_table[r][1]; i += 2) | 82 | for (i = uc_dup_table[r][0]; i < uc_dup_table[r][1]; i += 2) |
84 | uc[i + 1] = cpu_to_le16(le16_to_cpu(uc[i + 1]) - 1); | 83 | le16_add_cpu(&uc[i + 1], -1); |
85 | for (r = 0; uc_word_table[r][0]; r++) | 84 | for (r = 0; uc_word_table[r][0]; r++) |
86 | uc[uc_word_table[r][0]] = cpu_to_le16(uc_word_table[r][1]); | 85 | uc[uc_word_table[r][0]] = cpu_to_le16(uc_word_table[r][1]); |
87 | return uc; | 86 | return uc; |
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c index 1e44ad14881a..a27d61581bd6 100644 --- a/fs/ocfs2/cluster/tcp.c +++ b/fs/ocfs2/cluster/tcp.c | |||
@@ -142,53 +142,43 @@ static void o2net_idle_timer(unsigned long data); | |||
142 | static void o2net_sc_postpone_idle(struct o2net_sock_container *sc); | 142 | static void o2net_sc_postpone_idle(struct o2net_sock_container *sc); |
143 | static void o2net_sc_reset_idle_timer(struct o2net_sock_container *sc); | 143 | static void o2net_sc_reset_idle_timer(struct o2net_sock_container *sc); |
144 | 144 | ||
145 | static void o2net_init_nst(struct o2net_send_tracking *nst, u32 msgtype, | ||
146 | u32 msgkey, struct task_struct *task, u8 node) | ||
147 | { | ||
148 | #ifdef CONFIG_DEBUG_FS | 145 | #ifdef CONFIG_DEBUG_FS |
146 | void o2net_init_nst(struct o2net_send_tracking *nst, u32 msgtype, | ||
147 | u32 msgkey, struct task_struct *task, u8 node) | ||
148 | { | ||
149 | INIT_LIST_HEAD(&nst->st_net_debug_item); | 149 | INIT_LIST_HEAD(&nst->st_net_debug_item); |
150 | nst->st_task = task; | 150 | nst->st_task = task; |
151 | nst->st_msg_type = msgtype; | 151 | nst->st_msg_type = msgtype; |
152 | nst->st_msg_key = msgkey; | 152 | nst->st_msg_key = msgkey; |
153 | nst->st_node = node; | 153 | nst->st_node = node; |
154 | #endif | ||
155 | } | 154 | } |
156 | 155 | ||
157 | static void o2net_set_nst_sock_time(struct o2net_send_tracking *nst) | 156 | void o2net_set_nst_sock_time(struct o2net_send_tracking *nst) |
158 | { | 157 | { |
159 | #ifdef CONFIG_DEBUG_FS | ||
160 | do_gettimeofday(&nst->st_sock_time); | 158 | do_gettimeofday(&nst->st_sock_time); |
161 | #endif | ||
162 | } | 159 | } |
163 | 160 | ||
164 | static void o2net_set_nst_send_time(struct o2net_send_tracking *nst) | 161 | void o2net_set_nst_send_time(struct o2net_send_tracking *nst) |
165 | { | 162 | { |
166 | #ifdef CONFIG_DEBUG_FS | ||
167 | do_gettimeofday(&nst->st_send_time); | 163 | do_gettimeofday(&nst->st_send_time); |
168 | #endif | ||
169 | } | 164 | } |
170 | 165 | ||
171 | static void o2net_set_nst_status_time(struct o2net_send_tracking *nst) | 166 | void o2net_set_nst_status_time(struct o2net_send_tracking *nst) |
172 | { | 167 | { |
173 | #ifdef CONFIG_DEBUG_FS | ||
174 | do_gettimeofday(&nst->st_status_time); | 168 | do_gettimeofday(&nst->st_status_time); |
175 | #endif | ||
176 | } | 169 | } |
177 | 170 | ||
178 | static void o2net_set_nst_sock_container(struct o2net_send_tracking *nst, | 171 | void o2net_set_nst_sock_container(struct o2net_send_tracking *nst, |
179 | struct o2net_sock_container *sc) | 172 | struct o2net_sock_container *sc) |
180 | { | 173 | { |
181 | #ifdef CONFIG_DEBUG_FS | ||
182 | nst->st_sc = sc; | 174 | nst->st_sc = sc; |
183 | #endif | ||
184 | } | 175 | } |
185 | 176 | ||
186 | static void o2net_set_nst_msg_id(struct o2net_send_tracking *nst, u32 msg_id) | 177 | void o2net_set_nst_msg_id(struct o2net_send_tracking *nst, u32 msg_id) |
187 | { | 178 | { |
188 | #ifdef CONFIG_DEBUG_FS | ||
189 | nst->st_id = msg_id; | 179 | nst->st_id = msg_id; |
190 | #endif | ||
191 | } | 180 | } |
181 | #endif /* CONFIG_DEBUG_FS */ | ||
192 | 182 | ||
193 | static inline int o2net_reconnect_delay(void) | 183 | static inline int o2net_reconnect_delay(void) |
194 | { | 184 | { |
diff --git a/fs/ocfs2/cluster/tcp.h b/fs/ocfs2/cluster/tcp.h index a705d5d19036..fd6179eb26d4 100644 --- a/fs/ocfs2/cluster/tcp.h +++ b/fs/ocfs2/cluster/tcp.h | |||
@@ -128,23 +128,23 @@ void o2net_debug_del_nst(struct o2net_send_tracking *nst); | |||
128 | void o2net_debug_add_sc(struct o2net_sock_container *sc); | 128 | void o2net_debug_add_sc(struct o2net_sock_container *sc); |
129 | void o2net_debug_del_sc(struct o2net_sock_container *sc); | 129 | void o2net_debug_del_sc(struct o2net_sock_container *sc); |
130 | #else | 130 | #else |
131 | static int o2net_debugfs_init(void) | 131 | static inline int o2net_debugfs_init(void) |
132 | { | 132 | { |
133 | return 0; | 133 | return 0; |
134 | } | 134 | } |
135 | static void o2net_debugfs_exit(void) | 135 | static inline void o2net_debugfs_exit(void) |
136 | { | 136 | { |
137 | } | 137 | } |
138 | static void o2net_debug_add_nst(struct o2net_send_tracking *nst) | 138 | static inline void o2net_debug_add_nst(struct o2net_send_tracking *nst) |
139 | { | 139 | { |
140 | } | 140 | } |
141 | static void o2net_debug_del_nst(struct o2net_send_tracking *nst) | 141 | static inline void o2net_debug_del_nst(struct o2net_send_tracking *nst) |
142 | { | 142 | { |
143 | } | 143 | } |
144 | static void o2net_debug_add_sc(struct o2net_sock_container *sc) | 144 | static inline void o2net_debug_add_sc(struct o2net_sock_container *sc) |
145 | { | 145 | { |
146 | } | 146 | } |
147 | static void o2net_debug_del_sc(struct o2net_sock_container *sc) | 147 | static inline void o2net_debug_del_sc(struct o2net_sock_container *sc) |
148 | { | 148 | { |
149 | } | 149 | } |
150 | #endif /* CONFIG_DEBUG_FS */ | 150 | #endif /* CONFIG_DEBUG_FS */ |
diff --git a/fs/ocfs2/cluster/tcp_internal.h b/fs/ocfs2/cluster/tcp_internal.h index 8d58cfe410b1..18307ff81b77 100644 --- a/fs/ocfs2/cluster/tcp_internal.h +++ b/fs/ocfs2/cluster/tcp_internal.h | |||
@@ -224,10 +224,42 @@ struct o2net_send_tracking { | |||
224 | struct timeval st_send_time; | 224 | struct timeval st_send_time; |
225 | struct timeval st_status_time; | 225 | struct timeval st_status_time; |
226 | }; | 226 | }; |
227 | |||
228 | void o2net_init_nst(struct o2net_send_tracking *nst, u32 msgtype, | ||
229 | u32 msgkey, struct task_struct *task, u8 node); | ||
230 | void o2net_set_nst_sock_time(struct o2net_send_tracking *nst); | ||
231 | void o2net_set_nst_send_time(struct o2net_send_tracking *nst); | ||
232 | void o2net_set_nst_status_time(struct o2net_send_tracking *nst); | ||
233 | void o2net_set_nst_sock_container(struct o2net_send_tracking *nst, | ||
234 | struct o2net_sock_container *sc); | ||
235 | void o2net_set_nst_msg_id(struct o2net_send_tracking *nst, u32 msg_id); | ||
236 | |||
227 | #else | 237 | #else |
228 | struct o2net_send_tracking { | 238 | struct o2net_send_tracking { |
229 | u32 dummy; | 239 | u32 dummy; |
230 | }; | 240 | }; |
241 | |||
242 | static inline void o2net_init_nst(struct o2net_send_tracking *nst, u32 msgtype, | ||
243 | u32 msgkey, struct task_struct *task, u8 node) | ||
244 | { | ||
245 | } | ||
246 | static inline void o2net_set_nst_sock_time(struct o2net_send_tracking *nst) | ||
247 | { | ||
248 | } | ||
249 | static inline void o2net_set_nst_send_time(struct o2net_send_tracking *nst) | ||
250 | { | ||
251 | } | ||
252 | static inline void o2net_set_nst_status_time(struct o2net_send_tracking *nst) | ||
253 | { | ||
254 | } | ||
255 | static inline void o2net_set_nst_sock_container(struct o2net_send_tracking *nst, | ||
256 | struct o2net_sock_container *sc) | ||
257 | { | ||
258 | } | ||
259 | static inline void o2net_set_nst_msg_id(struct o2net_send_tracking *nst, | ||
260 | u32 msg_id) | ||
261 | { | ||
262 | } | ||
231 | #endif /* CONFIG_DEBUG_FS */ | 263 | #endif /* CONFIG_DEBUG_FS */ |
232 | 264 | ||
233 | #endif /* O2CLUSTER_TCP_INTERNAL_H */ | 265 | #endif /* O2CLUSTER_TCP_INTERNAL_H */ |
diff --git a/fs/ocfs2/dlm/dlmdebug.h b/fs/ocfs2/dlm/dlmdebug.h index d34a62a3a625..8c686d22f9c7 100644 --- a/fs/ocfs2/dlm/dlmdebug.h +++ b/fs/ocfs2/dlm/dlmdebug.h | |||
@@ -60,25 +60,25 @@ void dlm_destroy_debugfs_root(void); | |||
60 | 60 | ||
61 | #else | 61 | #else |
62 | 62 | ||
63 | static int dlm_debug_init(struct dlm_ctxt *dlm) | 63 | static inline int dlm_debug_init(struct dlm_ctxt *dlm) |
64 | { | 64 | { |
65 | return 0; | 65 | return 0; |
66 | } | 66 | } |
67 | static void dlm_debug_shutdown(struct dlm_ctxt *dlm) | 67 | static inline void dlm_debug_shutdown(struct dlm_ctxt *dlm) |
68 | { | 68 | { |
69 | } | 69 | } |
70 | static int dlm_create_debugfs_subroot(struct dlm_ctxt *dlm) | 70 | static inline int dlm_create_debugfs_subroot(struct dlm_ctxt *dlm) |
71 | { | 71 | { |
72 | return 0; | 72 | return 0; |
73 | } | 73 | } |
74 | static void dlm_destroy_debugfs_subroot(struct dlm_ctxt *dlm) | 74 | static inline void dlm_destroy_debugfs_subroot(struct dlm_ctxt *dlm) |
75 | { | 75 | { |
76 | } | 76 | } |
77 | static int dlm_create_debugfs_root(void) | 77 | static inline int dlm_create_debugfs_root(void) |
78 | { | 78 | { |
79 | return 0; | 79 | return 0; |
80 | } | 80 | } |
81 | static void dlm_destroy_debugfs_root(void) | 81 | static inline void dlm_destroy_debugfs_root(void) |
82 | { | 82 | { |
83 | } | 83 | } |
84 | 84 | ||
diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c index b503772cd0ec..6b97d11f6bf8 100644 --- a/fs/ocfs2/stack_user.c +++ b/fs/ocfs2/stack_user.c | |||
@@ -61,7 +61,7 @@ | |||
61 | * negotiated by the client. The client negotiates based on the maximum | 61 | * negotiated by the client. The client negotiates based on the maximum |
62 | * version advertised in /sys/fs/ocfs2/max_locking_protocol. The major | 62 | * version advertised in /sys/fs/ocfs2/max_locking_protocol. The major |
63 | * number from the "SETV" message must match | 63 | * number from the "SETV" message must match |
64 | * user_stack.sp_proto->lp_max_version.pv_major, and the minor number | 64 | * ocfs2_user_plugin.sp_proto->lp_max_version.pv_major, and the minor number |
65 | * must be less than or equal to ...->lp_max_version.pv_minor. | 65 | * must be less than or equal to ...->lp_max_version.pv_minor. |
66 | * | 66 | * |
67 | * Once this information has been set, mounts will be allowed. From this | 67 | * Once this information has been set, mounts will be allowed. From this |
@@ -153,7 +153,7 @@ union ocfs2_control_message { | |||
153 | struct ocfs2_control_message_down u_down; | 153 | struct ocfs2_control_message_down u_down; |
154 | }; | 154 | }; |
155 | 155 | ||
156 | static struct ocfs2_stack_plugin user_stack; | 156 | static struct ocfs2_stack_plugin ocfs2_user_plugin; |
157 | 157 | ||
158 | static atomic_t ocfs2_control_opened; | 158 | static atomic_t ocfs2_control_opened; |
159 | static int ocfs2_control_this_node = -1; | 159 | static int ocfs2_control_this_node = -1; |
@@ -399,7 +399,7 @@ static int ocfs2_control_do_setversion_msg(struct file *file, | |||
399 | char *ptr = NULL; | 399 | char *ptr = NULL; |
400 | struct ocfs2_control_private *p = file->private_data; | 400 | struct ocfs2_control_private *p = file->private_data; |
401 | struct ocfs2_protocol_version *max = | 401 | struct ocfs2_protocol_version *max = |
402 | &user_stack.sp_proto->lp_max_version; | 402 | &ocfs2_user_plugin.sp_proto->lp_max_version; |
403 | 403 | ||
404 | if (ocfs2_control_get_handshake_state(file) != | 404 | if (ocfs2_control_get_handshake_state(file) != |
405 | OCFS2_CONTROL_HANDSHAKE_PROTOCOL) | 405 | OCFS2_CONTROL_HANDSHAKE_PROTOCOL) |
@@ -680,7 +680,7 @@ static void fsdlm_lock_ast_wrapper(void *astarg) | |||
680 | struct dlm_lksb *lksb = fsdlm_astarg_to_lksb(astarg); | 680 | struct dlm_lksb *lksb = fsdlm_astarg_to_lksb(astarg); |
681 | int status = lksb->sb_status; | 681 | int status = lksb->sb_status; |
682 | 682 | ||
683 | BUG_ON(user_stack.sp_proto == NULL); | 683 | BUG_ON(ocfs2_user_plugin.sp_proto == NULL); |
684 | 684 | ||
685 | /* | 685 | /* |
686 | * For now we're punting on the issue of other non-standard errors | 686 | * For now we're punting on the issue of other non-standard errors |
@@ -693,16 +693,16 @@ static void fsdlm_lock_ast_wrapper(void *astarg) | |||
693 | */ | 693 | */ |
694 | 694 | ||
695 | if (status == -DLM_EUNLOCK || status == -DLM_ECANCEL) | 695 | if (status == -DLM_EUNLOCK || status == -DLM_ECANCEL) |
696 | user_stack.sp_proto->lp_unlock_ast(astarg, 0); | 696 | ocfs2_user_plugin.sp_proto->lp_unlock_ast(astarg, 0); |
697 | else | 697 | else |
698 | user_stack.sp_proto->lp_lock_ast(astarg); | 698 | ocfs2_user_plugin.sp_proto->lp_lock_ast(astarg); |
699 | } | 699 | } |
700 | 700 | ||
701 | static void fsdlm_blocking_ast_wrapper(void *astarg, int level) | 701 | static void fsdlm_blocking_ast_wrapper(void *astarg, int level) |
702 | { | 702 | { |
703 | BUG_ON(user_stack.sp_proto == NULL); | 703 | BUG_ON(ocfs2_user_plugin.sp_proto == NULL); |
704 | 704 | ||
705 | user_stack.sp_proto->lp_blocking_ast(astarg, level); | 705 | ocfs2_user_plugin.sp_proto->lp_blocking_ast(astarg, level); |
706 | } | 706 | } |
707 | 707 | ||
708 | static int user_dlm_lock(struct ocfs2_cluster_connection *conn, | 708 | static int user_dlm_lock(struct ocfs2_cluster_connection *conn, |
@@ -838,7 +838,7 @@ static int user_cluster_this_node(unsigned int *this_node) | |||
838 | return 0; | 838 | return 0; |
839 | } | 839 | } |
840 | 840 | ||
841 | static struct ocfs2_stack_operations user_stack_ops = { | 841 | static struct ocfs2_stack_operations ocfs2_user_plugin_ops = { |
842 | .connect = user_cluster_connect, | 842 | .connect = user_cluster_connect, |
843 | .disconnect = user_cluster_disconnect, | 843 | .disconnect = user_cluster_disconnect, |
844 | .this_node = user_cluster_this_node, | 844 | .this_node = user_cluster_this_node, |
@@ -849,20 +849,20 @@ static struct ocfs2_stack_operations user_stack_ops = { | |||
849 | .dump_lksb = user_dlm_dump_lksb, | 849 | .dump_lksb = user_dlm_dump_lksb, |
850 | }; | 850 | }; |
851 | 851 | ||
852 | static struct ocfs2_stack_plugin user_stack = { | 852 | static struct ocfs2_stack_plugin ocfs2_user_plugin = { |
853 | .sp_name = "user", | 853 | .sp_name = "user", |
854 | .sp_ops = &user_stack_ops, | 854 | .sp_ops = &ocfs2_user_plugin_ops, |
855 | .sp_owner = THIS_MODULE, | 855 | .sp_owner = THIS_MODULE, |
856 | }; | 856 | }; |
857 | 857 | ||
858 | 858 | ||
859 | static int __init user_stack_init(void) | 859 | static int __init ocfs2_user_plugin_init(void) |
860 | { | 860 | { |
861 | int rc; | 861 | int rc; |
862 | 862 | ||
863 | rc = ocfs2_control_init(); | 863 | rc = ocfs2_control_init(); |
864 | if (!rc) { | 864 | if (!rc) { |
865 | rc = ocfs2_stack_glue_register(&user_stack); | 865 | rc = ocfs2_stack_glue_register(&ocfs2_user_plugin); |
866 | if (rc) | 866 | if (rc) |
867 | ocfs2_control_exit(); | 867 | ocfs2_control_exit(); |
868 | } | 868 | } |
@@ -870,14 +870,14 @@ static int __init user_stack_init(void) | |||
870 | return rc; | 870 | return rc; |
871 | } | 871 | } |
872 | 872 | ||
873 | static void __exit user_stack_exit(void) | 873 | static void __exit ocfs2_user_plugin_exit(void) |
874 | { | 874 | { |
875 | ocfs2_stack_glue_unregister(&user_stack); | 875 | ocfs2_stack_glue_unregister(&ocfs2_user_plugin); |
876 | ocfs2_control_exit(); | 876 | ocfs2_control_exit(); |
877 | } | 877 | } |
878 | 878 | ||
879 | MODULE_AUTHOR("Oracle"); | 879 | MODULE_AUTHOR("Oracle"); |
880 | MODULE_DESCRIPTION("ocfs2 driver for userspace cluster stacks"); | 880 | MODULE_DESCRIPTION("ocfs2 driver for userspace cluster stacks"); |
881 | MODULE_LICENSE("GPL"); | 881 | MODULE_LICENSE("GPL"); |
882 | module_init(user_stack_init); | 882 | module_init(ocfs2_user_plugin_init); |
883 | module_exit(user_stack_exit); | 883 | module_exit(ocfs2_user_plugin_exit); |
diff --git a/fs/proc/array.c b/fs/proc/array.c index 9e3b8c33c24b..797d775e0354 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -288,7 +288,7 @@ static void render_cap_t(struct seq_file *m, const char *header, | |||
288 | seq_printf(m, "%s", header); | 288 | seq_printf(m, "%s", header); |
289 | CAP_FOR_EACH_U32(__capi) { | 289 | CAP_FOR_EACH_U32(__capi) { |
290 | seq_printf(m, "%08x", | 290 | seq_printf(m, "%08x", |
291 | a->cap[(_LINUX_CAPABILITY_U32S-1) - __capi]); | 291 | a->cap[(_KERNEL_CAPABILITY_U32S-1) - __capi]); |
292 | } | 292 | } |
293 | seq_printf(m, "\n"); | 293 | seq_printf(m, "\n"); |
294 | } | 294 | } |
diff --git a/fs/proc/base.c b/fs/proc/base.c index c447e0743a3c..3b455371e7ff 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -127,6 +127,25 @@ struct pid_entry { | |||
127 | NULL, &proc_single_file_operations, \ | 127 | NULL, &proc_single_file_operations, \ |
128 | { .proc_show = &proc_##OTYPE } ) | 128 | { .proc_show = &proc_##OTYPE } ) |
129 | 129 | ||
130 | /* | ||
131 | * Count the number of hardlinks for the pid_entry table, excluding the . | ||
132 | * and .. links. | ||
133 | */ | ||
134 | static unsigned int pid_entry_count_dirs(const struct pid_entry *entries, | ||
135 | unsigned int n) | ||
136 | { | ||
137 | unsigned int i; | ||
138 | unsigned int count; | ||
139 | |||
140 | count = 0; | ||
141 | for (i = 0; i < n; ++i) { | ||
142 | if (S_ISDIR(entries[i].mode)) | ||
143 | ++count; | ||
144 | } | ||
145 | |||
146 | return count; | ||
147 | } | ||
148 | |||
130 | int maps_protect; | 149 | int maps_protect; |
131 | EXPORT_SYMBOL(maps_protect); | 150 | EXPORT_SYMBOL(maps_protect); |
132 | 151 | ||
@@ -2585,10 +2604,9 @@ static struct dentry *proc_pid_instantiate(struct inode *dir, | |||
2585 | inode->i_op = &proc_tgid_base_inode_operations; | 2604 | inode->i_op = &proc_tgid_base_inode_operations; |
2586 | inode->i_fop = &proc_tgid_base_operations; | 2605 | inode->i_fop = &proc_tgid_base_operations; |
2587 | inode->i_flags|=S_IMMUTABLE; | 2606 | inode->i_flags|=S_IMMUTABLE; |
2588 | inode->i_nlink = 5; | 2607 | |
2589 | #ifdef CONFIG_SECURITY | 2608 | inode->i_nlink = 2 + pid_entry_count_dirs(tgid_base_stuff, |
2590 | inode->i_nlink += 1; | 2609 | ARRAY_SIZE(tgid_base_stuff)); |
2591 | #endif | ||
2592 | 2610 | ||
2593 | dentry->d_op = &pid_dentry_operations; | 2611 | dentry->d_op = &pid_dentry_operations; |
2594 | 2612 | ||
@@ -2816,10 +2834,9 @@ static struct dentry *proc_task_instantiate(struct inode *dir, | |||
2816 | inode->i_op = &proc_tid_base_inode_operations; | 2834 | inode->i_op = &proc_tid_base_inode_operations; |
2817 | inode->i_fop = &proc_tid_base_operations; | 2835 | inode->i_fop = &proc_tid_base_operations; |
2818 | inode->i_flags|=S_IMMUTABLE; | 2836 | inode->i_flags|=S_IMMUTABLE; |
2819 | inode->i_nlink = 4; | 2837 | |
2820 | #ifdef CONFIG_SECURITY | 2838 | inode->i_nlink = 2 + pid_entry_count_dirs(tid_base_stuff, |
2821 | inode->i_nlink += 1; | 2839 | ARRAY_SIZE(tid_base_stuff)); |
2822 | #endif | ||
2823 | 2840 | ||
2824 | dentry->d_op = &pid_dentry_operations; | 2841 | dentry->d_op = &pid_dentry_operations; |
2825 | 2842 | ||
diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 6f4e8dc97da1..b08d10017911 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c | |||
@@ -425,7 +425,8 @@ struct inode *proc_get_inode(struct super_block *sb, unsigned int ino, | |||
425 | } | 425 | } |
426 | } | 426 | } |
427 | unlock_new_inode(inode); | 427 | unlock_new_inode(inode); |
428 | } | 428 | } else |
429 | module_put(de->owner); | ||
429 | return inode; | 430 | return inode; |
430 | 431 | ||
431 | out_ino: | 432 | out_ino: |
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index 74a323d2b850..7e277f2ad466 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
@@ -139,7 +139,7 @@ static int meminfo_read_proc(char *page, char **start, off_t off, | |||
139 | #define K(x) ((x) << (PAGE_SHIFT - 10)) | 139 | #define K(x) ((x) << (PAGE_SHIFT - 10)) |
140 | si_meminfo(&i); | 140 | si_meminfo(&i); |
141 | si_swapinfo(&i); | 141 | si_swapinfo(&i); |
142 | committed = atomic_read(&vm_committed_space); | 142 | committed = atomic_long_read(&vm_committed_space); |
143 | allowed = ((totalram_pages - hugetlb_total_pages()) | 143 | allowed = ((totalram_pages - hugetlb_total_pages()) |
144 | * sysctl_overcommit_ratio / 100) + total_swap_pages; | 144 | * sysctl_overcommit_ratio / 100) + total_swap_pages; |
145 | 145 | ||
@@ -716,7 +716,7 @@ static ssize_t kpagecount_read(struct file *file, char __user *buf, | |||
716 | pfn = src / KPMSIZE; | 716 | pfn = src / KPMSIZE; |
717 | count = min_t(size_t, count, (max_pfn * KPMSIZE) - src); | 717 | count = min_t(size_t, count, (max_pfn * KPMSIZE) - src); |
718 | if (src & KPMMASK || count & KPMMASK) | 718 | if (src & KPMMASK || count & KPMMASK) |
719 | return -EIO; | 719 | return -EINVAL; |
720 | 720 | ||
721 | while (count > 0) { | 721 | while (count > 0) { |
722 | ppage = NULL; | 722 | ppage = NULL; |
@@ -726,7 +726,7 @@ static ssize_t kpagecount_read(struct file *file, char __user *buf, | |||
726 | if (!ppage) | 726 | if (!ppage) |
727 | pcount = 0; | 727 | pcount = 0; |
728 | else | 728 | else |
729 | pcount = atomic_read(&ppage->_count); | 729 | pcount = page_mapcount(ppage); |
730 | 730 | ||
731 | if (put_user(pcount, out++)) { | 731 | if (put_user(pcount, out++)) { |
732 | ret = -EFAULT; | 732 | ret = -EFAULT; |
@@ -782,7 +782,7 @@ static ssize_t kpageflags_read(struct file *file, char __user *buf, | |||
782 | pfn = src / KPMSIZE; | 782 | pfn = src / KPMSIZE; |
783 | count = min_t(unsigned long, count, (max_pfn * KPMSIZE) - src); | 783 | count = min_t(unsigned long, count, (max_pfn * KPMSIZE) - src); |
784 | if (src & KPMMASK || count & KPMMASK) | 784 | if (src & KPMMASK || count & KPMMASK) |
785 | return -EIO; | 785 | return -EINVAL; |
786 | 786 | ||
787 | while (count > 0) { | 787 | while (count > 0) { |
788 | ppage = NULL; | 788 | ppage = NULL; |
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 88717c0f941b..17403629e330 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -496,7 +496,7 @@ const struct file_operations proc_clear_refs_operations = { | |||
496 | }; | 496 | }; |
497 | 497 | ||
498 | struct pagemapread { | 498 | struct pagemapread { |
499 | char __user *out, *end; | 499 | u64 __user *out, *end; |
500 | }; | 500 | }; |
501 | 501 | ||
502 | #define PM_ENTRY_BYTES sizeof(u64) | 502 | #define PM_ENTRY_BYTES sizeof(u64) |
@@ -519,21 +519,11 @@ struct pagemapread { | |||
519 | static int add_to_pagemap(unsigned long addr, u64 pfn, | 519 | static int add_to_pagemap(unsigned long addr, u64 pfn, |
520 | struct pagemapread *pm) | 520 | struct pagemapread *pm) |
521 | { | 521 | { |
522 | /* | ||
523 | * Make sure there's room in the buffer for an | ||
524 | * entire entry. Otherwise, only copy part of | ||
525 | * the pfn. | ||
526 | */ | ||
527 | if (pm->out + PM_ENTRY_BYTES >= pm->end) { | ||
528 | if (copy_to_user(pm->out, &pfn, pm->end - pm->out)) | ||
529 | return -EFAULT; | ||
530 | pm->out = pm->end; | ||
531 | return PM_END_OF_BUFFER; | ||
532 | } | ||
533 | |||
534 | if (put_user(pfn, pm->out)) | 522 | if (put_user(pfn, pm->out)) |
535 | return -EFAULT; | 523 | return -EFAULT; |
536 | pm->out += PM_ENTRY_BYTES; | 524 | pm->out++; |
525 | if (pm->out >= pm->end) | ||
526 | return PM_END_OF_BUFFER; | ||
537 | return 0; | 527 | return 0; |
538 | } | 528 | } |
539 | 529 | ||
@@ -634,7 +624,7 @@ static ssize_t pagemap_read(struct file *file, char __user *buf, | |||
634 | 624 | ||
635 | ret = -EINVAL; | 625 | ret = -EINVAL; |
636 | /* file position must be aligned */ | 626 | /* file position must be aligned */ |
637 | if (*ppos % PM_ENTRY_BYTES) | 627 | if ((*ppos % PM_ENTRY_BYTES) || (count % PM_ENTRY_BYTES)) |
638 | goto out_task; | 628 | goto out_task; |
639 | 629 | ||
640 | ret = 0; | 630 | ret = 0; |
@@ -664,8 +654,8 @@ static ssize_t pagemap_read(struct file *file, char __user *buf, | |||
664 | goto out_pages; | 654 | goto out_pages; |
665 | } | 655 | } |
666 | 656 | ||
667 | pm.out = buf; | 657 | pm.out = (u64 *)buf; |
668 | pm.end = buf + count; | 658 | pm.end = (u64 *)(buf + count); |
669 | 659 | ||
670 | if (!ptrace_may_attach(task)) { | 660 | if (!ptrace_may_attach(task)) { |
671 | ret = -EIO; | 661 | ret = -EIO; |
@@ -690,9 +680,9 @@ static ssize_t pagemap_read(struct file *file, char __user *buf, | |||
690 | if (ret == PM_END_OF_BUFFER) | 680 | if (ret == PM_END_OF_BUFFER) |
691 | ret = 0; | 681 | ret = 0; |
692 | /* don't need mmap_sem for these, but this looks cleaner */ | 682 | /* don't need mmap_sem for these, but this looks cleaner */ |
693 | *ppos += pm.out - buf; | 683 | *ppos += (char *)pm.out - buf; |
694 | if (!ret) | 684 | if (!ret) |
695 | ret = pm.out - buf; | 685 | ret = (char *)pm.out - buf; |
696 | } | 686 | } |
697 | 687 | ||
698 | out_pages: | 688 | out_pages: |
diff --git a/fs/splice.c b/fs/splice.c index 78150038b584..aa5f6f60b305 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -58,8 +58,8 @@ static int page_cache_pipe_buf_steal(struct pipe_inode_info *pipe, | |||
58 | */ | 58 | */ |
59 | wait_on_page_writeback(page); | 59 | wait_on_page_writeback(page); |
60 | 60 | ||
61 | if (PagePrivate(page)) | 61 | if (PagePrivate(page) && !try_to_release_page(page, GFP_KERNEL)) |
62 | try_to_release_page(page, GFP_KERNEL); | 62 | goto out_unlock; |
63 | 63 | ||
64 | /* | 64 | /* |
65 | * If we succeeded in removing the mapping, set LRU flag | 65 | * If we succeeded in removing the mapping, set LRU flag |
@@ -75,6 +75,7 @@ static int page_cache_pipe_buf_steal(struct pipe_inode_info *pipe, | |||
75 | * Raced with truncate or failed to remove page from current | 75 | * Raced with truncate or failed to remove page from current |
76 | * address space, unlock and return failure. | 76 | * address space, unlock and return failure. |
77 | */ | 77 | */ |
78 | out_unlock: | ||
78 | unlock_page(page); | 79 | unlock_page(page); |
79 | return 1; | 80 | return 1; |
80 | } | 81 | } |
@@ -983,7 +984,7 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd, | |||
983 | 984 | ||
984 | while (len) { | 985 | while (len) { |
985 | size_t read_len; | 986 | size_t read_len; |
986 | loff_t pos = sd->pos; | 987 | loff_t pos = sd->pos, prev_pos = pos; |
987 | 988 | ||
988 | ret = do_splice_to(in, &pos, pipe, len, flags); | 989 | ret = do_splice_to(in, &pos, pipe, len, flags); |
989 | if (unlikely(ret <= 0)) | 990 | if (unlikely(ret <= 0)) |
@@ -998,15 +999,19 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd, | |||
998 | * could get stuck data in the internal pipe: | 999 | * could get stuck data in the internal pipe: |
999 | */ | 1000 | */ |
1000 | ret = actor(pipe, sd); | 1001 | ret = actor(pipe, sd); |
1001 | if (unlikely(ret <= 0)) | 1002 | if (unlikely(ret <= 0)) { |
1003 | sd->pos = prev_pos; | ||
1002 | goto out_release; | 1004 | goto out_release; |
1005 | } | ||
1003 | 1006 | ||
1004 | bytes += ret; | 1007 | bytes += ret; |
1005 | len -= ret; | 1008 | len -= ret; |
1006 | sd->pos = pos; | 1009 | sd->pos = pos; |
1007 | 1010 | ||
1008 | if (ret < read_len) | 1011 | if (ret < read_len) { |
1012 | sd->pos = prev_pos + ret; | ||
1009 | goto out_release; | 1013 | goto out_release; |
1014 | } | ||
1010 | } | 1015 | } |
1011 | 1016 | ||
1012 | done: | 1017 | done: |
@@ -1072,7 +1077,7 @@ long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, | |||
1072 | 1077 | ||
1073 | ret = splice_direct_to_actor(in, &sd, direct_splice_actor); | 1078 | ret = splice_direct_to_actor(in, &sd, direct_splice_actor); |
1074 | if (ret > 0) | 1079 | if (ret > 0) |
1075 | *ppos += ret; | 1080 | *ppos = sd.pos; |
1076 | 1081 | ||
1077 | return ret; | 1082 | return ret; |
1078 | } | 1083 | } |