diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/9p/vfs_super.c | 3 | ||||
-rw-r--r-- | fs/affs/affs.h | 2 | ||||
-rw-r--r-- | fs/affs/namei.c | 7 | ||||
-rw-r--r-- | fs/affs/super.c | 31 | ||||
-rw-r--r-- | fs/affs/symlink.c | 7 | ||||
-rw-r--r-- | fs/bfs/inode.c | 43 | ||||
-rw-r--r-- | fs/binfmt_aout.c | 1 | ||||
-rw-r--r-- | fs/binfmt_elf.c | 27 | ||||
-rw-r--r-- | fs/binfmt_elf_fdpic.c | 3 | ||||
-rw-r--r-- | fs/binfmt_flat.c | 1 | ||||
-rw-r--r-- | fs/binfmt_som.c | 1 | ||||
-rw-r--r-- | fs/btrfs/acl.c | 1 | ||||
-rw-r--r-- | fs/btrfs/ctree.h | 1 | ||||
-rw-r--r-- | fs/btrfs/disk-io.c | 6 | ||||
-rw-r--r-- | fs/btrfs/extent_map.c | 14 | ||||
-rw-r--r-- | fs/btrfs/inode.c | 22 | ||||
-rw-r--r-- | fs/btrfs/super.c | 9 | ||||
-rw-r--r-- | fs/btrfs/volumes.c | 13 | ||||
-rw-r--r-- | fs/debugfs/inode.c | 11 | ||||
-rw-r--r-- | fs/eventfd.c | 89 | ||||
-rw-r--r-- | fs/exec.c | 26 | ||||
-rw-r--r-- | fs/ext4/ext4.h | 9 | ||||
-rw-r--r-- | fs/ext4/extents.c | 21 | ||||
-rw-r--r-- | fs/ext4/inode.c | 82 | ||||
-rw-r--r-- | fs/fcntl.c | 6 | ||||
-rw-r--r-- | fs/reiserfs/journal.c | 2 | ||||
-rw-r--r-- | fs/romfs/super.c | 1 |
27 files changed, 276 insertions, 163 deletions
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index 14a86448572c..69357c0d9899 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c | |||
@@ -188,7 +188,8 @@ static void v9fs_kill_super(struct super_block *s) | |||
188 | 188 | ||
189 | P9_DPRINTK(P9_DEBUG_VFS, " %p\n", s); | 189 | P9_DPRINTK(P9_DEBUG_VFS, " %p\n", s); |
190 | 190 | ||
191 | v9fs_dentry_release(s->s_root); /* clunk root */ | 191 | if (s->s_root) |
192 | v9fs_dentry_release(s->s_root); /* clunk root */ | ||
192 | 193 | ||
193 | kill_anon_super(s); | 194 | kill_anon_super(s); |
194 | 195 | ||
diff --git a/fs/affs/affs.h b/fs/affs/affs.h index e511dc621a2e..0e40caaba456 100644 --- a/fs/affs/affs.h +++ b/fs/affs/affs.h | |||
@@ -106,8 +106,8 @@ struct affs_sb_info { | |||
106 | u32 s_last_bmap; | 106 | u32 s_last_bmap; |
107 | struct buffer_head *s_bmap_bh; | 107 | struct buffer_head *s_bmap_bh; |
108 | char *s_prefix; /* Prefix for volumes and assigns. */ | 108 | char *s_prefix; /* Prefix for volumes and assigns. */ |
109 | int s_prefix_len; /* Length of prefix. */ | ||
110 | char s_volume[32]; /* Volume prefix for absolute symlinks. */ | 109 | char s_volume[32]; /* Volume prefix for absolute symlinks. */ |
110 | spinlock_t symlink_lock; /* protects the previous two */ | ||
111 | }; | 111 | }; |
112 | 112 | ||
113 | #define SF_INTL 0x0001 /* International filesystem. */ | 113 | #define SF_INTL 0x0001 /* International filesystem. */ |
diff --git a/fs/affs/namei.c b/fs/affs/namei.c index 960d336ec694..d70bbbac6b7b 100644 --- a/fs/affs/namei.c +++ b/fs/affs/namei.c | |||
@@ -341,10 +341,13 @@ affs_symlink(struct inode *dir, struct dentry *dentry, const char *symname) | |||
341 | p = (char *)AFFS_HEAD(bh)->table; | 341 | p = (char *)AFFS_HEAD(bh)->table; |
342 | lc = '/'; | 342 | lc = '/'; |
343 | if (*symname == '/') { | 343 | if (*symname == '/') { |
344 | struct affs_sb_info *sbi = AFFS_SB(sb); | ||
344 | while (*symname == '/') | 345 | while (*symname == '/') |
345 | symname++; | 346 | symname++; |
346 | while (AFFS_SB(sb)->s_volume[i]) /* Cannot overflow */ | 347 | spin_lock(&sbi->symlink_lock); |
347 | *p++ = AFFS_SB(sb)->s_volume[i++]; | 348 | while (sbi->s_volume[i]) /* Cannot overflow */ |
349 | *p++ = sbi->s_volume[i++]; | ||
350 | spin_unlock(&sbi->symlink_lock); | ||
348 | } | 351 | } |
349 | while (i < maxlen && (c = *symname++)) { | 352 | while (i < maxlen && (c = *symname++)) { |
350 | if (c == '.' && lc == '/' && *symname == '.' && symname[1] == '/') { | 353 | if (c == '.' && lc == '/' && *symname == '.' && symname[1] == '/') { |
diff --git a/fs/affs/super.c b/fs/affs/super.c index 104fdcb3a7fc..d41e9673cd97 100644 --- a/fs/affs/super.c +++ b/fs/affs/super.c | |||
@@ -203,7 +203,7 @@ parse_options(char *options, uid_t *uid, gid_t *gid, int *mode, int *reserved, s | |||
203 | switch (token) { | 203 | switch (token) { |
204 | case Opt_bs: | 204 | case Opt_bs: |
205 | if (match_int(&args[0], &n)) | 205 | if (match_int(&args[0], &n)) |
206 | return -EINVAL; | 206 | return 0; |
207 | if (n != 512 && n != 1024 && n != 2048 | 207 | if (n != 512 && n != 1024 && n != 2048 |
208 | && n != 4096) { | 208 | && n != 4096) { |
209 | printk ("AFFS: Invalid blocksize (512, 1024, 2048, 4096 allowed)\n"); | 209 | printk ("AFFS: Invalid blocksize (512, 1024, 2048, 4096 allowed)\n"); |
@@ -213,7 +213,7 @@ parse_options(char *options, uid_t *uid, gid_t *gid, int *mode, int *reserved, s | |||
213 | break; | 213 | break; |
214 | case Opt_mode: | 214 | case Opt_mode: |
215 | if (match_octal(&args[0], &option)) | 215 | if (match_octal(&args[0], &option)) |
216 | return 1; | 216 | return 0; |
217 | *mode = option & 0777; | 217 | *mode = option & 0777; |
218 | *mount_opts |= SF_SETMODE; | 218 | *mount_opts |= SF_SETMODE; |
219 | break; | 219 | break; |
@@ -221,8 +221,6 @@ parse_options(char *options, uid_t *uid, gid_t *gid, int *mode, int *reserved, s | |||
221 | *mount_opts |= SF_MUFS; | 221 | *mount_opts |= SF_MUFS; |
222 | break; | 222 | break; |
223 | case Opt_prefix: | 223 | case Opt_prefix: |
224 | /* Free any previous prefix */ | ||
225 | kfree(*prefix); | ||
226 | *prefix = match_strdup(&args[0]); | 224 | *prefix = match_strdup(&args[0]); |
227 | if (!*prefix) | 225 | if (!*prefix) |
228 | return 0; | 226 | return 0; |
@@ -233,21 +231,21 @@ parse_options(char *options, uid_t *uid, gid_t *gid, int *mode, int *reserved, s | |||
233 | break; | 231 | break; |
234 | case Opt_reserved: | 232 | case Opt_reserved: |
235 | if (match_int(&args[0], reserved)) | 233 | if (match_int(&args[0], reserved)) |
236 | return 1; | 234 | return 0; |
237 | break; | 235 | break; |
238 | case Opt_root: | 236 | case Opt_root: |
239 | if (match_int(&args[0], root)) | 237 | if (match_int(&args[0], root)) |
240 | return 1; | 238 | return 0; |
241 | break; | 239 | break; |
242 | case Opt_setgid: | 240 | case Opt_setgid: |
243 | if (match_int(&args[0], &option)) | 241 | if (match_int(&args[0], &option)) |
244 | return 1; | 242 | return 0; |
245 | *gid = option; | 243 | *gid = option; |
246 | *mount_opts |= SF_SETGID; | 244 | *mount_opts |= SF_SETGID; |
247 | break; | 245 | break; |
248 | case Opt_setuid: | 246 | case Opt_setuid: |
249 | if (match_int(&args[0], &option)) | 247 | if (match_int(&args[0], &option)) |
250 | return -EINVAL; | 248 | return 0; |
251 | *uid = option; | 249 | *uid = option; |
252 | *mount_opts |= SF_SETUID; | 250 | *mount_opts |= SF_SETUID; |
253 | break; | 251 | break; |
@@ -311,11 +309,14 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) | |||
311 | return -ENOMEM; | 309 | return -ENOMEM; |
312 | sb->s_fs_info = sbi; | 310 | sb->s_fs_info = sbi; |
313 | mutex_init(&sbi->s_bmlock); | 311 | mutex_init(&sbi->s_bmlock); |
312 | spin_lock_init(&sbi->symlink_lock); | ||
314 | 313 | ||
315 | if (!parse_options(data,&uid,&gid,&i,&reserved,&root_block, | 314 | if (!parse_options(data,&uid,&gid,&i,&reserved,&root_block, |
316 | &blocksize,&sbi->s_prefix, | 315 | &blocksize,&sbi->s_prefix, |
317 | sbi->s_volume, &mount_flags)) { | 316 | sbi->s_volume, &mount_flags)) { |
318 | printk(KERN_ERR "AFFS: Error parsing options\n"); | 317 | printk(KERN_ERR "AFFS: Error parsing options\n"); |
318 | kfree(sbi->s_prefix); | ||
319 | kfree(sbi); | ||
319 | return -EINVAL; | 320 | return -EINVAL; |
320 | } | 321 | } |
321 | /* N.B. after this point s_prefix must be released */ | 322 | /* N.B. after this point s_prefix must be released */ |
@@ -516,14 +517,18 @@ affs_remount(struct super_block *sb, int *flags, char *data) | |||
516 | unsigned long mount_flags; | 517 | unsigned long mount_flags; |
517 | int res = 0; | 518 | int res = 0; |
518 | char *new_opts = kstrdup(data, GFP_KERNEL); | 519 | char *new_opts = kstrdup(data, GFP_KERNEL); |
520 | char volume[32]; | ||
521 | char *prefix = NULL; | ||
519 | 522 | ||
520 | pr_debug("AFFS: remount(flags=0x%x,opts=\"%s\")\n",*flags,data); | 523 | pr_debug("AFFS: remount(flags=0x%x,opts=\"%s\")\n",*flags,data); |
521 | 524 | ||
522 | *flags |= MS_NODIRATIME; | 525 | *flags |= MS_NODIRATIME; |
523 | 526 | ||
527 | memcpy(volume, sbi->s_volume, 32); | ||
524 | if (!parse_options(data, &uid, &gid, &mode, &reserved, &root_block, | 528 | if (!parse_options(data, &uid, &gid, &mode, &reserved, &root_block, |
525 | &blocksize, &sbi->s_prefix, sbi->s_volume, | 529 | &blocksize, &prefix, volume, |
526 | &mount_flags)) { | 530 | &mount_flags)) { |
531 | kfree(prefix); | ||
527 | kfree(new_opts); | 532 | kfree(new_opts); |
528 | return -EINVAL; | 533 | return -EINVAL; |
529 | } | 534 | } |
@@ -534,6 +539,14 @@ affs_remount(struct super_block *sb, int *flags, char *data) | |||
534 | sbi->s_mode = mode; | 539 | sbi->s_mode = mode; |
535 | sbi->s_uid = uid; | 540 | sbi->s_uid = uid; |
536 | sbi->s_gid = gid; | 541 | sbi->s_gid = gid; |
542 | /* protect against readers */ | ||
543 | spin_lock(&sbi->symlink_lock); | ||
544 | if (prefix) { | ||
545 | kfree(sbi->s_prefix); | ||
546 | sbi->s_prefix = prefix; | ||
547 | } | ||
548 | memcpy(sbi->s_volume, volume, 32); | ||
549 | spin_unlock(&sbi->symlink_lock); | ||
537 | 550 | ||
538 | if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) { | 551 | if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) { |
539 | unlock_kernel(); | 552 | unlock_kernel(); |
diff --git a/fs/affs/symlink.c b/fs/affs/symlink.c index 41782539c907..ee00f08c4f53 100644 --- a/fs/affs/symlink.c +++ b/fs/affs/symlink.c | |||
@@ -20,7 +20,6 @@ static int affs_symlink_readpage(struct file *file, struct page *page) | |||
20 | int i, j; | 20 | int i, j; |
21 | char c; | 21 | char c; |
22 | char lc; | 22 | char lc; |
23 | char *pf; | ||
24 | 23 | ||
25 | pr_debug("AFFS: follow_link(ino=%lu)\n",inode->i_ino); | 24 | pr_debug("AFFS: follow_link(ino=%lu)\n",inode->i_ino); |
26 | 25 | ||
@@ -32,11 +31,15 @@ static int affs_symlink_readpage(struct file *file, struct page *page) | |||
32 | j = 0; | 31 | j = 0; |
33 | lf = (struct slink_front *)bh->b_data; | 32 | lf = (struct slink_front *)bh->b_data; |
34 | lc = 0; | 33 | lc = 0; |
35 | pf = AFFS_SB(inode->i_sb)->s_prefix ? AFFS_SB(inode->i_sb)->s_prefix : "/"; | ||
36 | 34 | ||
37 | if (strchr(lf->symname,':')) { /* Handle assign or volume name */ | 35 | if (strchr(lf->symname,':')) { /* Handle assign or volume name */ |
36 | struct affs_sb_info *sbi = AFFS_SB(inode->i_sb); | ||
37 | char *pf; | ||
38 | spin_lock(&sbi->symlink_lock); | ||
39 | pf = sbi->s_prefix ? sbi->s_prefix : "/"; | ||
38 | while (i < 1023 && (c = pf[i])) | 40 | while (i < 1023 && (c = pf[i])) |
39 | link[i++] = c; | 41 | link[i++] = c; |
42 | spin_unlock(&sbi->symlink_lock); | ||
40 | while (i < 1023 && lf->symname[j] != ':') | 43 | while (i < 1023 && lf->symname[j] != ':') |
41 | link[i++] = lf->symname[j++]; | 44 | link[i++] = lf->symname[j++]; |
42 | if (i < 1023) | 45 | if (i < 1023) |
diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c index 6f60336c6628..8f3d9fd89604 100644 --- a/fs/bfs/inode.c +++ b/fs/bfs/inode.c | |||
@@ -353,35 +353,35 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) | |||
353 | struct inode *inode; | 353 | struct inode *inode; |
354 | unsigned i, imap_len; | 354 | unsigned i, imap_len; |
355 | struct bfs_sb_info *info; | 355 | struct bfs_sb_info *info; |
356 | long ret = -EINVAL; | 356 | int ret = -EINVAL; |
357 | unsigned long i_sblock, i_eblock, i_eoff, s_size; | 357 | unsigned long i_sblock, i_eblock, i_eoff, s_size; |
358 | 358 | ||
359 | info = kzalloc(sizeof(*info), GFP_KERNEL); | 359 | info = kzalloc(sizeof(*info), GFP_KERNEL); |
360 | if (!info) | 360 | if (!info) |
361 | return -ENOMEM; | 361 | return -ENOMEM; |
362 | mutex_init(&info->bfs_lock); | ||
362 | s->s_fs_info = info; | 363 | s->s_fs_info = info; |
363 | 364 | ||
364 | sb_set_blocksize(s, BFS_BSIZE); | 365 | sb_set_blocksize(s, BFS_BSIZE); |
365 | 366 | ||
366 | bh = sb_bread(s, 0); | 367 | info->si_sbh = sb_bread(s, 0); |
367 | if(!bh) | 368 | if (!info->si_sbh) |
368 | goto out; | 369 | goto out; |
369 | bfs_sb = (struct bfs_super_block *)bh->b_data; | 370 | bfs_sb = (struct bfs_super_block *)info->si_sbh->b_data; |
370 | if (le32_to_cpu(bfs_sb->s_magic) != BFS_MAGIC) { | 371 | if (le32_to_cpu(bfs_sb->s_magic) != BFS_MAGIC) { |
371 | if (!silent) | 372 | if (!silent) |
372 | printf("No BFS filesystem on %s (magic=%08x)\n", | 373 | printf("No BFS filesystem on %s (magic=%08x)\n", |
373 | s->s_id, le32_to_cpu(bfs_sb->s_magic)); | 374 | s->s_id, le32_to_cpu(bfs_sb->s_magic)); |
374 | goto out; | 375 | goto out1; |
375 | } | 376 | } |
376 | if (BFS_UNCLEAN(bfs_sb, s) && !silent) | 377 | if (BFS_UNCLEAN(bfs_sb, s) && !silent) |
377 | printf("%s is unclean, continuing\n", s->s_id); | 378 | printf("%s is unclean, continuing\n", s->s_id); |
378 | 379 | ||
379 | s->s_magic = BFS_MAGIC; | 380 | s->s_magic = BFS_MAGIC; |
380 | info->si_sbh = bh; | ||
381 | 381 | ||
382 | if (le32_to_cpu(bfs_sb->s_start) > le32_to_cpu(bfs_sb->s_end)) { | 382 | if (le32_to_cpu(bfs_sb->s_start) > le32_to_cpu(bfs_sb->s_end)) { |
383 | printf("Superblock is corrupted\n"); | 383 | printf("Superblock is corrupted\n"); |
384 | goto out; | 384 | goto out1; |
385 | } | 385 | } |
386 | 386 | ||
387 | info->si_lasti = (le32_to_cpu(bfs_sb->s_start) - BFS_BSIZE) / | 387 | info->si_lasti = (le32_to_cpu(bfs_sb->s_start) - BFS_BSIZE) / |
@@ -390,7 +390,7 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) | |||
390 | imap_len = (info->si_lasti / 8) + 1; | 390 | imap_len = (info->si_lasti / 8) + 1; |
391 | info->si_imap = kzalloc(imap_len, GFP_KERNEL); | 391 | info->si_imap = kzalloc(imap_len, GFP_KERNEL); |
392 | if (!info->si_imap) | 392 | if (!info->si_imap) |
393 | goto out; | 393 | goto out1; |
394 | for (i = 0; i < BFS_ROOT_INO; i++) | 394 | for (i = 0; i < BFS_ROOT_INO; i++) |
395 | set_bit(i, info->si_imap); | 395 | set_bit(i, info->si_imap); |
396 | 396 | ||
@@ -398,15 +398,13 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) | |||
398 | inode = bfs_iget(s, BFS_ROOT_INO); | 398 | inode = bfs_iget(s, BFS_ROOT_INO); |
399 | if (IS_ERR(inode)) { | 399 | if (IS_ERR(inode)) { |
400 | ret = PTR_ERR(inode); | 400 | ret = PTR_ERR(inode); |
401 | kfree(info->si_imap); | 401 | goto out2; |
402 | goto out; | ||
403 | } | 402 | } |
404 | s->s_root = d_alloc_root(inode); | 403 | s->s_root = d_alloc_root(inode); |
405 | if (!s->s_root) { | 404 | if (!s->s_root) { |
406 | iput(inode); | 405 | iput(inode); |
407 | ret = -ENOMEM; | 406 | ret = -ENOMEM; |
408 | kfree(info->si_imap); | 407 | goto out2; |
409 | goto out; | ||
410 | } | 408 | } |
411 | 409 | ||
412 | info->si_blocks = (le32_to_cpu(bfs_sb->s_end) + 1) >> BFS_BSIZE_BITS; | 410 | info->si_blocks = (le32_to_cpu(bfs_sb->s_end) + 1) >> BFS_BSIZE_BITS; |
@@ -419,10 +417,8 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) | |||
419 | bh = sb_bread(s, info->si_blocks - 1); | 417 | bh = sb_bread(s, info->si_blocks - 1); |
420 | if (!bh) { | 418 | if (!bh) { |
421 | printf("Last block not available: %lu\n", info->si_blocks - 1); | 419 | printf("Last block not available: %lu\n", info->si_blocks - 1); |
422 | iput(inode); | ||
423 | ret = -EIO; | 420 | ret = -EIO; |
424 | kfree(info->si_imap); | 421 | goto out3; |
425 | goto out; | ||
426 | } | 422 | } |
427 | brelse(bh); | 423 | brelse(bh); |
428 | 424 | ||
@@ -459,11 +455,8 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) | |||
459 | printf("Inode 0x%08x corrupted\n", i); | 455 | printf("Inode 0x%08x corrupted\n", i); |
460 | 456 | ||
461 | brelse(bh); | 457 | brelse(bh); |
462 | s->s_root = NULL; | 458 | ret = -EIO; |
463 | kfree(info->si_imap); | 459 | goto out3; |
464 | kfree(info); | ||
465 | s->s_fs_info = NULL; | ||
466 | return -EIO; | ||
467 | } | 460 | } |
468 | 461 | ||
469 | if (!di->i_ino) { | 462 | if (!di->i_ino) { |
@@ -483,11 +476,17 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent) | |||
483 | s->s_dirt = 1; | 476 | s->s_dirt = 1; |
484 | } | 477 | } |
485 | dump_imap("read_super", s); | 478 | dump_imap("read_super", s); |
486 | mutex_init(&info->bfs_lock); | ||
487 | return 0; | 479 | return 0; |
488 | 480 | ||
481 | out3: | ||
482 | dput(s->s_root); | ||
483 | s->s_root = NULL; | ||
484 | out2: | ||
485 | kfree(info->si_imap); | ||
486 | out1: | ||
487 | brelse(info->si_sbh); | ||
489 | out: | 488 | out: |
490 | brelse(bh); | 489 | mutex_destroy(&info->bfs_lock); |
491 | kfree(info); | 490 | kfree(info); |
492 | s->s_fs_info = NULL; | 491 | s->s_fs_info = NULL; |
493 | return ret; | 492 | return ret; |
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c index 346b69405363..fdd397099172 100644 --- a/fs/binfmt_aout.c +++ b/fs/binfmt_aout.c | |||
@@ -264,6 +264,7 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
264 | #else | 264 | #else |
265 | set_personality(PER_LINUX); | 265 | set_personality(PER_LINUX); |
266 | #endif | 266 | #endif |
267 | setup_new_exec(bprm); | ||
267 | 268 | ||
268 | current->mm->end_code = ex.a_text + | 269 | current->mm->end_code = ex.a_text + |
269 | (current->mm->start_code = N_TXTADDR(ex)); | 270 | (current->mm->start_code = N_TXTADDR(ex)); |
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index edd90c49003c..fd5b2ea5d299 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -662,27 +662,6 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
662 | if (elf_interpreter[elf_ppnt->p_filesz - 1] != '\0') | 662 | if (elf_interpreter[elf_ppnt->p_filesz - 1] != '\0') |
663 | goto out_free_interp; | 663 | goto out_free_interp; |
664 | 664 | ||
665 | /* | ||
666 | * The early SET_PERSONALITY here is so that the lookup | ||
667 | * for the interpreter happens in the namespace of the | ||
668 | * to-be-execed image. SET_PERSONALITY can select an | ||
669 | * alternate root. | ||
670 | * | ||
671 | * However, SET_PERSONALITY is NOT allowed to switch | ||
672 | * this task into the new images's memory mapping | ||
673 | * policy - that is, TASK_SIZE must still evaluate to | ||
674 | * that which is appropriate to the execing application. | ||
675 | * This is because exit_mmap() needs to have TASK_SIZE | ||
676 | * evaluate to the size of the old image. | ||
677 | * | ||
678 | * So if (say) a 64-bit application is execing a 32-bit | ||
679 | * application it is the architecture's responsibility | ||
680 | * to defer changing the value of TASK_SIZE until the | ||
681 | * switch really is going to happen - do this in | ||
682 | * flush_thread(). - akpm | ||
683 | */ | ||
684 | SET_PERSONALITY(loc->elf_ex); | ||
685 | |||
686 | interpreter = open_exec(elf_interpreter); | 665 | interpreter = open_exec(elf_interpreter); |
687 | retval = PTR_ERR(interpreter); | 666 | retval = PTR_ERR(interpreter); |
688 | if (IS_ERR(interpreter)) | 667 | if (IS_ERR(interpreter)) |
@@ -730,9 +709,6 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
730 | /* Verify the interpreter has a valid arch */ | 709 | /* Verify the interpreter has a valid arch */ |
731 | if (!elf_check_arch(&loc->interp_elf_ex)) | 710 | if (!elf_check_arch(&loc->interp_elf_ex)) |
732 | goto out_free_dentry; | 711 | goto out_free_dentry; |
733 | } else { | ||
734 | /* Executables without an interpreter also need a personality */ | ||
735 | SET_PERSONALITY(loc->elf_ex); | ||
736 | } | 712 | } |
737 | 713 | ||
738 | /* Flush all traces of the currently running executable */ | 714 | /* Flush all traces of the currently running executable */ |
@@ -752,7 +728,8 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs) | |||
752 | 728 | ||
753 | if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space) | 729 | if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space) |
754 | current->flags |= PF_RANDOMIZE; | 730 | current->flags |= PF_RANDOMIZE; |
755 | arch_pick_mmap_layout(current->mm); | 731 | |
732 | setup_new_exec(bprm); | ||
756 | 733 | ||
757 | /* Do this so that we can load the interpreter, if need be. We will | 734 | /* Do this so that we can load the interpreter, if need be. We will |
758 | change some of these later */ | 735 | change some of these later */ |
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c index c57d9ce5ff7e..18d77297ccc8 100644 --- a/fs/binfmt_elf_fdpic.c +++ b/fs/binfmt_elf_fdpic.c | |||
@@ -321,6 +321,9 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm, | |||
321 | set_personality(PER_LINUX_FDPIC); | 321 | set_personality(PER_LINUX_FDPIC); |
322 | if (elf_read_implies_exec(&exec_params.hdr, executable_stack)) | 322 | if (elf_read_implies_exec(&exec_params.hdr, executable_stack)) |
323 | current->personality |= READ_IMPLIES_EXEC; | 323 | current->personality |= READ_IMPLIES_EXEC; |
324 | |||
325 | setup_new_exec(bprm); | ||
326 | |||
324 | set_binfmt(&elf_fdpic_format); | 327 | set_binfmt(&elf_fdpic_format); |
325 | 328 | ||
326 | current->mm->start_code = 0; | 329 | current->mm->start_code = 0; |
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c index d4a00ea1054c..42c6b4a54445 100644 --- a/fs/binfmt_flat.c +++ b/fs/binfmt_flat.c | |||
@@ -519,6 +519,7 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
519 | 519 | ||
520 | /* OK, This is the point of no return */ | 520 | /* OK, This is the point of no return */ |
521 | set_personality(PER_LINUX_32BIT); | 521 | set_personality(PER_LINUX_32BIT); |
522 | setup_new_exec(bprm); | ||
522 | } | 523 | } |
523 | 524 | ||
524 | /* | 525 | /* |
diff --git a/fs/binfmt_som.c b/fs/binfmt_som.c index 2a9b5330cc5e..cc8560f6c9b0 100644 --- a/fs/binfmt_som.c +++ b/fs/binfmt_som.c | |||
@@ -227,6 +227,7 @@ load_som_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
227 | /* OK, This is the point of no return */ | 227 | /* OK, This is the point of no return */ |
228 | current->flags &= ~PF_FORKNOEXEC; | 228 | current->flags &= ~PF_FORKNOEXEC; |
229 | current->personality = PER_HPUX; | 229 | current->personality = PER_HPUX; |
230 | setup_new_exec(bprm); | ||
230 | 231 | ||
231 | /* Set the task size for HP-UX processes such that | 232 | /* Set the task size for HP-UX processes such that |
232 | * the gateway page is outside the address space. | 233 | * the gateway page is outside the address space. |
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c index 54f4798ab46a..6df6d6ed74fd 100644 --- a/fs/btrfs/acl.c +++ b/fs/btrfs/acl.c | |||
@@ -244,6 +244,7 @@ int btrfs_init_acl(struct btrfs_trans_handle *trans, | |||
244 | ACL_TYPE_ACCESS); | 244 | ACL_TYPE_ACCESS); |
245 | } | 245 | } |
246 | } | 246 | } |
247 | posix_acl_release(clone); | ||
247 | } | 248 | } |
248 | failed: | 249 | failed: |
249 | posix_acl_release(acl); | 250 | posix_acl_release(acl); |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 9f806dd04c27..2aa8ec6a0981 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -1161,6 +1161,7 @@ struct btrfs_root { | |||
1161 | #define BTRFS_MOUNT_SSD_SPREAD (1 << 8) | 1161 | #define BTRFS_MOUNT_SSD_SPREAD (1 << 8) |
1162 | #define BTRFS_MOUNT_NOSSD (1 << 9) | 1162 | #define BTRFS_MOUNT_NOSSD (1 << 9) |
1163 | #define BTRFS_MOUNT_DISCARD (1 << 10) | 1163 | #define BTRFS_MOUNT_DISCARD (1 << 10) |
1164 | #define BTRFS_MOUNT_FORCE_COMPRESS (1 << 11) | ||
1164 | 1165 | ||
1165 | #define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt) | 1166 | #define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt) |
1166 | #define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt) | 1167 | #define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt) |
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 009e3bd18f23..87b25543d7d1 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -1993,6 +1993,12 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
1993 | if (!fs_info->fs_root) | 1993 | if (!fs_info->fs_root) |
1994 | goto fail_trans_kthread; | 1994 | goto fail_trans_kthread; |
1995 | 1995 | ||
1996 | if (!(sb->s_flags & MS_RDONLY)) { | ||
1997 | down_read(&fs_info->cleanup_work_sem); | ||
1998 | btrfs_orphan_cleanup(fs_info->fs_root); | ||
1999 | up_read(&fs_info->cleanup_work_sem); | ||
2000 | } | ||
2001 | |||
1996 | return tree_root; | 2002 | return tree_root; |
1997 | 2003 | ||
1998 | fail_trans_kthread: | 2004 | fail_trans_kthread: |
diff --git a/fs/btrfs/extent_map.c b/fs/btrfs/extent_map.c index 46bea0f4dc7b..428fcac45f90 100644 --- a/fs/btrfs/extent_map.c +++ b/fs/btrfs/extent_map.c | |||
@@ -155,20 +155,6 @@ static struct rb_node *__tree_search(struct rb_root *root, u64 offset, | |||
155 | return NULL; | 155 | return NULL; |
156 | } | 156 | } |
157 | 157 | ||
158 | /* | ||
159 | * look for an offset in the tree, and if it can't be found, return | ||
160 | * the first offset we can find smaller than 'offset'. | ||
161 | */ | ||
162 | static inline struct rb_node *tree_search(struct rb_root *root, u64 offset) | ||
163 | { | ||
164 | struct rb_node *prev; | ||
165 | struct rb_node *ret; | ||
166 | ret = __tree_search(root, offset, &prev, NULL); | ||
167 | if (!ret) | ||
168 | return prev; | ||
169 | return ret; | ||
170 | } | ||
171 | |||
172 | /* check to see if two extent_map structs are adjacent and safe to merge */ | 158 | /* check to see if two extent_map structs are adjacent and safe to merge */ |
173 | static int mergable_maps(struct extent_map *prev, struct extent_map *next) | 159 | static int mergable_maps(struct extent_map *prev, struct extent_map *next) |
174 | { | 160 | { |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index b330e27c2d8b..8cd109972fa6 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -483,7 +483,8 @@ again: | |||
483 | nr_pages_ret = 0; | 483 | nr_pages_ret = 0; |
484 | 484 | ||
485 | /* flag the file so we don't compress in the future */ | 485 | /* flag the file so we don't compress in the future */ |
486 | BTRFS_I(inode)->flags |= BTRFS_INODE_NOCOMPRESS; | 486 | if (!btrfs_test_opt(root, FORCE_COMPRESS)) |
487 | BTRFS_I(inode)->flags |= BTRFS_INODE_NOCOMPRESS; | ||
487 | } | 488 | } |
488 | if (will_compress) { | 489 | if (will_compress) { |
489 | *num_added += 1; | 490 | *num_added += 1; |
@@ -3796,12 +3797,6 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry) | |||
3796 | 3797 | ||
3797 | if (location.type == BTRFS_INODE_ITEM_KEY) { | 3798 | if (location.type == BTRFS_INODE_ITEM_KEY) { |
3798 | inode = btrfs_iget(dir->i_sb, &location, root); | 3799 | inode = btrfs_iget(dir->i_sb, &location, root); |
3799 | if (unlikely(root->clean_orphans) && | ||
3800 | !(inode->i_sb->s_flags & MS_RDONLY)) { | ||
3801 | down_read(&root->fs_info->cleanup_work_sem); | ||
3802 | btrfs_orphan_cleanup(root); | ||
3803 | up_read(&root->fs_info->cleanup_work_sem); | ||
3804 | } | ||
3805 | return inode; | 3800 | return inode; |
3806 | } | 3801 | } |
3807 | 3802 | ||
@@ -5799,7 +5794,7 @@ out_fail: | |||
5799 | } | 5794 | } |
5800 | 5795 | ||
5801 | static int prealloc_file_range(struct inode *inode, u64 start, u64 end, | 5796 | static int prealloc_file_range(struct inode *inode, u64 start, u64 end, |
5802 | u64 alloc_hint, int mode) | 5797 | u64 alloc_hint, int mode, loff_t actual_len) |
5803 | { | 5798 | { |
5804 | struct btrfs_trans_handle *trans; | 5799 | struct btrfs_trans_handle *trans; |
5805 | struct btrfs_root *root = BTRFS_I(inode)->root; | 5800 | struct btrfs_root *root = BTRFS_I(inode)->root; |
@@ -5808,6 +5803,7 @@ static int prealloc_file_range(struct inode *inode, u64 start, u64 end, | |||
5808 | u64 cur_offset = start; | 5803 | u64 cur_offset = start; |
5809 | u64 num_bytes = end - start; | 5804 | u64 num_bytes = end - start; |
5810 | int ret = 0; | 5805 | int ret = 0; |
5806 | u64 i_size; | ||
5811 | 5807 | ||
5812 | while (num_bytes > 0) { | 5808 | while (num_bytes > 0) { |
5813 | alloc_size = min(num_bytes, root->fs_info->max_extent); | 5809 | alloc_size = min(num_bytes, root->fs_info->max_extent); |
@@ -5846,8 +5842,12 @@ static int prealloc_file_range(struct inode *inode, u64 start, u64 end, | |||
5846 | BTRFS_I(inode)->flags |= BTRFS_INODE_PREALLOC; | 5842 | BTRFS_I(inode)->flags |= BTRFS_INODE_PREALLOC; |
5847 | if (!(mode & FALLOC_FL_KEEP_SIZE) && | 5843 | if (!(mode & FALLOC_FL_KEEP_SIZE) && |
5848 | cur_offset > inode->i_size) { | 5844 | cur_offset > inode->i_size) { |
5849 | i_size_write(inode, cur_offset); | 5845 | if (cur_offset > actual_len) |
5850 | btrfs_ordered_update_i_size(inode, cur_offset, NULL); | 5846 | i_size = actual_len; |
5847 | else | ||
5848 | i_size = cur_offset; | ||
5849 | i_size_write(inode, i_size); | ||
5850 | btrfs_ordered_update_i_size(inode, i_size, NULL); | ||
5851 | } | 5851 | } |
5852 | 5852 | ||
5853 | ret = btrfs_update_inode(trans, root, inode); | 5853 | ret = btrfs_update_inode(trans, root, inode); |
@@ -5940,7 +5940,7 @@ static long btrfs_fallocate(struct inode *inode, int mode, | |||
5940 | !test_bit(EXTENT_FLAG_PREALLOC, &em->flags))) { | 5940 | !test_bit(EXTENT_FLAG_PREALLOC, &em->flags))) { |
5941 | ret = prealloc_file_range(inode, | 5941 | ret = prealloc_file_range(inode, |
5942 | cur_offset, last_byte, | 5942 | cur_offset, last_byte, |
5943 | alloc_hint, mode); | 5943 | alloc_hint, mode, offset+len); |
5944 | if (ret < 0) { | 5944 | if (ret < 0) { |
5945 | free_extent_map(em); | 5945 | free_extent_map(em); |
5946 | break; | 5946 | break; |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 3f9b45704fcd..8a1ea6e64575 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -66,7 +66,8 @@ enum { | |||
66 | Opt_degraded, Opt_subvol, Opt_device, Opt_nodatasum, Opt_nodatacow, | 66 | Opt_degraded, Opt_subvol, Opt_device, Opt_nodatasum, Opt_nodatacow, |
67 | Opt_max_extent, Opt_max_inline, Opt_alloc_start, Opt_nobarrier, | 67 | Opt_max_extent, Opt_max_inline, Opt_alloc_start, Opt_nobarrier, |
68 | Opt_ssd, Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl, | 68 | Opt_ssd, Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl, |
69 | Opt_compress, Opt_notreelog, Opt_ratio, Opt_flushoncommit, | 69 | Opt_compress, Opt_compress_force, Opt_notreelog, Opt_ratio, |
70 | Opt_flushoncommit, | ||
70 | Opt_discard, Opt_err, | 71 | Opt_discard, Opt_err, |
71 | }; | 72 | }; |
72 | 73 | ||
@@ -82,6 +83,7 @@ static match_table_t tokens = { | |||
82 | {Opt_alloc_start, "alloc_start=%s"}, | 83 | {Opt_alloc_start, "alloc_start=%s"}, |
83 | {Opt_thread_pool, "thread_pool=%d"}, | 84 | {Opt_thread_pool, "thread_pool=%d"}, |
84 | {Opt_compress, "compress"}, | 85 | {Opt_compress, "compress"}, |
86 | {Opt_compress_force, "compress-force"}, | ||
85 | {Opt_ssd, "ssd"}, | 87 | {Opt_ssd, "ssd"}, |
86 | {Opt_ssd_spread, "ssd_spread"}, | 88 | {Opt_ssd_spread, "ssd_spread"}, |
87 | {Opt_nossd, "nossd"}, | 89 | {Opt_nossd, "nossd"}, |
@@ -173,6 +175,11 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
173 | printk(KERN_INFO "btrfs: use compression\n"); | 175 | printk(KERN_INFO "btrfs: use compression\n"); |
174 | btrfs_set_opt(info->mount_opt, COMPRESS); | 176 | btrfs_set_opt(info->mount_opt, COMPRESS); |
175 | break; | 177 | break; |
178 | case Opt_compress_force: | ||
179 | printk(KERN_INFO "btrfs: forcing compression\n"); | ||
180 | btrfs_set_opt(info->mount_opt, FORCE_COMPRESS); | ||
181 | btrfs_set_opt(info->mount_opt, COMPRESS); | ||
182 | break; | ||
176 | case Opt_ssd: | 183 | case Opt_ssd: |
177 | printk(KERN_INFO "btrfs: use ssd allocation scheme\n"); | 184 | printk(KERN_INFO "btrfs: use ssd allocation scheme\n"); |
178 | btrfs_set_opt(info->mount_opt, SSD); | 185 | btrfs_set_opt(info->mount_opt, SSD); |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 220dad5db017..41ecbb2347f2 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -1135,7 +1135,7 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) | |||
1135 | root->fs_info->avail_metadata_alloc_bits; | 1135 | root->fs_info->avail_metadata_alloc_bits; |
1136 | 1136 | ||
1137 | if ((all_avail & BTRFS_BLOCK_GROUP_RAID10) && | 1137 | if ((all_avail & BTRFS_BLOCK_GROUP_RAID10) && |
1138 | root->fs_info->fs_devices->rw_devices <= 4) { | 1138 | root->fs_info->fs_devices->num_devices <= 4) { |
1139 | printk(KERN_ERR "btrfs: unable to go below four devices " | 1139 | printk(KERN_ERR "btrfs: unable to go below four devices " |
1140 | "on raid10\n"); | 1140 | "on raid10\n"); |
1141 | ret = -EINVAL; | 1141 | ret = -EINVAL; |
@@ -1143,7 +1143,7 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) | |||
1143 | } | 1143 | } |
1144 | 1144 | ||
1145 | if ((all_avail & BTRFS_BLOCK_GROUP_RAID1) && | 1145 | if ((all_avail & BTRFS_BLOCK_GROUP_RAID1) && |
1146 | root->fs_info->fs_devices->rw_devices <= 2) { | 1146 | root->fs_info->fs_devices->num_devices <= 2) { |
1147 | printk(KERN_ERR "btrfs: unable to go below two " | 1147 | printk(KERN_ERR "btrfs: unable to go below two " |
1148 | "devices on raid1\n"); | 1148 | "devices on raid1\n"); |
1149 | ret = -EINVAL; | 1149 | ret = -EINVAL; |
@@ -1434,8 +1434,8 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) | |||
1434 | return -EINVAL; | 1434 | return -EINVAL; |
1435 | 1435 | ||
1436 | bdev = open_bdev_exclusive(device_path, 0, root->fs_info->bdev_holder); | 1436 | bdev = open_bdev_exclusive(device_path, 0, root->fs_info->bdev_holder); |
1437 | if (!bdev) | 1437 | if (IS_ERR(bdev)) |
1438 | return -EIO; | 1438 | return PTR_ERR(bdev); |
1439 | 1439 | ||
1440 | if (root->fs_info->fs_devices->seeding) { | 1440 | if (root->fs_info->fs_devices->seeding) { |
1441 | seeding_dev = 1; | 1441 | seeding_dev = 1; |
@@ -2538,6 +2538,11 @@ int btrfs_chunk_readonly(struct btrfs_root *root, u64 chunk_offset) | |||
2538 | if (!em) | 2538 | if (!em) |
2539 | return 1; | 2539 | return 1; |
2540 | 2540 | ||
2541 | if (btrfs_test_opt(root, DEGRADED)) { | ||
2542 | free_extent_map(em); | ||
2543 | return 0; | ||
2544 | } | ||
2545 | |||
2541 | map = (struct map_lookup *)em->bdev; | 2546 | map = (struct map_lookup *)em->bdev; |
2542 | for (i = 0; i < map->num_stripes; i++) { | 2547 | for (i = 0; i < map->num_stripes; i++) { |
2543 | if (!map->stripes[i].dev->writeable) { | 2548 | if (!map->stripes[i].dev->writeable) { |
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index b486169f42bf..274ac865bae8 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c | |||
@@ -160,15 +160,8 @@ static int debugfs_create_by_name(const char *name, mode_t mode, | |||
160 | * block. A pointer to that is in the struct vfsmount that we | 160 | * block. A pointer to that is in the struct vfsmount that we |
161 | * have around. | 161 | * have around. |
162 | */ | 162 | */ |
163 | if (!parent) { | 163 | if (!parent) |
164 | if (debugfs_mount && debugfs_mount->mnt_sb) { | 164 | parent = debugfs_mount->mnt_sb->s_root; |
165 | parent = debugfs_mount->mnt_sb->s_root; | ||
166 | } | ||
167 | } | ||
168 | if (!parent) { | ||
169 | pr_debug("debugfs: Ah! can not find a parent!\n"); | ||
170 | return -EFAULT; | ||
171 | } | ||
172 | 165 | ||
173 | *dentry = NULL; | 166 | *dentry = NULL; |
174 | mutex_lock(&parent->d_inode->i_mutex); | 167 | mutex_lock(&parent->d_inode->i_mutex); |
diff --git a/fs/eventfd.c b/fs/eventfd.c index d26402ff06ea..7758cc382ef0 100644 --- a/fs/eventfd.c +++ b/fs/eventfd.c | |||
@@ -135,26 +135,71 @@ static unsigned int eventfd_poll(struct file *file, poll_table *wait) | |||
135 | return events; | 135 | return events; |
136 | } | 136 | } |
137 | 137 | ||
138 | static ssize_t eventfd_read(struct file *file, char __user *buf, size_t count, | 138 | static void eventfd_ctx_do_read(struct eventfd_ctx *ctx, __u64 *cnt) |
139 | loff_t *ppos) | 139 | { |
140 | *cnt = (ctx->flags & EFD_SEMAPHORE) ? 1 : ctx->count; | ||
141 | ctx->count -= *cnt; | ||
142 | } | ||
143 | |||
144 | /** | ||
145 | * eventfd_ctx_remove_wait_queue - Read the current counter and removes wait queue. | ||
146 | * @ctx: [in] Pointer to eventfd context. | ||
147 | * @wait: [in] Wait queue to be removed. | ||
148 | * @cnt: [out] Pointer to the 64bit conter value. | ||
149 | * | ||
150 | * Returns zero if successful, or the following error codes: | ||
151 | * | ||
152 | * -EAGAIN : The operation would have blocked. | ||
153 | * | ||
154 | * This is used to atomically remove a wait queue entry from the eventfd wait | ||
155 | * queue head, and read/reset the counter value. | ||
156 | */ | ||
157 | int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, wait_queue_t *wait, | ||
158 | __u64 *cnt) | ||
159 | { | ||
160 | unsigned long flags; | ||
161 | |||
162 | spin_lock_irqsave(&ctx->wqh.lock, flags); | ||
163 | eventfd_ctx_do_read(ctx, cnt); | ||
164 | __remove_wait_queue(&ctx->wqh, wait); | ||
165 | if (*cnt != 0 && waitqueue_active(&ctx->wqh)) | ||
166 | wake_up_locked_poll(&ctx->wqh, POLLOUT); | ||
167 | spin_unlock_irqrestore(&ctx->wqh.lock, flags); | ||
168 | |||
169 | return *cnt != 0 ? 0 : -EAGAIN; | ||
170 | } | ||
171 | EXPORT_SYMBOL_GPL(eventfd_ctx_remove_wait_queue); | ||
172 | |||
173 | /** | ||
174 | * eventfd_ctx_read - Reads the eventfd counter or wait if it is zero. | ||
175 | * @ctx: [in] Pointer to eventfd context. | ||
176 | * @no_wait: [in] Different from zero if the operation should not block. | ||
177 | * @cnt: [out] Pointer to the 64bit conter value. | ||
178 | * | ||
179 | * Returns zero if successful, or the following error codes: | ||
180 | * | ||
181 | * -EAGAIN : The operation would have blocked but @no_wait was nonzero. | ||
182 | * -ERESTARTSYS : A signal interrupted the wait operation. | ||
183 | * | ||
184 | * If @no_wait is zero, the function might sleep until the eventfd internal | ||
185 | * counter becomes greater than zero. | ||
186 | */ | ||
187 | ssize_t eventfd_ctx_read(struct eventfd_ctx *ctx, int no_wait, __u64 *cnt) | ||
140 | { | 188 | { |
141 | struct eventfd_ctx *ctx = file->private_data; | ||
142 | ssize_t res; | 189 | ssize_t res; |
143 | __u64 ucnt = 0; | ||
144 | DECLARE_WAITQUEUE(wait, current); | 190 | DECLARE_WAITQUEUE(wait, current); |
145 | 191 | ||
146 | if (count < sizeof(ucnt)) | ||
147 | return -EINVAL; | ||
148 | spin_lock_irq(&ctx->wqh.lock); | 192 | spin_lock_irq(&ctx->wqh.lock); |
193 | *cnt = 0; | ||
149 | res = -EAGAIN; | 194 | res = -EAGAIN; |
150 | if (ctx->count > 0) | 195 | if (ctx->count > 0) |
151 | res = sizeof(ucnt); | 196 | res = 0; |
152 | else if (!(file->f_flags & O_NONBLOCK)) { | 197 | else if (!no_wait) { |
153 | __add_wait_queue(&ctx->wqh, &wait); | 198 | __add_wait_queue(&ctx->wqh, &wait); |
154 | for (res = 0;;) { | 199 | for (;;) { |
155 | set_current_state(TASK_INTERRUPTIBLE); | 200 | set_current_state(TASK_INTERRUPTIBLE); |
156 | if (ctx->count > 0) { | 201 | if (ctx->count > 0) { |
157 | res = sizeof(ucnt); | 202 | res = 0; |
158 | break; | 203 | break; |
159 | } | 204 | } |
160 | if (signal_pending(current)) { | 205 | if (signal_pending(current)) { |
@@ -168,18 +213,32 @@ static ssize_t eventfd_read(struct file *file, char __user *buf, size_t count, | |||
168 | __remove_wait_queue(&ctx->wqh, &wait); | 213 | __remove_wait_queue(&ctx->wqh, &wait); |
169 | __set_current_state(TASK_RUNNING); | 214 | __set_current_state(TASK_RUNNING); |
170 | } | 215 | } |
171 | if (likely(res > 0)) { | 216 | if (likely(res == 0)) { |
172 | ucnt = (ctx->flags & EFD_SEMAPHORE) ? 1 : ctx->count; | 217 | eventfd_ctx_do_read(ctx, cnt); |
173 | ctx->count -= ucnt; | ||
174 | if (waitqueue_active(&ctx->wqh)) | 218 | if (waitqueue_active(&ctx->wqh)) |
175 | wake_up_locked_poll(&ctx->wqh, POLLOUT); | 219 | wake_up_locked_poll(&ctx->wqh, POLLOUT); |
176 | } | 220 | } |
177 | spin_unlock_irq(&ctx->wqh.lock); | 221 | spin_unlock_irq(&ctx->wqh.lock); |
178 | if (res > 0 && put_user(ucnt, (__u64 __user *) buf)) | ||
179 | return -EFAULT; | ||
180 | 222 | ||
181 | return res; | 223 | return res; |
182 | } | 224 | } |
225 | EXPORT_SYMBOL_GPL(eventfd_ctx_read); | ||
226 | |||
227 | static ssize_t eventfd_read(struct file *file, char __user *buf, size_t count, | ||
228 | loff_t *ppos) | ||
229 | { | ||
230 | struct eventfd_ctx *ctx = file->private_data; | ||
231 | ssize_t res; | ||
232 | __u64 cnt; | ||
233 | |||
234 | if (count < sizeof(cnt)) | ||
235 | return -EINVAL; | ||
236 | res = eventfd_ctx_read(ctx, file->f_flags & O_NONBLOCK, &cnt); | ||
237 | if (res < 0) | ||
238 | return res; | ||
239 | |||
240 | return put_user(cnt, (__u64 __user *) buf) ? -EFAULT : sizeof(cnt); | ||
241 | } | ||
183 | 242 | ||
184 | static ssize_t eventfd_write(struct file *file, const char __user *buf, size_t count, | 243 | static ssize_t eventfd_write(struct file *file, const char __user *buf, size_t count, |
185 | loff_t *ppos) | 244 | loff_t *ppos) |
@@ -941,9 +941,7 @@ void set_task_comm(struct task_struct *tsk, char *buf) | |||
941 | 941 | ||
942 | int flush_old_exec(struct linux_binprm * bprm) | 942 | int flush_old_exec(struct linux_binprm * bprm) |
943 | { | 943 | { |
944 | char * name; | 944 | int retval; |
945 | int i, ch, retval; | ||
946 | char tcomm[sizeof(current->comm)]; | ||
947 | 945 | ||
948 | /* | 946 | /* |
949 | * Make sure we have a private signal table and that | 947 | * Make sure we have a private signal table and that |
@@ -963,6 +961,20 @@ int flush_old_exec(struct linux_binprm * bprm) | |||
963 | goto out; | 961 | goto out; |
964 | 962 | ||
965 | bprm->mm = NULL; /* We're using it now */ | 963 | bprm->mm = NULL; /* We're using it now */ |
964 | return 0; | ||
965 | |||
966 | out: | ||
967 | return retval; | ||
968 | } | ||
969 | EXPORT_SYMBOL(flush_old_exec); | ||
970 | |||
971 | void setup_new_exec(struct linux_binprm * bprm) | ||
972 | { | ||
973 | int i, ch; | ||
974 | char * name; | ||
975 | char tcomm[sizeof(current->comm)]; | ||
976 | |||
977 | arch_pick_mmap_layout(current->mm); | ||
966 | 978 | ||
967 | /* This is the point of no return */ | 979 | /* This is the point of no return */ |
968 | current->sas_ss_sp = current->sas_ss_size = 0; | 980 | current->sas_ss_sp = current->sas_ss_size = 0; |
@@ -1019,14 +1031,8 @@ int flush_old_exec(struct linux_binprm * bprm) | |||
1019 | 1031 | ||
1020 | flush_signal_handlers(current, 0); | 1032 | flush_signal_handlers(current, 0); |
1021 | flush_old_files(current->files); | 1033 | flush_old_files(current->files); |
1022 | |||
1023 | return 0; | ||
1024 | |||
1025 | out: | ||
1026 | return retval; | ||
1027 | } | 1034 | } |
1028 | 1035 | EXPORT_SYMBOL(setup_new_exec); | |
1029 | EXPORT_SYMBOL(flush_old_exec); | ||
1030 | 1036 | ||
1031 | /* | 1037 | /* |
1032 | * Prepare credentials and lock ->cred_guard_mutex. | 1038 | * Prepare credentials and lock ->cred_guard_mutex. |
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index af7b62699ea9..874d169a193e 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -361,14 +361,11 @@ struct ext4_new_group_data { | |||
361 | so set the magic i_delalloc_reserve_flag after taking the | 361 | so set the magic i_delalloc_reserve_flag after taking the |
362 | inode allocation semaphore for */ | 362 | inode allocation semaphore for */ |
363 | #define EXT4_GET_BLOCKS_DELALLOC_RESERVE 0x0004 | 363 | #define EXT4_GET_BLOCKS_DELALLOC_RESERVE 0x0004 |
364 | /* Call ext4_da_update_reserve_space() after successfully | ||
365 | allocating the blocks */ | ||
366 | #define EXT4_GET_BLOCKS_UPDATE_RESERVE_SPACE 0x0008 | ||
367 | /* caller is from the direct IO path, request to creation of an | 364 | /* caller is from the direct IO path, request to creation of an |
368 | unitialized extents if not allocated, split the uninitialized | 365 | unitialized extents if not allocated, split the uninitialized |
369 | extent if blocks has been preallocated already*/ | 366 | extent if blocks has been preallocated already*/ |
370 | #define EXT4_GET_BLOCKS_DIO 0x0010 | 367 | #define EXT4_GET_BLOCKS_DIO 0x0008 |
371 | #define EXT4_GET_BLOCKS_CONVERT 0x0020 | 368 | #define EXT4_GET_BLOCKS_CONVERT 0x0010 |
372 | #define EXT4_GET_BLOCKS_DIO_CREATE_EXT (EXT4_GET_BLOCKS_DIO|\ | 369 | #define EXT4_GET_BLOCKS_DIO_CREATE_EXT (EXT4_GET_BLOCKS_DIO|\ |
373 | EXT4_GET_BLOCKS_CREATE_UNINIT_EXT) | 370 | EXT4_GET_BLOCKS_CREATE_UNINIT_EXT) |
374 | /* Convert extent to initialized after direct IO complete */ | 371 | /* Convert extent to initialized after direct IO complete */ |
@@ -1443,6 +1440,8 @@ extern int ext4_block_truncate_page(handle_t *handle, | |||
1443 | extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf); | 1440 | extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf); |
1444 | extern qsize_t *ext4_get_reserved_space(struct inode *inode); | 1441 | extern qsize_t *ext4_get_reserved_space(struct inode *inode); |
1445 | extern int flush_aio_dio_completed_IO(struct inode *inode); | 1442 | extern int flush_aio_dio_completed_IO(struct inode *inode); |
1443 | extern void ext4_da_update_reserve_space(struct inode *inode, | ||
1444 | int used, int quota_claim); | ||
1446 | /* ioctl.c */ | 1445 | /* ioctl.c */ |
1447 | extern long ext4_ioctl(struct file *, unsigned int, unsigned long); | 1446 | extern long ext4_ioctl(struct file *, unsigned int, unsigned long); |
1448 | extern long ext4_compat_ioctl(struct file *, unsigned int, unsigned long); | 1447 | extern long ext4_compat_ioctl(struct file *, unsigned int, unsigned long); |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 7d7b74e94687..765a4826b118 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -3132,7 +3132,19 @@ out: | |||
3132 | unmap_underlying_metadata_blocks(inode->i_sb->s_bdev, | 3132 | unmap_underlying_metadata_blocks(inode->i_sb->s_bdev, |
3133 | newblock + max_blocks, | 3133 | newblock + max_blocks, |
3134 | allocated - max_blocks); | 3134 | allocated - max_blocks); |
3135 | allocated = max_blocks; | ||
3135 | } | 3136 | } |
3137 | |||
3138 | /* | ||
3139 | * If we have done fallocate with the offset that is already | ||
3140 | * delayed allocated, we would have block reservation | ||
3141 | * and quota reservation done in the delayed write path. | ||
3142 | * But fallocate would have already updated quota and block | ||
3143 | * count for this offset. So cancel these reservation | ||
3144 | */ | ||
3145 | if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) | ||
3146 | ext4_da_update_reserve_space(inode, allocated, 0); | ||
3147 | |||
3136 | map_out: | 3148 | map_out: |
3137 | set_buffer_mapped(bh_result); | 3149 | set_buffer_mapped(bh_result); |
3138 | out1: | 3150 | out1: |
@@ -3368,9 +3380,18 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode, | |||
3368 | /* previous routine could use block we allocated */ | 3380 | /* previous routine could use block we allocated */ |
3369 | newblock = ext_pblock(&newex); | 3381 | newblock = ext_pblock(&newex); |
3370 | allocated = ext4_ext_get_actual_len(&newex); | 3382 | allocated = ext4_ext_get_actual_len(&newex); |
3383 | if (allocated > max_blocks) | ||
3384 | allocated = max_blocks; | ||
3371 | set_buffer_new(bh_result); | 3385 | set_buffer_new(bh_result); |
3372 | 3386 | ||
3373 | /* | 3387 | /* |
3388 | * Update reserved blocks/metadata blocks after successful | ||
3389 | * block allocation which had been deferred till now. | ||
3390 | */ | ||
3391 | if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) | ||
3392 | ext4_da_update_reserve_space(inode, allocated, 1); | ||
3393 | |||
3394 | /* | ||
3374 | * Cache the extent and update transaction to commit on fdatasync only | 3395 | * Cache the extent and update transaction to commit on fdatasync only |
3375 | * when it is _not_ an uninitialized extent. | 3396 | * when it is _not_ an uninitialized extent. |
3376 | */ | 3397 | */ |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index c818972c8302..e11952404e02 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -1053,11 +1053,12 @@ static int ext4_calc_metadata_amount(struct inode *inode, sector_t lblock) | |||
1053 | * Called with i_data_sem down, which is important since we can call | 1053 | * Called with i_data_sem down, which is important since we can call |
1054 | * ext4_discard_preallocations() from here. | 1054 | * ext4_discard_preallocations() from here. |
1055 | */ | 1055 | */ |
1056 | static void ext4_da_update_reserve_space(struct inode *inode, int used) | 1056 | void ext4_da_update_reserve_space(struct inode *inode, |
1057 | int used, int quota_claim) | ||
1057 | { | 1058 | { |
1058 | struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); | 1059 | struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); |
1059 | struct ext4_inode_info *ei = EXT4_I(inode); | 1060 | struct ext4_inode_info *ei = EXT4_I(inode); |
1060 | int mdb_free = 0; | 1061 | int mdb_free = 0, allocated_meta_blocks = 0; |
1061 | 1062 | ||
1062 | spin_lock(&ei->i_block_reservation_lock); | 1063 | spin_lock(&ei->i_block_reservation_lock); |
1063 | if (unlikely(used > ei->i_reserved_data_blocks)) { | 1064 | if (unlikely(used > ei->i_reserved_data_blocks)) { |
@@ -1073,6 +1074,7 @@ static void ext4_da_update_reserve_space(struct inode *inode, int used) | |||
1073 | ei->i_reserved_data_blocks -= used; | 1074 | ei->i_reserved_data_blocks -= used; |
1074 | used += ei->i_allocated_meta_blocks; | 1075 | used += ei->i_allocated_meta_blocks; |
1075 | ei->i_reserved_meta_blocks -= ei->i_allocated_meta_blocks; | 1076 | ei->i_reserved_meta_blocks -= ei->i_allocated_meta_blocks; |
1077 | allocated_meta_blocks = ei->i_allocated_meta_blocks; | ||
1076 | ei->i_allocated_meta_blocks = 0; | 1078 | ei->i_allocated_meta_blocks = 0; |
1077 | percpu_counter_sub(&sbi->s_dirtyblocks_counter, used); | 1079 | percpu_counter_sub(&sbi->s_dirtyblocks_counter, used); |
1078 | 1080 | ||
@@ -1090,9 +1092,23 @@ static void ext4_da_update_reserve_space(struct inode *inode, int used) | |||
1090 | spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); | 1092 | spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); |
1091 | 1093 | ||
1092 | /* Update quota subsystem */ | 1094 | /* Update quota subsystem */ |
1093 | vfs_dq_claim_block(inode, used); | 1095 | if (quota_claim) { |
1094 | if (mdb_free) | 1096 | vfs_dq_claim_block(inode, used); |
1095 | vfs_dq_release_reservation_block(inode, mdb_free); | 1097 | if (mdb_free) |
1098 | vfs_dq_release_reservation_block(inode, mdb_free); | ||
1099 | } else { | ||
1100 | /* | ||
1101 | * We did fallocate with an offset that is already delayed | ||
1102 | * allocated. So on delayed allocated writeback we should | ||
1103 | * not update the quota for allocated blocks. But then | ||
1104 | * converting an fallocate region to initialized region would | ||
1105 | * have caused a metadata allocation. So claim quota for | ||
1106 | * that | ||
1107 | */ | ||
1108 | if (allocated_meta_blocks) | ||
1109 | vfs_dq_claim_block(inode, allocated_meta_blocks); | ||
1110 | vfs_dq_release_reservation_block(inode, mdb_free + used); | ||
1111 | } | ||
1096 | 1112 | ||
1097 | /* | 1113 | /* |
1098 | * If we have done all the pending block allocations and if | 1114 | * If we have done all the pending block allocations and if |
@@ -1292,18 +1308,20 @@ int ext4_get_blocks(handle_t *handle, struct inode *inode, sector_t block, | |||
1292 | */ | 1308 | */ |
1293 | EXT4_I(inode)->i_state &= ~EXT4_STATE_EXT_MIGRATE; | 1309 | EXT4_I(inode)->i_state &= ~EXT4_STATE_EXT_MIGRATE; |
1294 | } | 1310 | } |
1295 | } | ||
1296 | 1311 | ||
1312 | /* | ||
1313 | * Update reserved blocks/metadata blocks after successful | ||
1314 | * block allocation which had been deferred till now. We don't | ||
1315 | * support fallocate for non extent files. So we can update | ||
1316 | * reserve space here. | ||
1317 | */ | ||
1318 | if ((retval > 0) && | ||
1319 | (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE)) | ||
1320 | ext4_da_update_reserve_space(inode, retval, 1); | ||
1321 | } | ||
1297 | if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) | 1322 | if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) |
1298 | EXT4_I(inode)->i_delalloc_reserved_flag = 0; | 1323 | EXT4_I(inode)->i_delalloc_reserved_flag = 0; |
1299 | 1324 | ||
1300 | /* | ||
1301 | * Update reserved blocks/metadata blocks after successful | ||
1302 | * block allocation which had been deferred till now. | ||
1303 | */ | ||
1304 | if ((retval > 0) && (flags & EXT4_GET_BLOCKS_UPDATE_RESERVE_SPACE)) | ||
1305 | ext4_da_update_reserve_space(inode, retval); | ||
1306 | |||
1307 | up_write((&EXT4_I(inode)->i_data_sem)); | 1325 | up_write((&EXT4_I(inode)->i_data_sem)); |
1308 | if (retval > 0 && buffer_mapped(bh)) { | 1326 | if (retval > 0 && buffer_mapped(bh)) { |
1309 | int ret = check_block_validity(inode, "file system " | 1327 | int ret = check_block_validity(inode, "file system " |
@@ -1835,24 +1853,12 @@ repeat: | |||
1835 | * later. Real quota accounting is done at pages writeout | 1853 | * later. Real quota accounting is done at pages writeout |
1836 | * time. | 1854 | * time. |
1837 | */ | 1855 | */ |
1838 | if (vfs_dq_reserve_block(inode, md_needed + 1)) { | 1856 | if (vfs_dq_reserve_block(inode, md_needed + 1)) |
1839 | /* | ||
1840 | * We tend to badly over-estimate the amount of | ||
1841 | * metadata blocks which are needed, so if we have | ||
1842 | * reserved any metadata blocks, try to force out the | ||
1843 | * inode and see if we have any better luck. | ||
1844 | */ | ||
1845 | if (md_reserved && retries++ <= 3) | ||
1846 | goto retry; | ||
1847 | return -EDQUOT; | 1857 | return -EDQUOT; |
1848 | } | ||
1849 | 1858 | ||
1850 | if (ext4_claim_free_blocks(sbi, md_needed + 1)) { | 1859 | if (ext4_claim_free_blocks(sbi, md_needed + 1)) { |
1851 | vfs_dq_release_reservation_block(inode, md_needed + 1); | 1860 | vfs_dq_release_reservation_block(inode, md_needed + 1); |
1852 | if (ext4_should_retry_alloc(inode->i_sb, &retries)) { | 1861 | if (ext4_should_retry_alloc(inode->i_sb, &retries)) { |
1853 | retry: | ||
1854 | if (md_reserved) | ||
1855 | write_inode_now(inode, (retries == 3)); | ||
1856 | yield(); | 1862 | yield(); |
1857 | goto repeat; | 1863 | goto repeat; |
1858 | } | 1864 | } |
@@ -2213,10 +2219,10 @@ static int mpage_da_map_blocks(struct mpage_da_data *mpd) | |||
2213 | * variables are updated after the blocks have been allocated. | 2219 | * variables are updated after the blocks have been allocated. |
2214 | */ | 2220 | */ |
2215 | new.b_state = 0; | 2221 | new.b_state = 0; |
2216 | get_blocks_flags = (EXT4_GET_BLOCKS_CREATE | | 2222 | get_blocks_flags = EXT4_GET_BLOCKS_CREATE; |
2217 | EXT4_GET_BLOCKS_DELALLOC_RESERVE); | ||
2218 | if (mpd->b_state & (1 << BH_Delay)) | 2223 | if (mpd->b_state & (1 << BH_Delay)) |
2219 | get_blocks_flags |= EXT4_GET_BLOCKS_UPDATE_RESERVE_SPACE; | 2224 | get_blocks_flags |= EXT4_GET_BLOCKS_DELALLOC_RESERVE; |
2225 | |||
2220 | blks = ext4_get_blocks(handle, mpd->inode, next, max_blocks, | 2226 | blks = ext4_get_blocks(handle, mpd->inode, next, max_blocks, |
2221 | &new, get_blocks_flags); | 2227 | &new, get_blocks_flags); |
2222 | if (blks < 0) { | 2228 | if (blks < 0) { |
@@ -3032,7 +3038,7 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping, | |||
3032 | loff_t pos, unsigned len, unsigned flags, | 3038 | loff_t pos, unsigned len, unsigned flags, |
3033 | struct page **pagep, void **fsdata) | 3039 | struct page **pagep, void **fsdata) |
3034 | { | 3040 | { |
3035 | int ret, retries = 0; | 3041 | int ret, retries = 0, quota_retries = 0; |
3036 | struct page *page; | 3042 | struct page *page; |
3037 | pgoff_t index; | 3043 | pgoff_t index; |
3038 | unsigned from, to; | 3044 | unsigned from, to; |
@@ -3091,6 +3097,22 @@ retry: | |||
3091 | 3097 | ||
3092 | if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) | 3098 | if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) |
3093 | goto retry; | 3099 | goto retry; |
3100 | |||
3101 | if ((ret == -EDQUOT) && | ||
3102 | EXT4_I(inode)->i_reserved_meta_blocks && | ||
3103 | (quota_retries++ < 3)) { | ||
3104 | /* | ||
3105 | * Since we often over-estimate the number of meta | ||
3106 | * data blocks required, we may sometimes get a | ||
3107 | * spurios out of quota error even though there would | ||
3108 | * be enough space once we write the data blocks and | ||
3109 | * find out how many meta data blocks were _really_ | ||
3110 | * required. So try forcing the inode write to see if | ||
3111 | * that helps. | ||
3112 | */ | ||
3113 | write_inode_now(inode, (quota_retries == 3)); | ||
3114 | goto retry; | ||
3115 | } | ||
3094 | out: | 3116 | out: |
3095 | return ret; | 3117 | return ret; |
3096 | } | 3118 | } |
diff --git a/fs/fcntl.c b/fs/fcntl.c index 97e01dc0d95f..5ef953e6f908 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c | |||
@@ -199,7 +199,9 @@ static int setfl(int fd, struct file * filp, unsigned long arg) | |||
199 | static void f_modown(struct file *filp, struct pid *pid, enum pid_type type, | 199 | static void f_modown(struct file *filp, struct pid *pid, enum pid_type type, |
200 | int force) | 200 | int force) |
201 | { | 201 | { |
202 | write_lock_irq(&filp->f_owner.lock); | 202 | unsigned long flags; |
203 | |||
204 | write_lock_irqsave(&filp->f_owner.lock, flags); | ||
203 | if (force || !filp->f_owner.pid) { | 205 | if (force || !filp->f_owner.pid) { |
204 | put_pid(filp->f_owner.pid); | 206 | put_pid(filp->f_owner.pid); |
205 | filp->f_owner.pid = get_pid(pid); | 207 | filp->f_owner.pid = get_pid(pid); |
@@ -211,7 +213,7 @@ static void f_modown(struct file *filp, struct pid *pid, enum pid_type type, | |||
211 | filp->f_owner.euid = cred->euid; | 213 | filp->f_owner.euid = cred->euid; |
212 | } | 214 | } |
213 | } | 215 | } |
214 | write_unlock_irq(&filp->f_owner.lock); | 216 | write_unlock_irqrestore(&filp->f_owner.lock, flags); |
215 | } | 217 | } |
216 | 218 | ||
217 | int __f_setown(struct file *filp, struct pid *pid, enum pid_type type, | 219 | int __f_setown(struct file *filp, struct pid *pid, enum pid_type type, |
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 83ac4d3b3cb0..ba98546fabbd 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c | |||
@@ -2913,7 +2913,9 @@ int journal_init(struct super_block *sb, const char *j_dev_name, | |||
2913 | journal->j_mount_id = 10; | 2913 | journal->j_mount_id = 10; |
2914 | journal->j_state = 0; | 2914 | journal->j_state = 0; |
2915 | atomic_set(&(journal->j_jlock), 0); | 2915 | atomic_set(&(journal->j_jlock), 0); |
2916 | reiserfs_write_unlock(sb); | ||
2916 | journal->j_cnode_free_list = allocate_cnodes(num_cnodes); | 2917 | journal->j_cnode_free_list = allocate_cnodes(num_cnodes); |
2918 | reiserfs_write_lock(sb); | ||
2917 | journal->j_cnode_free_orig = journal->j_cnode_free_list; | 2919 | journal->j_cnode_free_orig = journal->j_cnode_free_list; |
2918 | journal->j_cnode_free = journal->j_cnode_free_list ? num_cnodes : 0; | 2920 | journal->j_cnode_free = journal->j_cnode_free_list ? num_cnodes : 0; |
2919 | journal->j_cnode_used = 0; | 2921 | journal->j_cnode_used = 0; |
diff --git a/fs/romfs/super.c b/fs/romfs/super.c index c117fa80d1e9..42d213546894 100644 --- a/fs/romfs/super.c +++ b/fs/romfs/super.c | |||
@@ -544,6 +544,7 @@ error: | |||
544 | error_rsb_inval: | 544 | error_rsb_inval: |
545 | ret = -EINVAL; | 545 | ret = -EINVAL; |
546 | error_rsb: | 546 | error_rsb: |
547 | kfree(rsb); | ||
547 | return ret; | 548 | return ret; |
548 | } | 549 | } |
549 | 550 | ||