aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/9p/vfs_inode.c2
-rw-r--r--fs/dquot.c6
-rw-r--r--fs/exec.c12
-rw-r--r--fs/ext3/resize.c1
-rw-r--r--fs/fuse/dir.c37
-rw-r--r--fs/hfsplus/hfsplus_fs.h1
-rw-r--r--fs/hfsplus/hfsplus_raw.h12
-rw-r--r--fs/hfsplus/options.c6
-rw-r--r--fs/hfsplus/super.c20
-rw-r--r--fs/jffs2/fs.c2
-rw-r--r--fs/jffs2/super.c2
-rw-r--r--fs/proc/task_mmu.c7
-rw-r--r--fs/reiserfs/inode.c2
-rw-r--r--fs/reiserfs/journal.c9
14 files changed, 84 insertions, 35 deletions
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index be7288184fa9..0ea965c3bb7d 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -427,6 +427,8 @@ v9fs_create(struct inode *dir,
427 427
428 v9fs_mistat2inode(fcall->params.rstat.stat, file_inode, sb); 428 v9fs_mistat2inode(fcall->params.rstat.stat, file_inode, sb);
429 kfree(fcall); 429 kfree(fcall);
430 fcall = NULL;
431 file_dentry->d_op = &v9fs_dentry_operations;
430 d_instantiate(file_dentry, file_inode); 432 d_instantiate(file_dentry, file_inode);
431 433
432 if (perm & V9FS_DMDIR) { 434 if (perm & V9FS_DMDIR) {
diff --git a/fs/dquot.c b/fs/dquot.c
index 05b60283c9c2..2a62b3dc20ec 100644
--- a/fs/dquot.c
+++ b/fs/dquot.c
@@ -1513,10 +1513,16 @@ int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
1513 if (IS_ERR(dentry)) 1513 if (IS_ERR(dentry))
1514 return PTR_ERR(dentry); 1514 return PTR_ERR(dentry);
1515 1515
1516 if (!dentry->d_inode) {
1517 error = -ENOENT;
1518 goto out;
1519 }
1520
1516 error = security_quota_on(dentry); 1521 error = security_quota_on(dentry);
1517 if (!error) 1522 if (!error)
1518 error = vfs_quota_on_inode(dentry->d_inode, type, format_id); 1523 error = vfs_quota_on_inode(dentry->d_inode, type, format_id);
1519 1524
1525out:
1520 dput(dentry); 1526 dput(dentry);
1521 return error; 1527 return error;
1522} 1528}
diff --git a/fs/exec.c b/fs/exec.c
index 1f8a9fd2c9ed..22533cce0611 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -306,9 +306,6 @@ void install_arg_page(struct vm_area_struct *vma,
306 struct page *page, unsigned long address) 306 struct page *page, unsigned long address)
307{ 307{
308 struct mm_struct *mm = vma->vm_mm; 308 struct mm_struct *mm = vma->vm_mm;
309 pgd_t * pgd;
310 pud_t * pud;
311 pmd_t * pmd;
312 pte_t * pte; 309 pte_t * pte;
313 spinlock_t *ptl; 310 spinlock_t *ptl;
314 311
@@ -316,14 +313,7 @@ void install_arg_page(struct vm_area_struct *vma,
316 goto out; 313 goto out;
317 314
318 flush_dcache_page(page); 315 flush_dcache_page(page);
319 pgd = pgd_offset(mm, address); 316 pte = get_locked_pte(mm, address, &ptl);
320 pud = pud_alloc(mm, pgd, address);
321 if (!pud)
322 goto out;
323 pmd = pmd_alloc(mm, pud, address);
324 if (!pmd)
325 goto out;
326 pte = pte_alloc_map_lock(mm, pmd, address, &ptl);
327 if (!pte) 317 if (!pte)
328 goto out; 318 goto out;
329 if (!pte_none(*pte)) { 319 if (!pte_none(*pte)) {
diff --git a/fs/ext3/resize.c b/fs/ext3/resize.c
index 1be78b4b4de9..6104ad310507 100644
--- a/fs/ext3/resize.c
+++ b/fs/ext3/resize.c
@@ -767,6 +767,7 @@ int ext3_group_add(struct super_block *sb, struct ext3_new_group_data *input)
767 if (input->group != EXT3_SB(sb)->s_groups_count) { 767 if (input->group != EXT3_SB(sb)->s_groups_count) {
768 ext3_warning(sb, __FUNCTION__, 768 ext3_warning(sb, __FUNCTION__,
769 "multiple resizers run on filesystem!\n"); 769 "multiple resizers run on filesystem!\n");
770 err = -EBUSY;
770 goto exit_journal; 771 goto exit_journal;
771 } 772 }
772 773
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index c045cc70c749..51f5da652771 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -74,6 +74,24 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd)
74 return 1; 74 return 1;
75} 75}
76 76
77static int dir_alias(struct inode *inode)
78{
79 if (S_ISDIR(inode->i_mode)) {
80 /* Don't allow creating an alias to a directory */
81 struct dentry *alias = d_find_alias(inode);
82 if (alias) {
83 dput(alias);
84 return 1;
85 }
86 }
87 return 0;
88}
89
90static inline int invalid_nodeid(u64 nodeid)
91{
92 return !nodeid || nodeid == FUSE_ROOT_ID;
93}
94
77static struct dentry_operations fuse_dentry_operations = { 95static struct dentry_operations fuse_dentry_operations = {
78 .d_revalidate = fuse_dentry_revalidate, 96 .d_revalidate = fuse_dentry_revalidate,
79}; 97};
@@ -97,7 +115,7 @@ static int fuse_lookup_iget(struct inode *dir, struct dentry *entry,
97 fuse_lookup_init(req, dir, entry, &outarg); 115 fuse_lookup_init(req, dir, entry, &outarg);
98 request_send(fc, req); 116 request_send(fc, req);
99 err = req->out.h.error; 117 err = req->out.h.error;
100 if (!err && (!outarg.nodeid || outarg.nodeid == FUSE_ROOT_ID)) 118 if (!err && invalid_nodeid(outarg.nodeid))
101 err = -EIO; 119 err = -EIO;
102 if (!err) { 120 if (!err) {
103 inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation, 121 inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation,
@@ -193,7 +211,7 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode,
193 } 211 }
194 212
195 err = -EIO; 213 err = -EIO;
196 if (!S_ISREG(outentry.attr.mode)) 214 if (!S_ISREG(outentry.attr.mode) || invalid_nodeid(outentry.nodeid))
197 goto out_free_ff; 215 goto out_free_ff;
198 216
199 inode = fuse_iget(dir->i_sb, outentry.nodeid, outentry.generation, 217 inode = fuse_iget(dir->i_sb, outentry.nodeid, outentry.generation,
@@ -250,7 +268,7 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req,
250 fuse_put_request(fc, req); 268 fuse_put_request(fc, req);
251 return err; 269 return err;
252 } 270 }
253 if (!outarg.nodeid || outarg.nodeid == FUSE_ROOT_ID) { 271 if (invalid_nodeid(outarg.nodeid)) {
254 fuse_put_request(fc, req); 272 fuse_put_request(fc, req);
255 return -EIO; 273 return -EIO;
256 } 274 }
@@ -263,7 +281,7 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req,
263 fuse_put_request(fc, req); 281 fuse_put_request(fc, req);
264 282
265 /* Don't allow userspace to do really stupid things... */ 283 /* Don't allow userspace to do really stupid things... */
266 if ((inode->i_mode ^ mode) & S_IFMT) { 284 if (((inode->i_mode ^ mode) & S_IFMT) || dir_alias(inode)) {
267 iput(inode); 285 iput(inode);
268 return -EIO; 286 return -EIO;
269 } 287 }
@@ -874,14 +892,9 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
874 err = fuse_lookup_iget(dir, entry, &inode); 892 err = fuse_lookup_iget(dir, entry, &inode);
875 if (err) 893 if (err)
876 return ERR_PTR(err); 894 return ERR_PTR(err);
877 if (inode && S_ISDIR(inode->i_mode)) { 895 if (inode && dir_alias(inode)) {
878 /* Don't allow creating an alias to a directory */ 896 iput(inode);
879 struct dentry *alias = d_find_alias(inode); 897 return ERR_PTR(-EIO);
880 if (alias) {
881 dput(alias);
882 iput(inode);
883 return ERR_PTR(-EIO);
884 }
885 } 898 }
886 d_add(entry, inode); 899 d_add(entry, inode);
887 return NULL; 900 return NULL;
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h
index c60e5635498d..df16fcbff3fb 100644
--- a/fs/hfsplus/hfsplus_fs.h
+++ b/fs/hfsplus/hfsplus_fs.h
@@ -151,6 +151,7 @@ struct hfsplus_sb_info {
151 151
152#define HFSPLUS_SB_WRITEBACKUP 0x0001 152#define HFSPLUS_SB_WRITEBACKUP 0x0001
153#define HFSPLUS_SB_NODECOMPOSE 0x0002 153#define HFSPLUS_SB_NODECOMPOSE 0x0002
154#define HFSPLUS_SB_FORCE 0x0004
154 155
155 156
156struct hfsplus_inode_info { 157struct hfsplus_inode_info {
diff --git a/fs/hfsplus/hfsplus_raw.h b/fs/hfsplus/hfsplus_raw.h
index 5bad37cfdb29..b4fbed633219 100644
--- a/fs/hfsplus/hfsplus_raw.h
+++ b/fs/hfsplus/hfsplus_raw.h
@@ -123,11 +123,13 @@ struct hfsplus_vh {
123} __packed; 123} __packed;
124 124
125/* HFS+ volume attributes */ 125/* HFS+ volume attributes */
126#define HFSPLUS_VOL_UNMNT (1 << 8) 126#define HFSPLUS_VOL_UNMNT (1 << 8)
127#define HFSPLUS_VOL_SPARE_BLK (1 << 9) 127#define HFSPLUS_VOL_SPARE_BLK (1 << 9)
128#define HFSPLUS_VOL_NOCACHE (1 << 10) 128#define HFSPLUS_VOL_NOCACHE (1 << 10)
129#define HFSPLUS_VOL_INCNSTNT (1 << 11) 129#define HFSPLUS_VOL_INCNSTNT (1 << 11)
130#define HFSPLUS_VOL_SOFTLOCK (1 << 15) 130#define HFSPLUS_VOL_NODEID_REUSED (1 << 12)
131#define HFSPLUS_VOL_JOURNALED (1 << 13)
132#define HFSPLUS_VOL_SOFTLOCK (1 << 15)
131 133
132/* HFS+ BTree node descriptor */ 134/* HFS+ BTree node descriptor */
133struct hfs_bnode_desc { 135struct hfs_bnode_desc {
diff --git a/fs/hfsplus/options.c b/fs/hfsplus/options.c
index cca0818aa4ca..935dafba0078 100644
--- a/fs/hfsplus/options.c
+++ b/fs/hfsplus/options.c
@@ -22,7 +22,7 @@ enum {
22 opt_umask, opt_uid, opt_gid, 22 opt_umask, opt_uid, opt_gid,
23 opt_part, opt_session, opt_nls, 23 opt_part, opt_session, opt_nls,
24 opt_nodecompose, opt_decompose, 24 opt_nodecompose, opt_decompose,
25 opt_err 25 opt_force, opt_err
26}; 26};
27 27
28static match_table_t tokens = { 28static match_table_t tokens = {
@@ -36,6 +36,7 @@ static match_table_t tokens = {
36 { opt_nls, "nls=%s" }, 36 { opt_nls, "nls=%s" },
37 { opt_decompose, "decompose" }, 37 { opt_decompose, "decompose" },
38 { opt_nodecompose, "nodecompose" }, 38 { opt_nodecompose, "nodecompose" },
39 { opt_force, "force" },
39 { opt_err, NULL } 40 { opt_err, NULL }
40}; 41};
41 42
@@ -145,6 +146,9 @@ int hfsplus_parse_options(char *input, struct hfsplus_sb_info *sbi)
145 case opt_nodecompose: 146 case opt_nodecompose:
146 sbi->flags |= HFSPLUS_SB_NODECOMPOSE; 147 sbi->flags |= HFSPLUS_SB_NODECOMPOSE;
147 break; 148 break;
149 case opt_force:
150 sbi->flags |= HFSPLUS_SB_FORCE;
151 break;
148 default: 152 default:
149 return 0; 153 return 0;
150 } 154 }
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index 0ce1c455ae55..8093351bd7c3 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -251,16 +251,28 @@ static int hfsplus_remount(struct super_block *sb, int *flags, char *data)
251 return 0; 251 return 0;
252 if (!(*flags & MS_RDONLY)) { 252 if (!(*flags & MS_RDONLY)) {
253 struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr; 253 struct hfsplus_vh *vhdr = HFSPLUS_SB(sb).s_vhdr;
254 struct hfsplus_sb_info sbi;
255
256 memset(&sbi, 0, sizeof(struct hfsplus_sb_info));
257 sbi.nls = HFSPLUS_SB(sb).nls;
258 if (!hfsplus_parse_options(data, &sbi))
259 return -EINVAL;
254 260
255 if (!(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) { 261 if (!(vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_UNMNT))) {
256 printk("HFS+-fs warning: Filesystem was not cleanly unmounted, " 262 printk("HFS+-fs warning: Filesystem was not cleanly unmounted, "
257 "running fsck.hfsplus is recommended. leaving read-only.\n"); 263 "running fsck.hfsplus is recommended. leaving read-only.\n");
258 sb->s_flags |= MS_RDONLY; 264 sb->s_flags |= MS_RDONLY;
259 *flags |= MS_RDONLY; 265 *flags |= MS_RDONLY;
266 } else if (sbi.flags & HFSPLUS_SB_FORCE) {
267 /* nothing */
260 } else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_SOFTLOCK)) { 268 } else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_SOFTLOCK)) {
261 printk("HFS+-fs: Filesystem is marked locked, leaving read-only.\n"); 269 printk("HFS+-fs: Filesystem is marked locked, leaving read-only.\n");
262 sb->s_flags |= MS_RDONLY; 270 sb->s_flags |= MS_RDONLY;
263 *flags |= MS_RDONLY; 271 *flags |= MS_RDONLY;
272 } else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_JOURNALED)) {
273 printk("HFS+-fs: Filesystem is marked journaled, leaving read-only.\n");
274 sb->s_flags |= MS_RDONLY;
275 *flags |= MS_RDONLY;
264 } 276 }
265 } 277 }
266 return 0; 278 return 0;
@@ -352,11 +364,19 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent)
352 printk("HFS+-fs warning: Filesystem was not cleanly unmounted, " 364 printk("HFS+-fs warning: Filesystem was not cleanly unmounted, "
353 "running fsck.hfsplus is recommended. mounting read-only.\n"); 365 "running fsck.hfsplus is recommended. mounting read-only.\n");
354 sb->s_flags |= MS_RDONLY; 366 sb->s_flags |= MS_RDONLY;
367 } else if (sbi->flags & HFSPLUS_SB_FORCE) {
368 /* nothing */
355 } else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_SOFTLOCK)) { 369 } else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_SOFTLOCK)) {
356 if (!silent) 370 if (!silent)
357 printk("HFS+-fs: Filesystem is marked locked, mounting read-only.\n"); 371 printk("HFS+-fs: Filesystem is marked locked, mounting read-only.\n");
358 sb->s_flags |= MS_RDONLY; 372 sb->s_flags |= MS_RDONLY;
373 } else if (vhdr->attributes & cpu_to_be32(HFSPLUS_VOL_JOURNALED)) {
374 if (!silent)
375 printk("HFS+-fs: write access to a jounaled filesystem is not supported, "
376 "use the force option at your own risk, mounting read-only.\n");
377 sb->s_flags |= MS_RDONLY;
359 } 378 }
379 sbi->flags &= ~HFSPLUS_SB_FORCE;
360 380
361 /* Load metadata objects (B*Trees) */ 381 /* Load metadata objects (B*Trees) */
362 HFSPLUS_SB(sb).ext_tree = hfs_btree_open(sb, HFSPLUS_EXT_CNID); 382 HFSPLUS_SB(sb).ext_tree = hfs_btree_open(sb, HFSPLUS_EXT_CNID);
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c
index 543420665c5b..d0fcc5f3497e 100644
--- a/fs/jffs2/fs.c
+++ b/fs/jffs2/fs.c
@@ -234,6 +234,7 @@ void jffs2_read_inode (struct inode *inode)
234 c = JFFS2_SB_INFO(inode->i_sb); 234 c = JFFS2_SB_INFO(inode->i_sb);
235 235
236 jffs2_init_inode_info(f); 236 jffs2_init_inode_info(f);
237 down(&f->sem);
237 238
238 ret = jffs2_do_read_inode(c, f, inode->i_ino, &latest_node); 239 ret = jffs2_do_read_inode(c, f, inode->i_ino, &latest_node);
239 240
@@ -400,6 +401,7 @@ struct inode *jffs2_new_inode (struct inode *dir_i, int mode, struct jffs2_raw_i
400 401
401 f = JFFS2_INODE_INFO(inode); 402 f = JFFS2_INODE_INFO(inode);
402 jffs2_init_inode_info(f); 403 jffs2_init_inode_info(f);
404 down(&f->sem);
403 405
404 memset(ri, 0, sizeof(*ri)); 406 memset(ri, 0, sizeof(*ri));
405 /* Set OS-specific defaults for new inodes */ 407 /* Set OS-specific defaults for new inodes */
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c
index 9e0b5458d9c0..93883817cbd0 100644
--- a/fs/jffs2/super.c
+++ b/fs/jffs2/super.c
@@ -51,7 +51,7 @@ static void jffs2_i_init_once(void * foo, kmem_cache_t * cachep, unsigned long f
51 51
52 if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == 52 if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
53 SLAB_CTOR_CONSTRUCTOR) { 53 SLAB_CTOR_CONSTRUCTOR) {
54 init_MUTEX_LOCKED(&ei->sem); 54 init_MUTEX(&ei->sem);
55 inode_init_once(&ei->vfs_inode); 55 inode_init_once(&ei->vfs_inode);
56 } 56 }
57} 57}
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 9ab97cef0daa..50bd5a8f0446 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -402,12 +402,11 @@ struct numa_maps {
402/* 402/*
403 * Calculate numa node maps for a vma 403 * Calculate numa node maps for a vma
404 */ 404 */
405static struct numa_maps *get_numa_maps(const struct vm_area_struct *vma) 405static struct numa_maps *get_numa_maps(struct vm_area_struct *vma)
406{ 406{
407 int i;
407 struct page *page; 408 struct page *page;
408 unsigned long vaddr; 409 unsigned long vaddr;
409 struct mm_struct *mm = vma->vm_mm;
410 int i;
411 struct numa_maps *md = kmalloc(sizeof(struct numa_maps), GFP_KERNEL); 410 struct numa_maps *md = kmalloc(sizeof(struct numa_maps), GFP_KERNEL);
412 411
413 if (!md) 412 if (!md)
@@ -420,7 +419,7 @@ static struct numa_maps *get_numa_maps(const struct vm_area_struct *vma)
420 md->node[i] =0; 419 md->node[i] =0;
421 420
422 for (vaddr = vma->vm_start; vaddr < vma->vm_end; vaddr += PAGE_SIZE) { 421 for (vaddr = vma->vm_start; vaddr < vma->vm_end; vaddr += PAGE_SIZE) {
423 page = follow_page(mm, vaddr, 0); 422 page = follow_page(vma, vaddr, 0);
424 if (page) { 423 if (page) {
425 int count = page_mapcount(page); 424 int count = page_mapcount(page);
426 425
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 5f82352b97e1..0a044ad98885 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -2194,7 +2194,7 @@ static int map_block_for_writepage(struct inode *inode,
2194 INITIALIZE_PATH(path); 2194 INITIALIZE_PATH(path);
2195 int pos_in_item; 2195 int pos_in_item;
2196 int jbegin_count = JOURNAL_PER_BALANCE_CNT; 2196 int jbegin_count = JOURNAL_PER_BALANCE_CNT;
2197 loff_t byte_offset = (block << inode->i_sb->s_blocksize_bits) + 1; 2197 loff_t byte_offset = ((loff_t)block << inode->i_sb->s_blocksize_bits)+1;
2198 int retval; 2198 int retval;
2199 int use_get_block = 0; 2199 int use_get_block = 0;
2200 int bytes_copied = 0; 2200 int bytes_copied = 0;
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index 4b15761434bc..68b7b78638ff 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -2757,6 +2757,15 @@ int journal_init(struct super_block *p_s_sb, const char *j_dev_name,
2757 journal->j_cnode_used = 0; 2757 journal->j_cnode_used = 0;
2758 journal->j_must_wait = 0; 2758 journal->j_must_wait = 0;
2759 2759
2760 if (journal->j_cnode_free == 0) {
2761 reiserfs_warning(p_s_sb, "journal-2004: Journal cnode memory "
2762 "allocation failed (%ld bytes). Journal is "
2763 "too large for available memory. Usually "
2764 "this is due to a journal that is too large.",
2765 sizeof (struct reiserfs_journal_cnode) * num_cnodes);
2766 goto free_and_return;
2767 }
2768
2760 init_journal_hash(p_s_sb); 2769 init_journal_hash(p_s_sb);
2761 jl = journal->j_current_jl; 2770 jl = journal->j_current_jl;
2762 jl->j_list_bitmap = get_list_bitmap(p_s_sb, jl); 2771 jl->j_list_bitmap = get_list_bitmap(p_s_sb, jl);