aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/9p/vfs_file.c4
-rw-r--r--fs/Kconfig6
-rw-r--r--fs/aio.c5
-rw-r--r--fs/binfmt_elf_fdpic.c2
-rw-r--r--fs/buffer.c3
-rw-r--r--fs/coda/sysctl.c76
-rw-r--r--fs/configfs/dir.c3
-rw-r--r--fs/dlm/memory.c4
-rw-r--r--fs/dquot.c3
-rw-r--r--fs/drop_caches.c2
-rw-r--r--fs/ecryptfs/crypto.c4
-rw-r--r--fs/ecryptfs/file.c3
-rw-r--r--fs/ecryptfs/inode.c5
-rw-r--r--fs/ecryptfs/keystore.c4
-rw-r--r--fs/ecryptfs/main.c8
-rw-r--r--fs/exec.c4
-rw-r--r--fs/ext2/dir.c8
-rw-r--r--fs/ext2/super.c4
-rw-r--r--fs/ext3/inode.c4
-rw-r--r--fs/ext3/namei.c27
-rw-r--r--fs/ext3/super.c20
-rw-r--r--fs/ext4/inode.c4
-rw-r--r--fs/ext4/namei.c27
-rw-r--r--fs/ext4/super.c20
-rw-r--r--fs/fuse/file.c2
-rw-r--r--fs/fuse/inode.c2
-rw-r--r--fs/gfs2/meta_io.c3
-rw-r--r--fs/hfs/hfs.h2
-rw-r--r--fs/hfsplus/hfsplus_raw.h2
-rw-r--r--fs/inode.c9
-rw-r--r--fs/jffs/inode-v23.c4
-rw-r--r--fs/namespace.c3
-rw-r--r--fs/partitions/msdos.c20
-rw-r--r--fs/proc/base.c4
-rw-r--r--fs/proc/proc_misc.c28
-rw-r--r--fs/ramfs/file-mmu.c2
-rw-r--r--fs/ramfs/file-nommu.c2
-rw-r--r--fs/read_write.c24
-rw-r--r--fs/smbfs/request.c3
-rw-r--r--fs/sysfs/dir.c3
40 files changed, 192 insertions, 171 deletions
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index 9f17b0cacdd0..6c78343cf690 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -110,7 +110,7 @@ static int v9fs_file_lock(struct file *filp, int cmd, struct file_lock *fl)
110 110
111 if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) { 111 if ((IS_SETLK(cmd) || IS_SETLKW(cmd)) && fl->fl_type != F_UNLCK) {
112 filemap_write_and_wait(inode->i_mapping); 112 filemap_write_and_wait(inode->i_mapping);
113 invalidate_inode_pages(&inode->i_data); 113 invalidate_mapping_pages(&inode->i_data, 0, -1);
114 } 114 }
115 115
116 return res; 116 return res;
@@ -234,7 +234,7 @@ v9fs_file_write(struct file *filp, const char __user * data,
234 total += result; 234 total += result;
235 } while (count); 235 } while (count);
236 236
237 invalidate_inode_pages2(inode->i_mapping); 237 invalidate_inode_pages2(inode->i_mapping);
238 return total; 238 return total;
239} 239}
240 240
diff --git a/fs/Kconfig b/fs/Kconfig
index 5e8e9d9ccb33..11c59329ed06 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -674,12 +674,6 @@ config ZISOFS
674 necessary to create such a filesystem. Say Y here if you want to be 674 necessary to create such a filesystem. Say Y here if you want to be
675 able to read such compressed CD-ROMs. 675 able to read such compressed CD-ROMs.
676 676
677config ZISOFS_FS
678# for fs/nls/Config.in
679 tristate
680 depends on ZISOFS
681 default ISO9660_FS
682
683config UDF_FS 677config UDF_FS
684 tristate "UDF file system support" 678 tristate "UDF file system support"
685 help 679 help
diff --git a/fs/aio.c b/fs/aio.c
index 55991e4132a7..0b4ee0a5c83e 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -132,7 +132,7 @@ static int aio_setup_ring(struct kioctx *ctx)
132 dprintk("attempting mmap of %lu bytes\n", info->mmap_size); 132 dprintk("attempting mmap of %lu bytes\n", info->mmap_size);
133 down_write(&ctx->mm->mmap_sem); 133 down_write(&ctx->mm->mmap_sem);
134 info->mmap_base = do_mmap(NULL, 0, info->mmap_size, 134 info->mmap_base = do_mmap(NULL, 0, info->mmap_size,
135 PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, 135 PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE,
136 0); 136 0);
137 if (IS_ERR((void *)info->mmap_base)) { 137 if (IS_ERR((void *)info->mmap_base)) {
138 up_write(&ctx->mm->mmap_sem); 138 up_write(&ctx->mm->mmap_sem);
@@ -211,11 +211,10 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
211 if ((unsigned long)nr_events > aio_max_nr) 211 if ((unsigned long)nr_events > aio_max_nr)
212 return ERR_PTR(-EAGAIN); 212 return ERR_PTR(-EAGAIN);
213 213
214 ctx = kmem_cache_alloc(kioctx_cachep, GFP_KERNEL); 214 ctx = kmem_cache_zalloc(kioctx_cachep, GFP_KERNEL);
215 if (!ctx) 215 if (!ctx)
216 return ERR_PTR(-ENOMEM); 216 return ERR_PTR(-ENOMEM);
217 217
218 memset(ctx, 0, sizeof(*ctx));
219 ctx->max_reqs = nr_events; 218 ctx->max_reqs = nr_events;
220 mm = ctx->mm = current->mm; 219 mm = ctx->mm = current->mm;
221 atomic_inc(&mm->mm_count); 220 atomic_inc(&mm->mm_count);
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index a4d933a51208..5810aa1339fd 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -372,7 +372,7 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm,
372 down_write(&current->mm->mmap_sem); 372 down_write(&current->mm->mmap_sem);
373 current->mm->start_brk = do_mmap(NULL, 0, stack_size, 373 current->mm->start_brk = do_mmap(NULL, 0, stack_size,
374 PROT_READ | PROT_WRITE | PROT_EXEC, 374 PROT_READ | PROT_WRITE | PROT_EXEC,
375 MAP_PRIVATE | MAP_ANON | MAP_GROWSDOWN, 375 MAP_PRIVATE | MAP_ANONYMOUS | MAP_GROWSDOWN,
376 0); 376 0);
377 377
378 if (IS_ERR_VALUE(current->mm->start_brk)) { 378 if (IS_ERR_VALUE(current->mm->start_brk)) {
diff --git a/fs/buffer.c b/fs/buffer.c
index 1ad674fd348c..7ff6e9346fae 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -78,6 +78,7 @@ EXPORT_SYMBOL(__lock_buffer);
78 78
79void fastcall unlock_buffer(struct buffer_head *bh) 79void fastcall unlock_buffer(struct buffer_head *bh)
80{ 80{
81 smp_mb__before_clear_bit();
81 clear_buffer_locked(bh); 82 clear_buffer_locked(bh);
82 smp_mb__after_clear_bit(); 83 smp_mb__after_clear_bit();
83 wake_up_bit(&bh->b_state, BH_Lock); 84 wake_up_bit(&bh->b_state, BH_Lock);
@@ -345,7 +346,7 @@ void invalidate_bdev(struct block_device *bdev, int destroy_dirty_buffers)
345 * We really want to use invalidate_inode_pages2() for 346 * We really want to use invalidate_inode_pages2() for
346 * that, but not until that's cleaned up. 347 * that, but not until that's cleaned up.
347 */ 348 */
348 invalidate_inode_pages(mapping); 349 invalidate_mapping_pages(mapping, 0, -1);
349} 350}
350 351
351/* 352/*
diff --git a/fs/coda/sysctl.c b/fs/coda/sysctl.c
index 1c82e9a7d7c8..db3b1a9c9a5b 100644
--- a/fs/coda/sysctl.c
+++ b/fs/coda/sysctl.c
@@ -15,6 +15,7 @@
15#include <linux/mm.h> 15#include <linux/mm.h>
16#include <linux/sysctl.h> 16#include <linux/sysctl.h>
17#include <linux/proc_fs.h> 17#include <linux/proc_fs.h>
18#include <linux/seq_file.h>
18#include <linux/slab.h> 19#include <linux/slab.h>
19#include <linux/stat.h> 20#include <linux/stat.h>
20#include <linux/ctype.h> 21#include <linux/ctype.h>
@@ -84,15 +85,11 @@ static int do_reset_coda_cache_inv_stats( ctl_table * table, int write,
84 return 0; 85 return 0;
85} 86}
86 87
87static int coda_vfs_stats_get_info( char * buffer, char ** start, 88static int proc_vfs_stats_show(struct seq_file *m, void *v)
88 off_t offset, int length)
89{ 89{
90 int len=0;
91 off_t begin;
92 struct coda_vfs_stats * ps = & coda_vfs_stat; 90 struct coda_vfs_stats * ps = & coda_vfs_stat;
93 91
94 /* this works as long as we are below 1024 characters! */ 92 seq_printf(m,
95 len += sprintf( buffer,
96 "Coda VFS statistics\n" 93 "Coda VFS statistics\n"
97 "===================\n\n" 94 "===================\n\n"
98 "File Operations:\n" 95 "File Operations:\n"
@@ -132,28 +129,14 @@ static int coda_vfs_stats_get_info( char * buffer, char ** start,
132 ps->rmdir, 129 ps->rmdir,
133 ps->rename, 130 ps->rename,
134 ps->permission); 131 ps->permission);
135 132 return 0;
136 begin = offset;
137 *start = buffer + begin;
138 len -= begin;
139
140 if ( len > length )
141 len = length;
142 if ( len < 0 )
143 len = 0;
144
145 return len;
146} 133}
147 134
148static int coda_cache_inv_stats_get_info( char * buffer, char ** start, 135static int proc_cache_inv_stats_show(struct seq_file *m, void *v)
149 off_t offset, int length)
150{ 136{
151 int len=0;
152 off_t begin;
153 struct coda_cache_inv_stats * ps = & coda_cache_inv_stat; 137 struct coda_cache_inv_stats * ps = & coda_cache_inv_stat;
154 138
155 /* this works as long as we are below 1024 characters! */ 139 seq_printf(m,
156 len += sprintf( buffer,
157 "Coda cache invalidation statistics\n" 140 "Coda cache invalidation statistics\n"
158 "==================================\n\n" 141 "==================================\n\n"
159 "flush\t\t%9d\n" 142 "flush\t\t%9d\n"
@@ -170,19 +153,35 @@ static int coda_cache_inv_stats_get_info( char * buffer, char ** start,
170 ps->zap_vnode, 153 ps->zap_vnode,
171 ps->purge_fid, 154 ps->purge_fid,
172 ps->replace ); 155 ps->replace );
173 156 return 0;
174 begin = offset; 157}
175 *start = buffer + begin;
176 len -= begin;
177 158
178 if ( len > length ) 159static int proc_vfs_stats_open(struct inode *inode, struct file *file)
179 len = length; 160{
180 if ( len < 0 ) 161 return single_open(file, proc_vfs_stats_show, NULL);
181 len = 0; 162}
182 163
183 return len; 164static int proc_cache_inv_stats_open(struct inode *inode, struct file *file)
165{
166 return single_open(file, proc_cache_inv_stats_show, NULL);
184} 167}
185 168
169static const struct file_operations proc_vfs_stats_fops = {
170 .owner = THIS_MODULE,
171 .open = proc_vfs_stats_open,
172 .read = seq_read,
173 .llseek = seq_lseek,
174 .release = single_release,
175};
176
177static const struct file_operations proc_cache_inv_stats_fops = {
178 .owner = THIS_MODULE,
179 .open = proc_cache_inv_stats_open,
180 .read = seq_read,
181 .llseek = seq_lseek,
182 .release = single_release,
183};
184
186static ctl_table coda_table[] = { 185static ctl_table coda_table[] = {
187 {CODA_TIMEOUT, "timeout", &coda_timeout, sizeof(int), 0644, NULL, &proc_dointvec}, 186 {CODA_TIMEOUT, "timeout", &coda_timeout, sizeof(int), 0644, NULL, &proc_dointvec},
188 {CODA_HARD, "hard", &coda_hard, sizeof(int), 0644, NULL, &proc_dointvec}, 187 {CODA_HARD, "hard", &coda_hard, sizeof(int), 0644, NULL, &proc_dointvec},
@@ -212,9 +211,6 @@ static struct proc_dir_entry* proc_fs_coda;
212 211
213#endif 212#endif
214 213
215#define coda_proc_create(name,get_info) \
216 create_proc_info_entry(name, 0, proc_fs_coda, get_info)
217
218void coda_sysctl_init(void) 214void coda_sysctl_init(void)
219{ 215{
220 reset_coda_vfs_stats(); 216 reset_coda_vfs_stats();
@@ -223,9 +219,15 @@ void coda_sysctl_init(void)
223#ifdef CONFIG_PROC_FS 219#ifdef CONFIG_PROC_FS
224 proc_fs_coda = proc_mkdir("coda", proc_root_fs); 220 proc_fs_coda = proc_mkdir("coda", proc_root_fs);
225 if (proc_fs_coda) { 221 if (proc_fs_coda) {
222 struct proc_dir_entry *pde;
223
226 proc_fs_coda->owner = THIS_MODULE; 224 proc_fs_coda->owner = THIS_MODULE;
227 coda_proc_create("vfs_stats", coda_vfs_stats_get_info); 225 pde = create_proc_entry("vfs_stats", 0, proc_fs_coda);
228 coda_proc_create("cache_inv_stats", coda_cache_inv_stats_get_info); 226 if (pde)
227 pde->proc_fops = &proc_vfs_stats_fops;
228 pde = create_proc_entry("cache_inv_stats", 0, proc_fs_coda);
229 if (pde)
230 pde->proc_fops = &proc_cache_inv_stats_fops;
229 } 231 }
230#endif 232#endif
231 233
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c
index 1814ba446809..9371ee209954 100644
--- a/fs/configfs/dir.c
+++ b/fs/configfs/dir.c
@@ -72,11 +72,10 @@ static struct configfs_dirent *configfs_new_dirent(struct configfs_dirent * pare
72{ 72{
73 struct configfs_dirent * sd; 73 struct configfs_dirent * sd;
74 74
75 sd = kmem_cache_alloc(configfs_dir_cachep, GFP_KERNEL); 75 sd = kmem_cache_zalloc(configfs_dir_cachep, GFP_KERNEL);
76 if (!sd) 76 if (!sd)
77 return NULL; 77 return NULL;
78 78
79 memset(sd, 0, sizeof(*sd));
80 atomic_set(&sd->s_count, 1); 79 atomic_set(&sd->s_count, 1);
81 INIT_LIST_HEAD(&sd->s_links); 80 INIT_LIST_HEAD(&sd->s_links);
82 INIT_LIST_HEAD(&sd->s_children); 81 INIT_LIST_HEAD(&sd->s_children);
diff --git a/fs/dlm/memory.c b/fs/dlm/memory.c
index 5352b03ff5aa..f858fef6e41c 100644
--- a/fs/dlm/memory.c
+++ b/fs/dlm/memory.c
@@ -76,9 +76,7 @@ struct dlm_lkb *allocate_lkb(struct dlm_ls *ls)
76{ 76{
77 struct dlm_lkb *lkb; 77 struct dlm_lkb *lkb;
78 78
79 lkb = kmem_cache_alloc(lkb_cache, GFP_KERNEL); 79 lkb = kmem_cache_zalloc(lkb_cache, GFP_KERNEL);
80 if (lkb)
81 memset(lkb, 0, sizeof(*lkb));
82 return lkb; 80 return lkb;
83} 81}
84 82
diff --git a/fs/dquot.c b/fs/dquot.c
index 0952cc474d9a..a561fb29e203 100644
--- a/fs/dquot.c
+++ b/fs/dquot.c
@@ -600,11 +600,10 @@ static struct dquot *get_empty_dquot(struct super_block *sb, int type)
600{ 600{
601 struct dquot *dquot; 601 struct dquot *dquot;
602 602
603 dquot = kmem_cache_alloc(dquot_cachep, GFP_NOFS); 603 dquot = kmem_cache_zalloc(dquot_cachep, GFP_NOFS);
604 if(!dquot) 604 if(!dquot)
605 return NODQUOT; 605 return NODQUOT;
606 606
607 memset((caddr_t)dquot, 0, sizeof(struct dquot));
608 mutex_init(&dquot->dq_lock); 607 mutex_init(&dquot->dq_lock);
609 INIT_LIST_HEAD(&dquot->dq_free); 608 INIT_LIST_HEAD(&dquot->dq_free);
610 INIT_LIST_HEAD(&dquot->dq_inuse); 609 INIT_LIST_HEAD(&dquot->dq_inuse);
diff --git a/fs/drop_caches.c b/fs/drop_caches.c
index 4e4762389bdc..03ea7696fe39 100644
--- a/fs/drop_caches.c
+++ b/fs/drop_caches.c
@@ -20,7 +20,7 @@ static void drop_pagecache_sb(struct super_block *sb)
20 list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { 20 list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
21 if (inode->i_state & (I_FREEING|I_WILL_FREE)) 21 if (inode->i_state & (I_FREEING|I_WILL_FREE))
22 continue; 22 continue;
23 invalidate_inode_pages(inode->i_mapping); 23 invalidate_mapping_pages(inode->i_mapping, 0, -1);
24 } 24 }
25 spin_unlock(&inode_lock); 25 spin_unlock(&inode_lock);
26} 26}
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index a86a55ccf874..75bbfae55081 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -1332,13 +1332,13 @@ int ecryptfs_write_headers(struct dentry *ecryptfs_dentry,
1332 goto out; 1332 goto out;
1333 } 1333 }
1334 /* Released in this function */ 1334 /* Released in this function */
1335 page_virt = kmem_cache_alloc(ecryptfs_header_cache_0, GFP_USER); 1335 page_virt = kmem_cache_zalloc(ecryptfs_header_cache_0, GFP_USER);
1336 if (!page_virt) { 1336 if (!page_virt) {
1337 ecryptfs_printk(KERN_ERR, "Out of memory\n"); 1337 ecryptfs_printk(KERN_ERR, "Out of memory\n");
1338 rc = -ENOMEM; 1338 rc = -ENOMEM;
1339 goto out; 1339 goto out;
1340 } 1340 }
1341 memset(page_virt, 0, PAGE_CACHE_SIZE); 1341
1342 rc = ecryptfs_write_headers_virt(page_virt, crypt_stat, 1342 rc = ecryptfs_write_headers_virt(page_virt, crypt_stat,
1343 ecryptfs_dentry); 1343 ecryptfs_dentry);
1344 if (unlikely(rc)) { 1344 if (unlikely(rc)) {
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
index c5a2e5298f15..779c3477d93c 100644
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -251,7 +251,7 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
251 int lower_flags; 251 int lower_flags;
252 252
253 /* Released in ecryptfs_release or end of function if failure */ 253 /* Released in ecryptfs_release or end of function if failure */
254 file_info = kmem_cache_alloc(ecryptfs_file_info_cache, GFP_KERNEL); 254 file_info = kmem_cache_zalloc(ecryptfs_file_info_cache, GFP_KERNEL);
255 ecryptfs_set_file_private(file, file_info); 255 ecryptfs_set_file_private(file, file_info);
256 if (!file_info) { 256 if (!file_info) {
257 ecryptfs_printk(KERN_ERR, 257 ecryptfs_printk(KERN_ERR,
@@ -259,7 +259,6 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
259 rc = -ENOMEM; 259 rc = -ENOMEM;
260 goto out; 260 goto out;
261 } 261 }
262 memset(file_info, 0, sizeof(*file_info));
263 lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry); 262 lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry);
264 crypt_stat = &ecryptfs_inode_to_private(inode)->crypt_stat; 263 crypt_stat = &ecryptfs_inode_to_private(inode)->crypt_stat;
265 mount_crypt_stat = &ecryptfs_superblock_to_private( 264 mount_crypt_stat = &ecryptfs_superblock_to_private(
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 11f5e5076aef..d4f02f3e18d7 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -361,8 +361,7 @@ static struct dentry *ecryptfs_lookup(struct inode *dir, struct dentry *dentry,
361 goto out; 361 goto out;
362 } 362 }
363 /* Released in this function */ 363 /* Released in this function */
364 page_virt = 364 page_virt = kmem_cache_zalloc(ecryptfs_header_cache_2,
365 (char *)kmem_cache_alloc(ecryptfs_header_cache_2,
366 GFP_USER); 365 GFP_USER);
367 if (!page_virt) { 366 if (!page_virt) {
368 rc = -ENOMEM; 367 rc = -ENOMEM;
@@ -370,7 +369,7 @@ static struct dentry *ecryptfs_lookup(struct inode *dir, struct dentry *dentry,
370 "Cannot ecryptfs_kmalloc a page\n"); 369 "Cannot ecryptfs_kmalloc a page\n");
371 goto out_dput; 370 goto out_dput;
372 } 371 }
373 memset(page_virt, 0, PAGE_CACHE_SIZE); 372
374 rc = ecryptfs_read_header_region(page_virt, lower_dentry, nd->mnt); 373 rc = ecryptfs_read_header_region(page_virt, lower_dentry, nd->mnt);
375 crypt_stat = &ecryptfs_inode_to_private(dentry->d_inode)->crypt_stat; 374 crypt_stat = &ecryptfs_inode_to_private(dentry->d_inode)->crypt_stat;
376 if (!ECRYPTFS_CHECK_FLAG(crypt_stat->flags, ECRYPTFS_POLICY_APPLIED)) 375 if (!ECRYPTFS_CHECK_FLAG(crypt_stat->flags, ECRYPTFS_POLICY_APPLIED))
diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c
index 745c0f1bfbbd..80bccd5ff8e6 100644
--- a/fs/ecryptfs/keystore.c
+++ b/fs/ecryptfs/keystore.c
@@ -207,14 +207,12 @@ parse_tag_3_packet(struct ecryptfs_crypt_stat *crypt_stat,
207 /* Released: wipe_auth_tok_list called in ecryptfs_parse_packet_set or 207 /* Released: wipe_auth_tok_list called in ecryptfs_parse_packet_set or
208 * at end of function upon failure */ 208 * at end of function upon failure */
209 auth_tok_list_item = 209 auth_tok_list_item =
210 kmem_cache_alloc(ecryptfs_auth_tok_list_item_cache, GFP_KERNEL); 210 kmem_cache_zalloc(ecryptfs_auth_tok_list_item_cache, GFP_KERNEL);
211 if (!auth_tok_list_item) { 211 if (!auth_tok_list_item) {
212 ecryptfs_printk(KERN_ERR, "Unable to allocate memory\n"); 212 ecryptfs_printk(KERN_ERR, "Unable to allocate memory\n");
213 rc = -ENOMEM; 213 rc = -ENOMEM;
214 goto out; 214 goto out;
215 } 215 }
216 memset(auth_tok_list_item, 0,
217 sizeof(struct ecryptfs_auth_tok_list_item));
218 (*new_auth_tok) = &auth_tok_list_item->auth_tok; 216 (*new_auth_tok) = &auth_tok_list_item->auth_tok;
219 217
220 /* check for body size - one to two bytes */ 218 /* check for body size - one to two bytes */
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index d0541ae8faba..fe41ab1566ee 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -378,15 +378,13 @@ ecryptfs_fill_super(struct super_block *sb, void *raw_data, int silent)
378 378
379 /* Released in ecryptfs_put_super() */ 379 /* Released in ecryptfs_put_super() */
380 ecryptfs_set_superblock_private(sb, 380 ecryptfs_set_superblock_private(sb,
381 kmem_cache_alloc(ecryptfs_sb_info_cache, 381 kmem_cache_zalloc(ecryptfs_sb_info_cache,
382 GFP_KERNEL)); 382 GFP_KERNEL));
383 if (!ecryptfs_superblock_to_private(sb)) { 383 if (!ecryptfs_superblock_to_private(sb)) {
384 ecryptfs_printk(KERN_WARNING, "Out of memory\n"); 384 ecryptfs_printk(KERN_WARNING, "Out of memory\n");
385 rc = -ENOMEM; 385 rc = -ENOMEM;
386 goto out; 386 goto out;
387 } 387 }
388 memset(ecryptfs_superblock_to_private(sb), 0,
389 sizeof(struct ecryptfs_sb_info));
390 sb->s_op = &ecryptfs_sops; 388 sb->s_op = &ecryptfs_sops;
391 /* Released through deactivate_super(sb) from get_sb_nodev */ 389 /* Released through deactivate_super(sb) from get_sb_nodev */
392 sb->s_root = d_alloc(NULL, &(const struct qstr) { 390 sb->s_root = d_alloc(NULL, &(const struct qstr) {
@@ -402,7 +400,7 @@ ecryptfs_fill_super(struct super_block *sb, void *raw_data, int silent)
402 /* Released in d_release when dput(sb->s_root) is called */ 400 /* Released in d_release when dput(sb->s_root) is called */
403 /* through deactivate_super(sb) from get_sb_nodev() */ 401 /* through deactivate_super(sb) from get_sb_nodev() */
404 ecryptfs_set_dentry_private(sb->s_root, 402 ecryptfs_set_dentry_private(sb->s_root,
405 kmem_cache_alloc(ecryptfs_dentry_info_cache, 403 kmem_cache_zalloc(ecryptfs_dentry_info_cache,
406 GFP_KERNEL)); 404 GFP_KERNEL));
407 if (!ecryptfs_dentry_to_private(sb->s_root)) { 405 if (!ecryptfs_dentry_to_private(sb->s_root)) {
408 ecryptfs_printk(KERN_ERR, 406 ecryptfs_printk(KERN_ERR,
@@ -410,8 +408,6 @@ ecryptfs_fill_super(struct super_block *sb, void *raw_data, int silent)
410 rc = -ENOMEM; 408 rc = -ENOMEM;
411 goto out; 409 goto out;
412 } 410 }
413 memset(ecryptfs_dentry_to_private(sb->s_root), 0,
414 sizeof(struct ecryptfs_dentry_info));
415 rc = 0; 411 rc = 0;
416out: 412out:
417 /* Should be able to rely on deactivate_super called from 413 /* Should be able to rely on deactivate_super called from
diff --git a/fs/exec.c b/fs/exec.c
index 11fe93f7363c..7e36c6f6f538 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -405,12 +405,10 @@ int setup_arg_pages(struct linux_binprm *bprm,
405 bprm->loader += stack_base; 405 bprm->loader += stack_base;
406 bprm->exec += stack_base; 406 bprm->exec += stack_base;
407 407
408 mpnt = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL); 408 mpnt = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
409 if (!mpnt) 409 if (!mpnt)
410 return -ENOMEM; 410 return -ENOMEM;
411 411
412 memset(mpnt, 0, sizeof(*mpnt));
413
414 down_write(&mm->mmap_sem); 412 down_write(&mm->mmap_sem);
415 { 413 {
416 mpnt->vm_mm = mm; 414 mpnt->vm_mm = mm;
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index 0b02ba9642d2..e89bfc8cf957 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -368,6 +368,14 @@ struct ext2_dir_entry_2 * ext2_find_entry (struct inode * dir,
368 } 368 }
369 if (++n >= npages) 369 if (++n >= npages)
370 n = 0; 370 n = 0;
371 /* next page is past the blocks we've got */
372 if (unlikely(n > (dir->i_blocks >> (PAGE_CACHE_SHIFT - 9)))) {
373 ext2_error(dir->i_sb, __FUNCTION__,
374 "dir %lu size %lld exceeds block count %llu",
375 dir->i_ino, dir->i_size,
376 (unsigned long long)dir->i_blocks);
377 goto out;
378 }
371 } while (n != start); 379 } while (n != start);
372out: 380out:
373 return NULL; 381 return NULL;
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 6347c2dbdd81..daaa243eee9b 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -708,10 +708,14 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
708 set_opt(sbi->s_mount_opt, GRPID); 708 set_opt(sbi->s_mount_opt, GRPID);
709 if (def_mount_opts & EXT2_DEFM_UID16) 709 if (def_mount_opts & EXT2_DEFM_UID16)
710 set_opt(sbi->s_mount_opt, NO_UID32); 710 set_opt(sbi->s_mount_opt, NO_UID32);
711#ifdef CONFIG_EXT2_FS_XATTR
711 if (def_mount_opts & EXT2_DEFM_XATTR_USER) 712 if (def_mount_opts & EXT2_DEFM_XATTR_USER)
712 set_opt(sbi->s_mount_opt, XATTR_USER); 713 set_opt(sbi->s_mount_opt, XATTR_USER);
714#endif
715#ifdef CONFIG_EXT2_FS_POSIX_ACL
713 if (def_mount_opts & EXT2_DEFM_ACL) 716 if (def_mount_opts & EXT2_DEFM_ACL)
714 set_opt(sbi->s_mount_opt, POSIX_ACL); 717 set_opt(sbi->s_mount_opt, POSIX_ACL);
718#endif
715 719
716 if (le16_to_cpu(sbi->s_es->s_errors) == EXT2_ERRORS_PANIC) 720 if (le16_to_cpu(sbi->s_es->s_errors) == EXT2_ERRORS_PANIC)
717 set_opt(sbi->s_mount_opt, ERRORS_PANIC); 721 set_opt(sbi->s_mount_opt, ERRORS_PANIC);
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
index beaf25f5112f..8a824f4ce5c6 100644
--- a/fs/ext3/inode.c
+++ b/fs/ext3/inode.c
@@ -947,7 +947,7 @@ out:
947static int ext3_get_block(struct inode *inode, sector_t iblock, 947static int ext3_get_block(struct inode *inode, sector_t iblock,
948 struct buffer_head *bh_result, int create) 948 struct buffer_head *bh_result, int create)
949{ 949{
950 handle_t *handle = journal_current_handle(); 950 handle_t *handle = ext3_journal_current_handle();
951 int ret = 0; 951 int ret = 0;
952 unsigned max_blocks = bh_result->b_size >> inode->i_blkbits; 952 unsigned max_blocks = bh_result->b_size >> inode->i_blkbits;
953 953
@@ -1717,7 +1717,7 @@ static ssize_t ext3_direct_IO(int rw, struct kiocb *iocb,
1717 /* 1717 /*
1718 * Reacquire the handle: ext3_get_block() can restart the transaction 1718 * Reacquire the handle: ext3_get_block() can restart the transaction
1719 */ 1719 */
1720 handle = journal_current_handle(); 1720 handle = ext3_journal_current_handle();
1721 1721
1722out_stop: 1722out_stop:
1723 if (handle) { 1723 if (handle) {
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index 4df39c4315e1..a8e89328e66d 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -1618,21 +1618,6 @@ static int ext3_delete_entry (handle_t *handle,
1618 return -ENOENT; 1618 return -ENOENT;
1619} 1619}
1620 1620
1621/*
1622 * ext3_mark_inode_dirty is somewhat expensive, so unlike ext2 we
1623 * do not perform it in these functions. We perform it at the call site,
1624 * if it is needed.
1625 */
1626static inline void ext3_inc_count(handle_t *handle, struct inode *inode)
1627{
1628 inc_nlink(inode);
1629}
1630
1631static inline void ext3_dec_count(handle_t *handle, struct inode *inode)
1632{
1633 drop_nlink(inode);
1634}
1635
1636static int ext3_add_nondir(handle_t *handle, 1621static int ext3_add_nondir(handle_t *handle,
1637 struct dentry *dentry, struct inode *inode) 1622 struct dentry *dentry, struct inode *inode)
1638{ 1623{
@@ -1642,7 +1627,7 @@ static int ext3_add_nondir(handle_t *handle,
1642 d_instantiate(dentry, inode); 1627 d_instantiate(dentry, inode);
1643 return 0; 1628 return 0;
1644 } 1629 }
1645 ext3_dec_count(handle, inode); 1630 drop_nlink(inode);
1646 iput(inode); 1631 iput(inode);
1647 return err; 1632 return err;
1648} 1633}
@@ -2163,7 +2148,7 @@ retry:
2163 err = __page_symlink(inode, symname, l, 2148 err = __page_symlink(inode, symname, l,
2164 mapping_gfp_mask(inode->i_mapping) & ~__GFP_FS); 2149 mapping_gfp_mask(inode->i_mapping) & ~__GFP_FS);
2165 if (err) { 2150 if (err) {
2166 ext3_dec_count(handle, inode); 2151 drop_nlink(inode);
2167 ext3_mark_inode_dirty(handle, inode); 2152 ext3_mark_inode_dirty(handle, inode);
2168 iput (inode); 2153 iput (inode);
2169 goto out_stop; 2154 goto out_stop;
@@ -2191,6 +2176,12 @@ static int ext3_link (struct dentry * old_dentry,
2191 2176
2192 if (inode->i_nlink >= EXT3_LINK_MAX) 2177 if (inode->i_nlink >= EXT3_LINK_MAX)
2193 return -EMLINK; 2178 return -EMLINK;
2179 /*
2180 * Return -ENOENT if we've raced with unlink and i_nlink is 0. Doing
2181 * otherwise has the potential to corrupt the orphan inode list.
2182 */
2183 if (inode->i_nlink == 0)
2184 return -ENOENT;
2194 2185
2195retry: 2186retry:
2196 handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + 2187 handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) +
@@ -2202,7 +2193,7 @@ retry:
2202 handle->h_sync = 1; 2193 handle->h_sync = 1;
2203 2194
2204 inode->i_ctime = CURRENT_TIME_SEC; 2195 inode->i_ctime = CURRENT_TIME_SEC;
2205 ext3_inc_count(handle, inode); 2196 inc_nlink(inode);
2206 atomic_inc(&inode->i_count); 2197 atomic_inc(&inode->i_count);
2207 2198
2208 err = ext3_add_nondir(handle, dentry, inode); 2199 err = ext3_add_nondir(handle, dentry, inode);
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index b34886734a44..a0623a84a4b2 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -1459,10 +1459,14 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
1459 set_opt(sbi->s_mount_opt, GRPID); 1459 set_opt(sbi->s_mount_opt, GRPID);
1460 if (def_mount_opts & EXT3_DEFM_UID16) 1460 if (def_mount_opts & EXT3_DEFM_UID16)
1461 set_opt(sbi->s_mount_opt, NO_UID32); 1461 set_opt(sbi->s_mount_opt, NO_UID32);
1462#ifdef CONFIG_EXT3_FS_XATTR
1462 if (def_mount_opts & EXT3_DEFM_XATTR_USER) 1463 if (def_mount_opts & EXT3_DEFM_XATTR_USER)
1463 set_opt(sbi->s_mount_opt, XATTR_USER); 1464 set_opt(sbi->s_mount_opt, XATTR_USER);
1465#endif
1466#ifdef CONFIG_EXT3_FS_POSIX_ACL
1464 if (def_mount_opts & EXT3_DEFM_ACL) 1467 if (def_mount_opts & EXT3_DEFM_ACL)
1465 set_opt(sbi->s_mount_opt, POSIX_ACL); 1468 set_opt(sbi->s_mount_opt, POSIX_ACL);
1469#endif
1466 if ((def_mount_opts & EXT3_DEFM_JMODE) == EXT3_DEFM_JMODE_DATA) 1470 if ((def_mount_opts & EXT3_DEFM_JMODE) == EXT3_DEFM_JMODE_DATA)
1467 sbi->s_mount_opt |= EXT3_MOUNT_JOURNAL_DATA; 1471 sbi->s_mount_opt |= EXT3_MOUNT_JOURNAL_DATA;
1468 else if ((def_mount_opts & EXT3_DEFM_JMODE) == EXT3_DEFM_JMODE_ORDERED) 1472 else if ((def_mount_opts & EXT3_DEFM_JMODE) == EXT3_DEFM_JMODE_ORDERED)
@@ -2344,6 +2348,22 @@ static int ext3_remount (struct super_block * sb, int * flags, char * data)
2344 err = -EROFS; 2348 err = -EROFS;
2345 goto restore_opts; 2349 goto restore_opts;
2346 } 2350 }
2351
2352 /*
2353 * If we have an unprocessed orphan list hanging
2354 * around from a previously readonly bdev mount,
2355 * require a full umount/remount for now.
2356 */
2357 if (es->s_last_orphan) {
2358 printk(KERN_WARNING "EXT3-fs: %s: couldn't "
2359 "remount RDWR because of unprocessed "
2360 "orphan inode list. Please "
2361 "umount/remount instead.\n",
2362 sb->s_id);
2363 err = -EINVAL;
2364 goto restore_opts;
2365 }
2366
2347 /* 2367 /*
2348 * Mounting a RDONLY partition read-write, so reread 2368 * Mounting a RDONLY partition read-write, so reread
2349 * and store the current valid flag. (It may have 2369 * and store the current valid flag. (It may have
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index a127cc03c9fa..fbff4b9e122a 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -946,7 +946,7 @@ out:
946static int ext4_get_block(struct inode *inode, sector_t iblock, 946static int ext4_get_block(struct inode *inode, sector_t iblock,
947 struct buffer_head *bh_result, int create) 947 struct buffer_head *bh_result, int create)
948{ 948{
949 handle_t *handle = journal_current_handle(); 949 handle_t *handle = ext4_journal_current_handle();
950 int ret = 0; 950 int ret = 0;
951 unsigned max_blocks = bh_result->b_size >> inode->i_blkbits; 951 unsigned max_blocks = bh_result->b_size >> inode->i_blkbits;
952 952
@@ -1716,7 +1716,7 @@ static ssize_t ext4_direct_IO(int rw, struct kiocb *iocb,
1716 /* 1716 /*
1717 * Reacquire the handle: ext4_get_block() can restart the transaction 1717 * Reacquire the handle: ext4_get_block() can restart the transaction
1718 */ 1718 */
1719 handle = journal_current_handle(); 1719 handle = ext4_journal_current_handle();
1720 1720
1721out_stop: 1721out_stop:
1722 if (handle) { 1722 if (handle) {
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index e5a74a5ac261..34b3448b40f9 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -1616,21 +1616,6 @@ static int ext4_delete_entry (handle_t *handle,
1616 return -ENOENT; 1616 return -ENOENT;
1617} 1617}
1618 1618
1619/*
1620 * ext4_mark_inode_dirty is somewhat expensive, so unlike ext2 we
1621 * do not perform it in these functions. We perform it at the call site,
1622 * if it is needed.
1623 */
1624static inline void ext4_inc_count(handle_t *handle, struct inode *inode)
1625{
1626 inc_nlink(inode);
1627}
1628
1629static inline void ext4_dec_count(handle_t *handle, struct inode *inode)
1630{
1631 drop_nlink(inode);
1632}
1633
1634static int ext4_add_nondir(handle_t *handle, 1619static int ext4_add_nondir(handle_t *handle,
1635 struct dentry *dentry, struct inode *inode) 1620 struct dentry *dentry, struct inode *inode)
1636{ 1621{
@@ -1640,7 +1625,7 @@ static int ext4_add_nondir(handle_t *handle,
1640 d_instantiate(dentry, inode); 1625 d_instantiate(dentry, inode);
1641 return 0; 1626 return 0;
1642 } 1627 }
1643 ext4_dec_count(handle, inode); 1628 drop_nlink(inode);
1644 iput(inode); 1629 iput(inode);
1645 return err; 1630 return err;
1646} 1631}
@@ -2161,7 +2146,7 @@ retry:
2161 err = __page_symlink(inode, symname, l, 2146 err = __page_symlink(inode, symname, l,
2162 mapping_gfp_mask(inode->i_mapping) & ~__GFP_FS); 2147 mapping_gfp_mask(inode->i_mapping) & ~__GFP_FS);
2163 if (err) { 2148 if (err) {
2164 ext4_dec_count(handle, inode); 2149 drop_nlink(inode);
2165 ext4_mark_inode_dirty(handle, inode); 2150 ext4_mark_inode_dirty(handle, inode);
2166 iput (inode); 2151 iput (inode);
2167 goto out_stop; 2152 goto out_stop;
@@ -2189,6 +2174,12 @@ static int ext4_link (struct dentry * old_dentry,
2189 2174
2190 if (inode->i_nlink >= EXT4_LINK_MAX) 2175 if (inode->i_nlink >= EXT4_LINK_MAX)
2191 return -EMLINK; 2176 return -EMLINK;
2177 /*
2178 * Return -ENOENT if we've raced with unlink and i_nlink is 0. Doing
2179 * otherwise has the potential to corrupt the orphan inode list.
2180 */
2181 if (inode->i_nlink == 0)
2182 return -ENOENT;
2192 2183
2193retry: 2184retry:
2194 handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) + 2185 handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
@@ -2200,7 +2191,7 @@ retry:
2200 handle->h_sync = 1; 2191 handle->h_sync = 1;
2201 2192
2202 inode->i_ctime = CURRENT_TIME_SEC; 2193 inode->i_ctime = CURRENT_TIME_SEC;
2203 ext4_inc_count(handle, inode); 2194 inc_nlink(inode);
2204 atomic_inc(&inode->i_count); 2195 atomic_inc(&inode->i_count);
2205 2196
2206 err = ext4_add_nondir(handle, dentry, inode); 2197 err = ext4_add_nondir(handle, dentry, inode);
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 486a641ca71b..c63a18b574dd 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1518,10 +1518,14 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
1518 set_opt(sbi->s_mount_opt, GRPID); 1518 set_opt(sbi->s_mount_opt, GRPID);
1519 if (def_mount_opts & EXT4_DEFM_UID16) 1519 if (def_mount_opts & EXT4_DEFM_UID16)
1520 set_opt(sbi->s_mount_opt, NO_UID32); 1520 set_opt(sbi->s_mount_opt, NO_UID32);
1521#ifdef CONFIG_EXT4DEV_FS_XATTR
1521 if (def_mount_opts & EXT4_DEFM_XATTR_USER) 1522 if (def_mount_opts & EXT4_DEFM_XATTR_USER)
1522 set_opt(sbi->s_mount_opt, XATTR_USER); 1523 set_opt(sbi->s_mount_opt, XATTR_USER);
1524#endif
1525#ifdef CONFIG_EXT4DEV_FS_POSIX_ACL
1523 if (def_mount_opts & EXT4_DEFM_ACL) 1526 if (def_mount_opts & EXT4_DEFM_ACL)
1524 set_opt(sbi->s_mount_opt, POSIX_ACL); 1527 set_opt(sbi->s_mount_opt, POSIX_ACL);
1528#endif
1525 if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_DATA) 1529 if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_DATA)
1526 sbi->s_mount_opt |= EXT4_MOUNT_JOURNAL_DATA; 1530 sbi->s_mount_opt |= EXT4_MOUNT_JOURNAL_DATA;
1527 else if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_ORDERED) 1531 else if ((def_mount_opts & EXT4_DEFM_JMODE) == EXT4_DEFM_JMODE_ORDERED)
@@ -2419,6 +2423,22 @@ static int ext4_remount (struct super_block * sb, int * flags, char * data)
2419 err = -EROFS; 2423 err = -EROFS;
2420 goto restore_opts; 2424 goto restore_opts;
2421 } 2425 }
2426
2427 /*
2428 * If we have an unprocessed orphan list hanging
2429 * around from a previously readonly bdev mount,
2430 * require a full umount/remount for now.
2431 */
2432 if (es->s_last_orphan) {
2433 printk(KERN_WARNING "EXT4-fs: %s: couldn't "
2434 "remount RDWR because of unprocessed "
2435 "orphan inode list. Please "
2436 "umount/remount instead.\n",
2437 sb->s_id);
2438 err = -EINVAL;
2439 goto restore_opts;
2440 }
2441
2422 /* 2442 /*
2423 * Mounting a RDONLY partition read-write, so reread 2443 * Mounting a RDONLY partition read-write, so reread
2424 * and store the current valid flag. (It may have 2444 * and store the current valid flag. (It may have
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index f63efe1337ec..2fd06927e851 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -69,7 +69,7 @@ void fuse_finish_open(struct inode *inode, struct file *file,
69 if (outarg->open_flags & FOPEN_DIRECT_IO) 69 if (outarg->open_flags & FOPEN_DIRECT_IO)
70 file->f_op = &fuse_direct_io_file_operations; 70 file->f_op = &fuse_direct_io_file_operations;
71 if (!(outarg->open_flags & FOPEN_KEEP_CACHE)) 71 if (!(outarg->open_flags & FOPEN_KEEP_CACHE))
72 invalidate_inode_pages(inode->i_mapping); 72 invalidate_mapping_pages(inode->i_mapping, 0, -1);
73 ff->fh = outarg->fh; 73 ff->fh = outarg->fh;
74 file->private_data = ff; 74 file->private_data = ff;
75} 75}
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 12450d2b320e..220255110d76 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -112,7 +112,7 @@ void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr)
112{ 112{
113 struct fuse_conn *fc = get_fuse_conn(inode); 113 struct fuse_conn *fc = get_fuse_conn(inode);
114 if (S_ISREG(inode->i_mode) && i_size_read(inode) != attr->size) 114 if (S_ISREG(inode->i_mode) && i_size_read(inode) != attr->size)
115 invalidate_inode_pages(inode->i_mapping); 115 invalidate_mapping_pages(inode->i_mapping, 0, -1);
116 116
117 inode->i_ino = attr->ino; 117 inode->i_ino = attr->ino;
118 inode->i_mode = (inode->i_mode & S_IFMT) + (attr->mode & 07777); 118 inode->i_mode = (inode->i_mode & S_IFMT) + (attr->mode & 07777);
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index 0e34d9918973..e62d4f620c58 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -282,8 +282,7 @@ void gfs2_attach_bufdata(struct gfs2_glock *gl, struct buffer_head *bh,
282 return; 282 return;
283 } 283 }
284 284
285 bd = kmem_cache_alloc(gfs2_bufdata_cachep, GFP_NOFS | __GFP_NOFAIL), 285 bd = kmem_cache_zalloc(gfs2_bufdata_cachep, GFP_NOFS | __GFP_NOFAIL),
286 memset(bd, 0, sizeof(struct gfs2_bufdata));
287 bd->bd_bh = bh; 286 bd->bd_bh = bh;
288 bd->bd_gl = gl; 287 bd->bd_gl = gl;
289 288
diff --git a/fs/hfs/hfs.h b/fs/hfs/hfs.h
index 88099ab1a180..1445e3a56ed4 100644
--- a/fs/hfs/hfs.h
+++ b/fs/hfs/hfs.h
@@ -83,8 +83,6 @@
83 83
84/*======== HFS structures as they appear on the disk ========*/ 84/*======== HFS structures as they appear on the disk ========*/
85 85
86#define __packed __attribute__ ((packed))
87
88/* Pascal-style string of up to 31 characters */ 86/* Pascal-style string of up to 31 characters */
89struct hfs_name { 87struct hfs_name {
90 u8 len; 88 u8 len;
diff --git a/fs/hfsplus/hfsplus_raw.h b/fs/hfsplus/hfsplus_raw.h
index 49205531a500..fe99fe8db61a 100644
--- a/fs/hfsplus/hfsplus_raw.h
+++ b/fs/hfsplus/hfsplus_raw.h
@@ -15,8 +15,6 @@
15 15
16#include <linux/types.h> 16#include <linux/types.h>
17 17
18#define __packed __attribute__ ((packed))
19
20/* Some constants */ 18/* Some constants */
21#define HFSPLUS_SECTOR_SIZE 512 19#define HFSPLUS_SECTOR_SIZE 512
22#define HFSPLUS_SECTOR_SHIFT 9 20#define HFSPLUS_SECTOR_SHIFT 9
diff --git a/fs/inode.c b/fs/inode.c
index bf21dc6d0dbd..e6d93070f140 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -414,7 +414,8 @@ static void prune_icache(int nr_to_scan)
414 __iget(inode); 414 __iget(inode);
415 spin_unlock(&inode_lock); 415 spin_unlock(&inode_lock);
416 if (remove_inode_buffers(inode)) 416 if (remove_inode_buffers(inode))
417 reap += invalidate_inode_pages(&inode->i_data); 417 reap += invalidate_mapping_pages(&inode->i_data,
418 0, -1);
418 iput(inode); 419 iput(inode);
419 spin_lock(&inode_lock); 420 spin_lock(&inode_lock);
420 421
@@ -709,7 +710,7 @@ EXPORT_SYMBOL(iunique);
709struct inode *igrab(struct inode *inode) 710struct inode *igrab(struct inode *inode)
710{ 711{
711 spin_lock(&inode_lock); 712 spin_lock(&inode_lock);
712 if (!(inode->i_state & (I_FREEING|I_WILL_FREE))) 713 if (!(inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE)))
713 __iget(inode); 714 __iget(inode);
714 else 715 else
715 /* 716 /*
@@ -1160,11 +1161,9 @@ void touch_atime(struct vfsmount *mnt, struct dentry *dentry)
1160 struct inode *inode = dentry->d_inode; 1161 struct inode *inode = dentry->d_inode;
1161 struct timespec now; 1162 struct timespec now;
1162 1163
1163 if (IS_RDONLY(inode))
1164 return;
1165 if (inode->i_flags & S_NOATIME) 1164 if (inode->i_flags & S_NOATIME)
1166 return; 1165 return;
1167 if (inode->i_sb->s_flags & MS_NOATIME) 1166 if (IS_NOATIME(inode))
1168 return; 1167 return;
1169 if ((inode->i_sb->s_flags & MS_NODIRATIME) && S_ISDIR(inode->i_mode)) 1168 if ((inode->i_sb->s_flags & MS_NODIRATIME) && S_ISDIR(inode->i_mode))
1170 return; 1169 return;
diff --git a/fs/jffs/inode-v23.c b/fs/jffs/inode-v23.c
index 43baa1afa021..6ee206688502 100644
--- a/fs/jffs/inode-v23.c
+++ b/fs/jffs/inode-v23.c
@@ -296,7 +296,7 @@ jffs_setattr(struct dentry *dentry, struct iattr *iattr)
296 inode->i_blocks = (inode->i_size + 511) >> 9; 296 inode->i_blocks = (inode->i_size + 511) >> 9;
297 297
298 if (len) { 298 if (len) {
299 invalidate_inode_pages(inode->i_mapping); 299 invalidate_mapping_pages(inode->i_mapping, 0, -1);
300 } 300 }
301 inode->i_ctime = CURRENT_TIME_SEC; 301 inode->i_ctime = CURRENT_TIME_SEC;
302 inode->i_mtime = inode->i_ctime; 302 inode->i_mtime = inode->i_ctime;
@@ -1518,7 +1518,7 @@ jffs_file_write(struct file *filp, const char *buf, size_t count,
1518 } 1518 }
1519 inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC; 1519 inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC;
1520 mark_inode_dirty(inode); 1520 mark_inode_dirty(inode);
1521 invalidate_inode_pages(inode->i_mapping); 1521 invalidate_mapping_pages(inode->i_mapping, 0, -1);
1522 1522
1523 out_isem: 1523 out_isem:
1524 return err; 1524 return err;
diff --git a/fs/namespace.c b/fs/namespace.c
index 5ef336c1103c..fd999cab7b57 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -53,9 +53,8 @@ static inline unsigned long hash(struct vfsmount *mnt, struct dentry *dentry)
53 53
54struct vfsmount *alloc_vfsmnt(const char *name) 54struct vfsmount *alloc_vfsmnt(const char *name)
55{ 55{
56 struct vfsmount *mnt = kmem_cache_alloc(mnt_cache, GFP_KERNEL); 56 struct vfsmount *mnt = kmem_cache_zalloc(mnt_cache, GFP_KERNEL);
57 if (mnt) { 57 if (mnt) {
58 memset(mnt, 0, sizeof(struct vfsmount));
59 atomic_set(&mnt->mnt_count, 1); 58 atomic_set(&mnt->mnt_count, 1);
60 INIT_LIST_HEAD(&mnt->mnt_hash); 59 INIT_LIST_HEAD(&mnt->mnt_hash);
61 INIT_LIST_HEAD(&mnt->mnt_child); 60 INIT_LIST_HEAD(&mnt->mnt_child);
diff --git a/fs/partitions/msdos.c b/fs/partitions/msdos.c
index d964d1f90dec..4ccec4cd1367 100644
--- a/fs/partitions/msdos.c
+++ b/fs/partitions/msdos.c
@@ -63,15 +63,25 @@ msdos_magic_present(unsigned char *p)
63#define AIX_LABEL_MAGIC4 0xC1 63#define AIX_LABEL_MAGIC4 0xC1
64static int aix_magic_present(unsigned char *p, struct block_device *bdev) 64static int aix_magic_present(unsigned char *p, struct block_device *bdev)
65{ 65{
66 struct partition *pt = (struct partition *) (p + 0x1be);
66 Sector sect; 67 Sector sect;
67 unsigned char *d; 68 unsigned char *d;
68 int ret = 0; 69 int slot, ret = 0;
69 70
70 if (p[0] != AIX_LABEL_MAGIC1 && 71 if (!(p[0] == AIX_LABEL_MAGIC1 &&
71 p[1] != AIX_LABEL_MAGIC2 && 72 p[1] == AIX_LABEL_MAGIC2 &&
72 p[2] != AIX_LABEL_MAGIC3 && 73 p[2] == AIX_LABEL_MAGIC3 &&
73 p[3] != AIX_LABEL_MAGIC4) 74 p[3] == AIX_LABEL_MAGIC4))
74 return 0; 75 return 0;
76 /* Assume the partition table is valid if Linux partitions exists */
77 for (slot = 1; slot <= 4; slot++, pt++) {
78 if (pt->sys_ind == LINUX_SWAP_PARTITION ||
79 pt->sys_ind == LINUX_RAID_PARTITION ||
80 pt->sys_ind == LINUX_DATA_PARTITION ||
81 pt->sys_ind == LINUX_LVM_PARTITION ||
82 is_extended_partition(pt))
83 return 0;
84 }
75 d = read_dev_sector(bdev, 7, &sect); 85 d = read_dev_sector(bdev, 7, &sect);
76 if (d) { 86 if (d) {
77 if (d[0] == '_' && d[1] == 'L' && d[2] == 'V' && d[3] == 'M') 87 if (d[0] == '_' && d[1] == 'L' && d[2] == 'V' && d[3] == 'M')
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 1a979ea3b379..7fb37d6f2864 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1810,17 +1810,21 @@ static int proc_base_fill_cache(struct file *filp, void *dirent, filldir_t filld
1810static int proc_pid_io_accounting(struct task_struct *task, char *buffer) 1810static int proc_pid_io_accounting(struct task_struct *task, char *buffer)
1811{ 1811{
1812 return sprintf(buffer, 1812 return sprintf(buffer,
1813#ifdef CONFIG_TASK_XACCT
1813 "rchar: %llu\n" 1814 "rchar: %llu\n"
1814 "wchar: %llu\n" 1815 "wchar: %llu\n"
1815 "syscr: %llu\n" 1816 "syscr: %llu\n"
1816 "syscw: %llu\n" 1817 "syscw: %llu\n"
1818#endif
1817 "read_bytes: %llu\n" 1819 "read_bytes: %llu\n"
1818 "write_bytes: %llu\n" 1820 "write_bytes: %llu\n"
1819 "cancelled_write_bytes: %llu\n", 1821 "cancelled_write_bytes: %llu\n",
1822#ifdef CONFIG_TASK_XACCT
1820 (unsigned long long)task->rchar, 1823 (unsigned long long)task->rchar,
1821 (unsigned long long)task->wchar, 1824 (unsigned long long)task->wchar,
1822 (unsigned long long)task->syscr, 1825 (unsigned long long)task->syscr,
1823 (unsigned long long)task->syscw, 1826 (unsigned long long)task->syscw,
1827#endif
1824 (unsigned long long)task->ioac.read_bytes, 1828 (unsigned long long)task->ioac.read_bytes,
1825 (unsigned long long)task->ioac.write_bytes, 1829 (unsigned long long)task->ioac.write_bytes,
1826 (unsigned long long)task->ioac.cancelled_write_bytes); 1830 (unsigned long long)task->ioac.cancelled_write_bytes);
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c
index b37ce33f67ea..5e2d4359c292 100644
--- a/fs/proc/proc_misc.c
+++ b/fs/proc/proc_misc.c
@@ -121,16 +121,11 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
121{ 121{
122 struct sysinfo i; 122 struct sysinfo i;
123 int len; 123 int len;
124 unsigned long inactive;
125 unsigned long active;
126 unsigned long free;
127 unsigned long committed; 124 unsigned long committed;
128 unsigned long allowed; 125 unsigned long allowed;
129 struct vmalloc_info vmi; 126 struct vmalloc_info vmi;
130 long cached; 127 long cached;
131 128
132 get_zone_counts(&active, &inactive, &free);
133
134/* 129/*
135 * display in kilobytes. 130 * display in kilobytes.
136 */ 131 */
@@ -187,8 +182,8 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
187 K(i.bufferram), 182 K(i.bufferram),
188 K(cached), 183 K(cached),
189 K(total_swapcache_pages), 184 K(total_swapcache_pages),
190 K(active), 185 K(global_page_state(NR_ACTIVE)),
191 K(inactive), 186 K(global_page_state(NR_INACTIVE)),
192#ifdef CONFIG_HIGHMEM 187#ifdef CONFIG_HIGHMEM
193 K(i.totalhigh), 188 K(i.totalhigh),
194 K(i.freehigh), 189 K(i.freehigh),
@@ -672,7 +667,6 @@ void create_seq_entry(char *name, mode_t mode, const struct file_operations *f)
672 667
673void __init proc_misc_init(void) 668void __init proc_misc_init(void)
674{ 669{
675 struct proc_dir_entry *entry;
676 static struct { 670 static struct {
677 char *name; 671 char *name;
678 int (*read_proc)(char*,char**,off_t,int,int*,void*); 672 int (*read_proc)(char*,char**,off_t,int,int*,void*);
@@ -700,9 +694,12 @@ void __init proc_misc_init(void)
700 694
701 /* And now for trickier ones */ 695 /* And now for trickier ones */
702#ifdef CONFIG_PRINTK 696#ifdef CONFIG_PRINTK
703 entry = create_proc_entry("kmsg", S_IRUSR, &proc_root); 697 {
704 if (entry) 698 struct proc_dir_entry *entry;
705 entry->proc_fops = &proc_kmsg_operations; 699 entry = create_proc_entry("kmsg", S_IRUSR, &proc_root);
700 if (entry)
701 entry->proc_fops = &proc_kmsg_operations;
702 }
706#endif 703#endif
707 create_seq_entry("devices", 0, &proc_devinfo_operations); 704 create_seq_entry("devices", 0, &proc_devinfo_operations);
708 create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations); 705 create_seq_entry("cpuinfo", 0, &proc_cpuinfo_operations);
@@ -743,8 +740,11 @@ void __init proc_misc_init(void)
743 proc_vmcore->proc_fops = &proc_vmcore_operations; 740 proc_vmcore->proc_fops = &proc_vmcore_operations;
744#endif 741#endif
745#ifdef CONFIG_MAGIC_SYSRQ 742#ifdef CONFIG_MAGIC_SYSRQ
746 entry = create_proc_entry("sysrq-trigger", S_IWUSR, NULL); 743 {
747 if (entry) 744 struct proc_dir_entry *entry;
748 entry->proc_fops = &proc_sysrq_trigger_operations; 745 entry = create_proc_entry("sysrq-trigger", S_IWUSR, NULL);
746 if (entry)
747 entry->proc_fops = &proc_sysrq_trigger_operations;
748 }
749#endif 749#endif
750} 750}
diff --git a/fs/ramfs/file-mmu.c b/fs/ramfs/file-mmu.c
index 54ebbc84207f..b935a3dd4b65 100644
--- a/fs/ramfs/file-mmu.c
+++ b/fs/ramfs/file-mmu.c
@@ -31,7 +31,7 @@ const struct address_space_operations ramfs_aops = {
31 .readpage = simple_readpage, 31 .readpage = simple_readpage,
32 .prepare_write = simple_prepare_write, 32 .prepare_write = simple_prepare_write,
33 .commit_write = simple_commit_write, 33 .commit_write = simple_commit_write,
34 .set_page_dirty = __set_page_dirty_nobuffers, 34 .set_page_dirty = __set_page_dirty_no_writeback,
35}; 35};
36 36
37const struct file_operations ramfs_file_operations = { 37const struct file_operations ramfs_file_operations = {
diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c
index e9d6c4733282..d05e09ac9a99 100644
--- a/fs/ramfs/file-nommu.c
+++ b/fs/ramfs/file-nommu.c
@@ -32,7 +32,7 @@ const struct address_space_operations ramfs_aops = {
32 .readpage = simple_readpage, 32 .readpage = simple_readpage,
33 .prepare_write = simple_prepare_write, 33 .prepare_write = simple_prepare_write,
34 .commit_write = simple_commit_write, 34 .commit_write = simple_commit_write,
35 .set_page_dirty = __set_page_dirty_nobuffers, 35 .set_page_dirty = __set_page_dirty_no_writeback,
36}; 36};
37 37
38const struct file_operations ramfs_file_operations = { 38const struct file_operations ramfs_file_operations = {
diff --git a/fs/read_write.c b/fs/read_write.c
index 707ac21700d3..bcb0ef2aae3d 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -274,9 +274,9 @@ ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)
274 ret = do_sync_read(file, buf, count, pos); 274 ret = do_sync_read(file, buf, count, pos);
275 if (ret > 0) { 275 if (ret > 0) {
276 fsnotify_access(file->f_path.dentry); 276 fsnotify_access(file->f_path.dentry);
277 current->rchar += ret; 277 add_rchar(current, ret);
278 } 278 }
279 current->syscr++; 279 inc_syscr(current);
280 } 280 }
281 } 281 }
282 282
@@ -332,9 +332,9 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_
332 ret = do_sync_write(file, buf, count, pos); 332 ret = do_sync_write(file, buf, count, pos);
333 if (ret > 0) { 333 if (ret > 0) {
334 fsnotify_modify(file->f_path.dentry); 334 fsnotify_modify(file->f_path.dentry);
335 current->wchar += ret; 335 add_wchar(current, ret);
336 } 336 }
337 current->syscw++; 337 inc_syscw(current);
338 } 338 }
339 } 339 }
340 340
@@ -675,8 +675,8 @@ sys_readv(unsigned long fd, const struct iovec __user *vec, unsigned long vlen)
675 } 675 }
676 676
677 if (ret > 0) 677 if (ret > 0)
678 current->rchar += ret; 678 add_rchar(current, ret);
679 current->syscr++; 679 inc_syscr(current);
680 return ret; 680 return ret;
681} 681}
682 682
@@ -696,8 +696,8 @@ sys_writev(unsigned long fd, const struct iovec __user *vec, unsigned long vlen)
696 } 696 }
697 697
698 if (ret > 0) 698 if (ret > 0)
699 current->wchar += ret; 699 add_wchar(current, ret);
700 current->syscw++; 700 inc_syscw(current);
701 return ret; 701 return ret;
702} 702}
703 703
@@ -779,12 +779,12 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
779 retval = in_file->f_op->sendfile(in_file, ppos, count, file_send_actor, out_file); 779 retval = in_file->f_op->sendfile(in_file, ppos, count, file_send_actor, out_file);
780 780
781 if (retval > 0) { 781 if (retval > 0) {
782 current->rchar += retval; 782 add_rchar(current, retval);
783 current->wchar += retval; 783 add_wchar(current, retval);
784 } 784 }
785 current->syscr++;
786 current->syscw++;
787 785
786 inc_syscr(current);
787 inc_syscw(current);
788 if (*ppos > max) 788 if (*ppos > max)
789 retval = -EOVERFLOW; 789 retval = -EOVERFLOW;
790 790
diff --git a/fs/smbfs/request.c b/fs/smbfs/request.c
index a4bcae8a9aff..42261dbdf60f 100644
--- a/fs/smbfs/request.c
+++ b/fs/smbfs/request.c
@@ -61,7 +61,7 @@ static struct smb_request *smb_do_alloc_request(struct smb_sb_info *server,
61 struct smb_request *req; 61 struct smb_request *req;
62 unsigned char *buf = NULL; 62 unsigned char *buf = NULL;
63 63
64 req = kmem_cache_alloc(req_cachep, GFP_KERNEL); 64 req = kmem_cache_zalloc(req_cachep, GFP_KERNEL);
65 VERBOSE("allocating request: %p\n", req); 65 VERBOSE("allocating request: %p\n", req);
66 if (!req) 66 if (!req)
67 goto out; 67 goto out;
@@ -74,7 +74,6 @@ static struct smb_request *smb_do_alloc_request(struct smb_sb_info *server,
74 } 74 }
75 } 75 }
76 76
77 memset(req, 0, sizeof(struct smb_request));
78 req->rq_buffer = buf; 77 req->rq_buffer = buf;
79 req->rq_bufsize = bufsize; 78 req->rq_bufsize = bufsize;
80 req->rq_server = server; 79 req->rq_server = server;
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 9dcdf556c99c..9e95e7abaf69 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -37,11 +37,10 @@ static struct sysfs_dirent * __sysfs_new_dirent(void * element)
37{ 37{
38 struct sysfs_dirent * sd; 38 struct sysfs_dirent * sd;
39 39
40 sd = kmem_cache_alloc(sysfs_dir_cachep, GFP_KERNEL); 40 sd = kmem_cache_zalloc(sysfs_dir_cachep, GFP_KERNEL);
41 if (!sd) 41 if (!sd)
42 return NULL; 42 return NULL;
43 43
44 memset(sd, 0, sizeof(*sd));
45 atomic_set(&sd->s_count, 1); 44 atomic_set(&sd->s_count, 1);
46 atomic_set(&sd->s_event, 1); 45 atomic_set(&sd->s_event, 1);
47 INIT_LIST_HEAD(&sd->s_children); 46 INIT_LIST_HEAD(&sd->s_children);