diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/coda/psdev.c | 2 | ||||
-rw-r--r-- | fs/compat.c | 5 | ||||
-rw-r--r-- | fs/ecryptfs/crypto.c | 15 | ||||
-rw-r--r-- | fs/eventpoll.c | 11 | ||||
-rw-r--r-- | fs/ext3/dir.c | 20 | ||||
-rw-r--r-- | fs/ext3/super.c | 10 | ||||
-rw-r--r-- | fs/ext4/balloc.c | 77 | ||||
-rw-r--r-- | fs/ext4/dir.c | 20 | ||||
-rw-r--r-- | fs/ext4/ext4.h | 3 | ||||
-rw-r--r-- | fs/ext4/super.c | 11 | ||||
-rw-r--r-- | fs/fat/inode.c | 2 | ||||
-rw-r--r-- | fs/file_table.c | 4 | ||||
-rw-r--r-- | fs/fuse/dev.c | 1 | ||||
-rw-r--r-- | fs/inotify_user.c | 3 | ||||
-rw-r--r-- | fs/jbd/transaction.c | 1 | ||||
-rw-r--r-- | fs/jbd2/commit.c | 8 | ||||
-rw-r--r-- | fs/libfs.c | 2 | ||||
-rw-r--r-- | fs/lockd/svc4proc.c | 1 | ||||
-rw-r--r-- | fs/lockd/svcproc.c | 1 | ||||
-rw-r--r-- | fs/nfs/inode.c | 13 | ||||
-rw-r--r-- | fs/nfs/super.c | 2 | ||||
-rw-r--r-- | fs/nfsd/vfs.c | 1 | ||||
-rw-r--r-- | fs/ocfs2/file.c | 3 | ||||
-rw-r--r-- | fs/pipe.c | 3 | ||||
-rw-r--r-- | fs/proc/array.c | 2 | ||||
-rw-r--r-- | fs/select.c | 5 | ||||
-rw-r--r-- | fs/splice.c | 4 |
27 files changed, 104 insertions, 126 deletions
diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c index cfd29da714d1..0376ac66c44a 100644 --- a/fs/coda/psdev.c +++ b/fs/coda/psdev.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * An implementation of a loadable kernel mode driver providing | 2 | * An implementation of a loadable kernel mode driver providing |
3 | * multiple kernel/user space bidirectional communications links. | 3 | * multiple kernel/user space bidirectional communications links. |
4 | * | 4 | * |
5 | * Author: Alan Cox <alan@redhat.com> | 5 | * Author: Alan Cox <alan@lxorguk.ukuu.org.uk> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or | 7 | * This program is free software; you can redistribute it and/or |
8 | * modify it under the terms of the GNU General Public License | 8 | * modify it under the terms of the GNU General Public License |
diff --git a/fs/compat.c b/fs/compat.c index fe3c9bf87608..e5f49f538502 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -1684,8 +1684,9 @@ asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp, | |||
1684 | return -EFAULT; | 1684 | return -EFAULT; |
1685 | 1685 | ||
1686 | to = &end_time; | 1686 | to = &end_time; |
1687 | if (poll_select_set_timeout(to, tv.tv_sec, | 1687 | if (poll_select_set_timeout(to, |
1688 | tv.tv_usec * NSEC_PER_USEC)) | 1688 | tv.tv_sec + (tv.tv_usec / USEC_PER_SEC), |
1689 | (tv.tv_usec % USEC_PER_SEC) * NSEC_PER_USEC)) | ||
1689 | return -EINVAL; | 1690 | return -EINVAL; |
1690 | } | 1691 | } |
1691 | 1692 | ||
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index 06db79d05c12..6046239465a1 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c | |||
@@ -1251,6 +1251,7 @@ struct kmem_cache *ecryptfs_header_cache_2; | |||
1251 | /** | 1251 | /** |
1252 | * ecryptfs_write_headers_virt | 1252 | * ecryptfs_write_headers_virt |
1253 | * @page_virt: The virtual address to write the headers to | 1253 | * @page_virt: The virtual address to write the headers to |
1254 | * @max: The size of memory allocated at page_virt | ||
1254 | * @size: Set to the number of bytes written by this function | 1255 | * @size: Set to the number of bytes written by this function |
1255 | * @crypt_stat: The cryptographic context | 1256 | * @crypt_stat: The cryptographic context |
1256 | * @ecryptfs_dentry: The eCryptfs dentry | 1257 | * @ecryptfs_dentry: The eCryptfs dentry |
@@ -1278,7 +1279,8 @@ struct kmem_cache *ecryptfs_header_cache_2; | |||
1278 | * | 1279 | * |
1279 | * Returns zero on success | 1280 | * Returns zero on success |
1280 | */ | 1281 | */ |
1281 | static int ecryptfs_write_headers_virt(char *page_virt, size_t *size, | 1282 | static int ecryptfs_write_headers_virt(char *page_virt, size_t max, |
1283 | size_t *size, | ||
1282 | struct ecryptfs_crypt_stat *crypt_stat, | 1284 | struct ecryptfs_crypt_stat *crypt_stat, |
1283 | struct dentry *ecryptfs_dentry) | 1285 | struct dentry *ecryptfs_dentry) |
1284 | { | 1286 | { |
@@ -1296,7 +1298,7 @@ static int ecryptfs_write_headers_virt(char *page_virt, size_t *size, | |||
1296 | offset += written; | 1298 | offset += written; |
1297 | rc = ecryptfs_generate_key_packet_set((page_virt + offset), crypt_stat, | 1299 | rc = ecryptfs_generate_key_packet_set((page_virt + offset), crypt_stat, |
1298 | ecryptfs_dentry, &written, | 1300 | ecryptfs_dentry, &written, |
1299 | PAGE_CACHE_SIZE - offset); | 1301 | max - offset); |
1300 | if (rc) | 1302 | if (rc) |
1301 | ecryptfs_printk(KERN_WARNING, "Error generating key packet " | 1303 | ecryptfs_printk(KERN_WARNING, "Error generating key packet " |
1302 | "set; rc = [%d]\n", rc); | 1304 | "set; rc = [%d]\n", rc); |
@@ -1368,14 +1370,14 @@ int ecryptfs_write_metadata(struct dentry *ecryptfs_dentry) | |||
1368 | goto out; | 1370 | goto out; |
1369 | } | 1371 | } |
1370 | /* Released in this function */ | 1372 | /* Released in this function */ |
1371 | virt = kzalloc(crypt_stat->num_header_bytes_at_front, GFP_KERNEL); | 1373 | virt = (char *)get_zeroed_page(GFP_KERNEL); |
1372 | if (!virt) { | 1374 | if (!virt) { |
1373 | printk(KERN_ERR "%s: Out of memory\n", __func__); | 1375 | printk(KERN_ERR "%s: Out of memory\n", __func__); |
1374 | rc = -ENOMEM; | 1376 | rc = -ENOMEM; |
1375 | goto out; | 1377 | goto out; |
1376 | } | 1378 | } |
1377 | rc = ecryptfs_write_headers_virt(virt, &size, crypt_stat, | 1379 | rc = ecryptfs_write_headers_virt(virt, PAGE_CACHE_SIZE, &size, |
1378 | ecryptfs_dentry); | 1380 | crypt_stat, ecryptfs_dentry); |
1379 | if (unlikely(rc)) { | 1381 | if (unlikely(rc)) { |
1380 | printk(KERN_ERR "%s: Error whilst writing headers; rc = [%d]\n", | 1382 | printk(KERN_ERR "%s: Error whilst writing headers; rc = [%d]\n", |
1381 | __func__, rc); | 1383 | __func__, rc); |
@@ -1393,8 +1395,7 @@ int ecryptfs_write_metadata(struct dentry *ecryptfs_dentry) | |||
1393 | goto out_free; | 1395 | goto out_free; |
1394 | } | 1396 | } |
1395 | out_free: | 1397 | out_free: |
1396 | memset(virt, 0, crypt_stat->num_header_bytes_at_front); | 1398 | free_page((unsigned long)virt); |
1397 | kfree(virt); | ||
1398 | out: | 1399 | out: |
1399 | return rc; | 1400 | return rc; |
1400 | } | 1401 | } |
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 99368bda0261..aec5c13f6341 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c | |||
@@ -930,8 +930,15 @@ errxit: | |||
930 | * inside the main ready-list here. | 930 | * inside the main ready-list here. |
931 | */ | 931 | */ |
932 | for (nepi = ep->ovflist; (epi = nepi) != NULL; | 932 | for (nepi = ep->ovflist; (epi = nepi) != NULL; |
933 | nepi = epi->next, epi->next = EP_UNACTIVE_PTR) | 933 | nepi = epi->next, epi->next = EP_UNACTIVE_PTR) { |
934 | list_add_tail(&epi->rdllink, &ep->rdllist); | 934 | /* |
935 | * If the above loop quit with errors, the epoll item might still | ||
936 | * be linked to "txlist", and the list_splice() done below will | ||
937 | * take care of those cases. | ||
938 | */ | ||
939 | if (!ep_is_linked(&epi->rdllink)) | ||
940 | list_add_tail(&epi->rdllink, &ep->rdllist); | ||
941 | } | ||
935 | /* | 942 | /* |
936 | * We need to set back ep->ovflist to EP_UNACTIVE_PTR, so that after | 943 | * We need to set back ep->ovflist to EP_UNACTIVE_PTR, so that after |
937 | * releasing the lock, events will be queued in the normal way inside | 944 | * releasing the lock, events will be queued in the normal way inside |
diff --git a/fs/ext3/dir.c b/fs/ext3/dir.c index 4c82531ea0a8..5853f4440af4 100644 --- a/fs/ext3/dir.c +++ b/fs/ext3/dir.c | |||
@@ -456,17 +456,8 @@ static int ext3_dx_readdir(struct file * filp, | |||
456 | if (info->extra_fname) { | 456 | if (info->extra_fname) { |
457 | if (call_filldir(filp, dirent, filldir, info->extra_fname)) | 457 | if (call_filldir(filp, dirent, filldir, info->extra_fname)) |
458 | goto finished; | 458 | goto finished; |
459 | |||
460 | info->extra_fname = NULL; | 459 | info->extra_fname = NULL; |
461 | info->curr_node = rb_next(info->curr_node); | 460 | goto next_node; |
462 | if (!info->curr_node) { | ||
463 | if (info->next_hash == ~0) { | ||
464 | filp->f_pos = EXT3_HTREE_EOF; | ||
465 | goto finished; | ||
466 | } | ||
467 | info->curr_hash = info->next_hash; | ||
468 | info->curr_minor_hash = 0; | ||
469 | } | ||
470 | } else if (!info->curr_node) | 461 | } else if (!info->curr_node) |
471 | info->curr_node = rb_first(&info->root); | 462 | info->curr_node = rb_first(&info->root); |
472 | 463 | ||
@@ -498,9 +489,14 @@ static int ext3_dx_readdir(struct file * filp, | |||
498 | info->curr_minor_hash = fname->minor_hash; | 489 | info->curr_minor_hash = fname->minor_hash; |
499 | if (call_filldir(filp, dirent, filldir, fname)) | 490 | if (call_filldir(filp, dirent, filldir, fname)) |
500 | break; | 491 | break; |
501 | 492 | next_node: | |
502 | info->curr_node = rb_next(info->curr_node); | 493 | info->curr_node = rb_next(info->curr_node); |
503 | if (!info->curr_node) { | 494 | if (info->curr_node) { |
495 | fname = rb_entry(info->curr_node, struct fname, | ||
496 | rb_hash); | ||
497 | info->curr_hash = fname->hash; | ||
498 | info->curr_minor_hash = fname->minor_hash; | ||
499 | } else { | ||
504 | if (info->next_hash == ~0) { | 500 | if (info->next_hash == ~0) { |
505 | filp->f_pos = EXT3_HTREE_EOF; | 501 | filp->f_pos = EXT3_HTREE_EOF; |
506 | break; | 502 | break; |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 18eaa78ecb4e..e5717a4fae67 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -281,7 +281,8 @@ void ext3_abort (struct super_block * sb, const char * function, | |||
281 | EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS; | 281 | EXT3_SB(sb)->s_mount_state |= EXT3_ERROR_FS; |
282 | sb->s_flags |= MS_RDONLY; | 282 | sb->s_flags |= MS_RDONLY; |
283 | EXT3_SB(sb)->s_mount_opt |= EXT3_MOUNT_ABORT; | 283 | EXT3_SB(sb)->s_mount_opt |= EXT3_MOUNT_ABORT; |
284 | journal_abort(EXT3_SB(sb)->s_journal, -EIO); | 284 | if (EXT3_SB(sb)->s_journal) |
285 | journal_abort(EXT3_SB(sb)->s_journal, -EIO); | ||
285 | } | 286 | } |
286 | 287 | ||
287 | void ext3_warning (struct super_block * sb, const char * function, | 288 | void ext3_warning (struct super_block * sb, const char * function, |
@@ -390,11 +391,14 @@ static void ext3_put_super (struct super_block * sb) | |||
390 | { | 391 | { |
391 | struct ext3_sb_info *sbi = EXT3_SB(sb); | 392 | struct ext3_sb_info *sbi = EXT3_SB(sb); |
392 | struct ext3_super_block *es = sbi->s_es; | 393 | struct ext3_super_block *es = sbi->s_es; |
393 | int i; | 394 | int i, err; |
394 | 395 | ||
395 | ext3_xattr_put_super(sb); | 396 | ext3_xattr_put_super(sb); |
396 | if (journal_destroy(sbi->s_journal) < 0) | 397 | err = journal_destroy(sbi->s_journal); |
398 | sbi->s_journal = NULL; | ||
399 | if (err < 0) | ||
397 | ext3_abort(sb, __func__, "Couldn't clean up the journal"); | 400 | ext3_abort(sb, __func__, "Couldn't clean up the journal"); |
401 | |||
398 | if (!(sb->s_flags & MS_RDONLY)) { | 402 | if (!(sb->s_flags & MS_RDONLY)) { |
399 | EXT3_CLEAR_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER); | 403 | EXT3_CLEAR_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER); |
400 | es->s_state = cpu_to_le16(sbi->s_mount_state); | 404 | es->s_state = cpu_to_le16(sbi->s_mount_state); |
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index b9821be709bd..d2003cdc36aa 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c | |||
@@ -589,21 +589,23 @@ void ext4_free_blocks(handle_t *handle, struct inode *inode, | |||
589 | return; | 589 | return; |
590 | } | 590 | } |
591 | 591 | ||
592 | int ext4_claim_free_blocks(struct ext4_sb_info *sbi, | 592 | /** |
593 | s64 nblocks) | 593 | * ext4_has_free_blocks() |
594 | * @sbi: in-core super block structure. | ||
595 | * @nblocks: number of needed blocks | ||
596 | * | ||
597 | * Check if filesystem has nblocks free & available for allocation. | ||
598 | * On success return 1, return 0 on failure. | ||
599 | */ | ||
600 | int ext4_has_free_blocks(struct ext4_sb_info *sbi, s64 nblocks) | ||
594 | { | 601 | { |
595 | s64 free_blocks, dirty_blocks; | 602 | s64 free_blocks, dirty_blocks, root_blocks; |
596 | s64 root_blocks = 0; | ||
597 | struct percpu_counter *fbc = &sbi->s_freeblocks_counter; | 603 | struct percpu_counter *fbc = &sbi->s_freeblocks_counter; |
598 | struct percpu_counter *dbc = &sbi->s_dirtyblocks_counter; | 604 | struct percpu_counter *dbc = &sbi->s_dirtyblocks_counter; |
599 | 605 | ||
600 | free_blocks = percpu_counter_read_positive(fbc); | 606 | free_blocks = percpu_counter_read_positive(fbc); |
601 | dirty_blocks = percpu_counter_read_positive(dbc); | 607 | dirty_blocks = percpu_counter_read_positive(dbc); |
602 | 608 | root_blocks = ext4_r_blocks_count(sbi->s_es); | |
603 | if (!capable(CAP_SYS_RESOURCE) && | ||
604 | sbi->s_resuid != current->fsuid && | ||
605 | (sbi->s_resgid == 0 || !in_group_p(sbi->s_resgid))) | ||
606 | root_blocks = ext4_r_blocks_count(sbi->s_es); | ||
607 | 609 | ||
608 | if (free_blocks - (nblocks + root_blocks + dirty_blocks) < | 610 | if (free_blocks - (nblocks + root_blocks + dirty_blocks) < |
609 | EXT4_FREEBLOCKS_WATERMARK) { | 611 | EXT4_FREEBLOCKS_WATERMARK) { |
@@ -616,57 +618,32 @@ int ext4_claim_free_blocks(struct ext4_sb_info *sbi, | |||
616 | } | 618 | } |
617 | } | 619 | } |
618 | /* Check whether we have space after | 620 | /* Check whether we have space after |
619 | * accounting for current dirty blocks | 621 | * accounting for current dirty blocks & root reserved blocks. |
620 | */ | 622 | */ |
621 | if (free_blocks < ((root_blocks + nblocks) + dirty_blocks)) | 623 | if (free_blocks >= ((root_blocks + nblocks) + dirty_blocks)) |
622 | /* we don't have free space */ | 624 | return 1; |
623 | return -ENOSPC; | 625 | |
626 | /* Hm, nope. Are (enough) root reserved blocks available? */ | ||
627 | if (sbi->s_resuid == current->fsuid || | ||
628 | ((sbi->s_resgid != 0) && in_group_p(sbi->s_resgid)) || | ||
629 | capable(CAP_SYS_RESOURCE)) { | ||
630 | if (free_blocks >= (nblocks + dirty_blocks)) | ||
631 | return 1; | ||
632 | } | ||
624 | 633 | ||
625 | /* Add the blocks to nblocks */ | ||
626 | percpu_counter_add(dbc, nblocks); | ||
627 | return 0; | 634 | return 0; |
628 | } | 635 | } |
629 | 636 | ||
630 | /** | 637 | int ext4_claim_free_blocks(struct ext4_sb_info *sbi, |
631 | * ext4_has_free_blocks() | ||
632 | * @sbi: in-core super block structure. | ||
633 | * @nblocks: number of neeed blocks | ||
634 | * | ||
635 | * Check if filesystem has free blocks available for allocation. | ||
636 | * Return the number of blocks avaible for allocation for this request | ||
637 | * On success, return nblocks | ||
638 | */ | ||
639 | ext4_fsblk_t ext4_has_free_blocks(struct ext4_sb_info *sbi, | ||
640 | s64 nblocks) | 638 | s64 nblocks) |
641 | { | 639 | { |
642 | s64 free_blocks, dirty_blocks; | 640 | if (ext4_has_free_blocks(sbi, nblocks)) { |
643 | s64 root_blocks = 0; | 641 | percpu_counter_add(&sbi->s_dirtyblocks_counter, nblocks); |
644 | struct percpu_counter *fbc = &sbi->s_freeblocks_counter; | ||
645 | struct percpu_counter *dbc = &sbi->s_dirtyblocks_counter; | ||
646 | |||
647 | free_blocks = percpu_counter_read_positive(fbc); | ||
648 | dirty_blocks = percpu_counter_read_positive(dbc); | ||
649 | |||
650 | if (!capable(CAP_SYS_RESOURCE) && | ||
651 | sbi->s_resuid != current->fsuid && | ||
652 | (sbi->s_resgid == 0 || !in_group_p(sbi->s_resgid))) | ||
653 | root_blocks = ext4_r_blocks_count(sbi->s_es); | ||
654 | |||
655 | if (free_blocks - (nblocks + root_blocks + dirty_blocks) < | ||
656 | EXT4_FREEBLOCKS_WATERMARK) { | ||
657 | free_blocks = percpu_counter_sum(fbc); | ||
658 | dirty_blocks = percpu_counter_sum(dbc); | ||
659 | } | ||
660 | if (free_blocks <= (root_blocks + dirty_blocks)) | ||
661 | /* we don't have free space */ | ||
662 | return 0; | 642 | return 0; |
663 | 643 | } else | |
664 | if (free_blocks - (root_blocks + dirty_blocks) < nblocks) | 644 | return -ENOSPC; |
665 | return free_blocks - (root_blocks + dirty_blocks); | ||
666 | return nblocks; | ||
667 | } | 645 | } |
668 | 646 | ||
669 | |||
670 | /** | 647 | /** |
671 | * ext4_should_retry_alloc() | 648 | * ext4_should_retry_alloc() |
672 | * @sb: super block | 649 | * @sb: super block |
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c index 3ca6a2b7632d..fed5b610df5a 100644 --- a/fs/ext4/dir.c +++ b/fs/ext4/dir.c | |||
@@ -459,17 +459,8 @@ static int ext4_dx_readdir(struct file *filp, | |||
459 | if (info->extra_fname) { | 459 | if (info->extra_fname) { |
460 | if (call_filldir(filp, dirent, filldir, info->extra_fname)) | 460 | if (call_filldir(filp, dirent, filldir, info->extra_fname)) |
461 | goto finished; | 461 | goto finished; |
462 | |||
463 | info->extra_fname = NULL; | 462 | info->extra_fname = NULL; |
464 | info->curr_node = rb_next(info->curr_node); | 463 | goto next_node; |
465 | if (!info->curr_node) { | ||
466 | if (info->next_hash == ~0) { | ||
467 | filp->f_pos = EXT4_HTREE_EOF; | ||
468 | goto finished; | ||
469 | } | ||
470 | info->curr_hash = info->next_hash; | ||
471 | info->curr_minor_hash = 0; | ||
472 | } | ||
473 | } else if (!info->curr_node) | 464 | } else if (!info->curr_node) |
474 | info->curr_node = rb_first(&info->root); | 465 | info->curr_node = rb_first(&info->root); |
475 | 466 | ||
@@ -501,9 +492,14 @@ static int ext4_dx_readdir(struct file *filp, | |||
501 | info->curr_minor_hash = fname->minor_hash; | 492 | info->curr_minor_hash = fname->minor_hash; |
502 | if (call_filldir(filp, dirent, filldir, fname)) | 493 | if (call_filldir(filp, dirent, filldir, fname)) |
503 | break; | 494 | break; |
504 | 495 | next_node: | |
505 | info->curr_node = rb_next(info->curr_node); | 496 | info->curr_node = rb_next(info->curr_node); |
506 | if (!info->curr_node) { | 497 | if (info->curr_node) { |
498 | fname = rb_entry(info->curr_node, struct fname, | ||
499 | rb_hash); | ||
500 | info->curr_hash = fname->hash; | ||
501 | info->curr_minor_hash = fname->minor_hash; | ||
502 | } else { | ||
507 | if (info->next_hash == ~0) { | 503 | if (info->next_hash == ~0) { |
508 | filp->f_pos = EXT4_HTREE_EOF; | 504 | filp->f_pos = EXT4_HTREE_EOF; |
509 | break; | 505 | break; |
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 4880cc3e6727..b0537c827024 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -1003,8 +1003,7 @@ extern ext4_fsblk_t ext4_new_blocks(handle_t *handle, struct inode *inode, | |||
1003 | ext4_lblk_t iblock, ext4_fsblk_t goal, | 1003 | ext4_lblk_t iblock, ext4_fsblk_t goal, |
1004 | unsigned long *count, int *errp); | 1004 | unsigned long *count, int *errp); |
1005 | extern int ext4_claim_free_blocks(struct ext4_sb_info *sbi, s64 nblocks); | 1005 | extern int ext4_claim_free_blocks(struct ext4_sb_info *sbi, s64 nblocks); |
1006 | extern ext4_fsblk_t ext4_has_free_blocks(struct ext4_sb_info *sbi, | 1006 | extern int ext4_has_free_blocks(struct ext4_sb_info *sbi, s64 nblocks); |
1007 | s64 nblocks); | ||
1008 | extern void ext4_free_blocks(handle_t *handle, struct inode *inode, | 1007 | extern void ext4_free_blocks(handle_t *handle, struct inode *inode, |
1009 | ext4_fsblk_t block, unsigned long count, int metadata); | 1008 | ext4_fsblk_t block, unsigned long count, int metadata); |
1010 | extern void ext4_free_blocks_sb(handle_t *handle, struct super_block *sb, | 1009 | extern void ext4_free_blocks_sb(handle_t *handle, struct super_block *sb, |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index bdddea14e782..994859df010e 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -333,7 +333,8 @@ void ext4_abort(struct super_block *sb, const char *function, | |||
333 | EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS; | 333 | EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS; |
334 | sb->s_flags |= MS_RDONLY; | 334 | sb->s_flags |= MS_RDONLY; |
335 | EXT4_SB(sb)->s_mount_opt |= EXT4_MOUNT_ABORT; | 335 | EXT4_SB(sb)->s_mount_opt |= EXT4_MOUNT_ABORT; |
336 | jbd2_journal_abort(EXT4_SB(sb)->s_journal, -EIO); | 336 | if (EXT4_SB(sb)->s_journal) |
337 | jbd2_journal_abort(EXT4_SB(sb)->s_journal, -EIO); | ||
337 | } | 338 | } |
338 | 339 | ||
339 | void ext4_warning(struct super_block *sb, const char *function, | 340 | void ext4_warning(struct super_block *sb, const char *function, |
@@ -442,14 +443,16 @@ static void ext4_put_super(struct super_block *sb) | |||
442 | { | 443 | { |
443 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 444 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
444 | struct ext4_super_block *es = sbi->s_es; | 445 | struct ext4_super_block *es = sbi->s_es; |
445 | int i; | 446 | int i, err; |
446 | 447 | ||
447 | ext4_mb_release(sb); | 448 | ext4_mb_release(sb); |
448 | ext4_ext_release(sb); | 449 | ext4_ext_release(sb); |
449 | ext4_xattr_put_super(sb); | 450 | ext4_xattr_put_super(sb); |
450 | if (jbd2_journal_destroy(sbi->s_journal) < 0) | 451 | err = jbd2_journal_destroy(sbi->s_journal); |
451 | ext4_abort(sb, __func__, "Couldn't clean up the journal"); | ||
452 | sbi->s_journal = NULL; | 452 | sbi->s_journal = NULL; |
453 | if (err < 0) | ||
454 | ext4_abort(sb, __func__, "Couldn't clean up the journal"); | ||
455 | |||
453 | if (!(sb->s_flags & MS_RDONLY)) { | 456 | if (!(sb->s_flags & MS_RDONLY)) { |
454 | EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); | 457 | EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); |
455 | es->s_state = cpu_to_le16(sbi->s_mount_state); | 458 | es->s_state = cpu_to_le16(sbi->s_mount_state); |
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 19eafbe3c379..2b2eec1283bf 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
@@ -175,7 +175,7 @@ static ssize_t fat_direct_IO(int rw, struct kiocb *iocb, | |||
175 | 175 | ||
176 | if (rw == WRITE) { | 176 | if (rw == WRITE) { |
177 | /* | 177 | /* |
178 | * FIXME: blockdev_direct_IO() doesn't use ->prepare_write(), | 178 | * FIXME: blockdev_direct_IO() doesn't use ->write_begin(), |
179 | * so we need to update the ->mmu_private to block boundary. | 179 | * so we need to update the ->mmu_private to block boundary. |
180 | * | 180 | * |
181 | * But we must fill the remaining area or hole by nul for | 181 | * But we must fill the remaining area or hole by nul for |
diff --git a/fs/file_table.c b/fs/file_table.c index efc06faede6c..5ad0eca6eea2 100644 --- a/fs/file_table.c +++ b/fs/file_table.c | |||
@@ -269,6 +269,10 @@ void __fput(struct file *file) | |||
269 | eventpoll_release(file); | 269 | eventpoll_release(file); |
270 | locks_remove_flock(file); | 270 | locks_remove_flock(file); |
271 | 271 | ||
272 | if (unlikely(file->f_flags & FASYNC)) { | ||
273 | if (file->f_op && file->f_op->fasync) | ||
274 | file->f_op->fasync(-1, file, 0); | ||
275 | } | ||
272 | if (file->f_op && file->f_op->release) | 276 | if (file->f_op && file->f_op->release) |
273 | file->f_op->release(inode, file); | 277 | file->f_op->release(inode, file); |
274 | security_file_free(file); | 278 | security_file_free(file); |
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index 87250b6a8682..b72361479be2 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c | |||
@@ -1056,7 +1056,6 @@ static int fuse_dev_release(struct inode *inode, struct file *file) | |||
1056 | end_requests(fc, &fc->pending); | 1056 | end_requests(fc, &fc->pending); |
1057 | end_requests(fc, &fc->processing); | 1057 | end_requests(fc, &fc->processing); |
1058 | spin_unlock(&fc->lock); | 1058 | spin_unlock(&fc->lock); |
1059 | fasync_helper(-1, file, 0, &fc->fasync); | ||
1060 | fuse_conn_put(fc); | 1059 | fuse_conn_put(fc); |
1061 | } | 1060 | } |
1062 | 1061 | ||
diff --git a/fs/inotify_user.c b/fs/inotify_user.c index d85c7d931cdf..d367e9b92862 100644 --- a/fs/inotify_user.c +++ b/fs/inotify_user.c | |||
@@ -537,9 +537,6 @@ static int inotify_release(struct inode *ignored, struct file *file) | |||
537 | inotify_dev_event_dequeue(dev); | 537 | inotify_dev_event_dequeue(dev); |
538 | mutex_unlock(&dev->ev_mutex); | 538 | mutex_unlock(&dev->ev_mutex); |
539 | 539 | ||
540 | if (file->f_flags & FASYNC) | ||
541 | inotify_fasync(-1, file, 0); | ||
542 | |||
543 | /* free this device: the put matching the get in inotify_init() */ | 540 | /* free this device: the put matching the get in inotify_init() */ |
544 | put_inotify_dev(dev); | 541 | put_inotify_dev(dev); |
545 | 542 | ||
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c index d15cd6e7251e..60d4c32c8808 100644 --- a/fs/jbd/transaction.c +++ b/fs/jbd/transaction.c | |||
@@ -860,7 +860,6 @@ out: | |||
860 | * int journal_get_undo_access() - Notify intent to modify metadata with non-rewindable consequences | 860 | * int journal_get_undo_access() - Notify intent to modify metadata with non-rewindable consequences |
861 | * @handle: transaction | 861 | * @handle: transaction |
862 | * @bh: buffer to undo | 862 | * @bh: buffer to undo |
863 | * @credits: store the number of taken credits here (if not NULL) | ||
864 | * | 863 | * |
865 | * Sometimes there is a need to distinguish between metadata which has | 864 | * Sometimes there is a need to distinguish between metadata which has |
866 | * been committed to disk and that which has not. The ext3fs code uses | 865 | * been committed to disk and that which has not. The ext3fs code uses |
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 8b119e16aa36..ebc667bc54a8 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c | |||
@@ -974,6 +974,9 @@ restart_loop: | |||
974 | journal->j_committing_transaction = NULL; | 974 | journal->j_committing_transaction = NULL; |
975 | spin_unlock(&journal->j_state_lock); | 975 | spin_unlock(&journal->j_state_lock); |
976 | 976 | ||
977 | if (journal->j_commit_callback) | ||
978 | journal->j_commit_callback(journal, commit_transaction); | ||
979 | |||
977 | if (commit_transaction->t_checkpoint_list == NULL && | 980 | if (commit_transaction->t_checkpoint_list == NULL && |
978 | commit_transaction->t_checkpoint_io_list == NULL) { | 981 | commit_transaction->t_checkpoint_io_list == NULL) { |
979 | __jbd2_journal_drop_transaction(journal, commit_transaction); | 982 | __jbd2_journal_drop_transaction(journal, commit_transaction); |
@@ -995,11 +998,8 @@ restart_loop: | |||
995 | } | 998 | } |
996 | spin_unlock(&journal->j_list_lock); | 999 | spin_unlock(&journal->j_list_lock); |
997 | 1000 | ||
998 | if (journal->j_commit_callback) | ||
999 | journal->j_commit_callback(journal, commit_transaction); | ||
1000 | |||
1001 | trace_mark(jbd2_end_commit, "dev %s transaction %d head %d", | 1001 | trace_mark(jbd2_end_commit, "dev %s transaction %d head %d", |
1002 | journal->j_devname, commit_transaction->t_tid, | 1002 | journal->j_devname, journal->j_commit_sequence, |
1003 | journal->j_tail_sequence); | 1003 | journal->j_tail_sequence); |
1004 | jbd_debug(1, "JBD: commit %d complete, head %d\n", | 1004 | jbd_debug(1, "JBD: commit %d complete, head %d\n", |
1005 | journal->j_commit_sequence, journal->j_tail_sequence); | 1005 | journal->j_commit_sequence, journal->j_tail_sequence); |
diff --git a/fs/libfs.c b/fs/libfs.c index 74688598bcf7..e960a8321902 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -814,7 +814,7 @@ EXPORT_SYMBOL(simple_getattr); | |||
814 | EXPORT_SYMBOL(simple_link); | 814 | EXPORT_SYMBOL(simple_link); |
815 | EXPORT_SYMBOL(simple_lookup); | 815 | EXPORT_SYMBOL(simple_lookup); |
816 | EXPORT_SYMBOL(simple_pin_fs); | 816 | EXPORT_SYMBOL(simple_pin_fs); |
817 | EXPORT_SYMBOL(simple_prepare_write); | 817 | EXPORT_UNUSED_SYMBOL(simple_prepare_write); |
818 | EXPORT_SYMBOL(simple_readpage); | 818 | EXPORT_SYMBOL(simple_readpage); |
819 | EXPORT_SYMBOL(simple_release_fs); | 819 | EXPORT_SYMBOL(simple_release_fs); |
820 | EXPORT_SYMBOL(simple_rename); | 820 | EXPORT_SYMBOL(simple_rename); |
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c index 014f6ce48172..4dfdcbc6bf68 100644 --- a/fs/lockd/svc4proc.c +++ b/fs/lockd/svc4proc.c | |||
@@ -434,6 +434,7 @@ nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp, | |||
434 | * reclaim all locks we hold on this server. | 434 | * reclaim all locks we hold on this server. |
435 | */ | 435 | */ |
436 | memset(&saddr, 0, sizeof(saddr)); | 436 | memset(&saddr, 0, sizeof(saddr)); |
437 | saddr.sin_family = AF_INET; | ||
437 | saddr.sin_addr.s_addr = argp->addr; | 438 | saddr.sin_addr.s_addr = argp->addr; |
438 | nlm_host_rebooted(&saddr, argp->mon, argp->len, argp->state); | 439 | nlm_host_rebooted(&saddr, argp->mon, argp->len, argp->state); |
439 | 440 | ||
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c index 548b0bb2b84d..3ca89e2a9381 100644 --- a/fs/lockd/svcproc.c +++ b/fs/lockd/svcproc.c | |||
@@ -466,6 +466,7 @@ nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp, | |||
466 | * reclaim all locks we hold on this server. | 466 | * reclaim all locks we hold on this server. |
467 | */ | 467 | */ |
468 | memset(&saddr, 0, sizeof(saddr)); | 468 | memset(&saddr, 0, sizeof(saddr)); |
469 | saddr.sin_family = AF_INET; | ||
469 | saddr.sin_addr.s_addr = argp->addr; | 470 | saddr.sin_addr.s_addr = argp->addr; |
470 | nlm_host_rebooted(&saddr, argp->mon, argp->len, argp->state); | 471 | nlm_host_rebooted(&saddr, argp->mon, argp->len, argp->state); |
471 | 472 | ||
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index b9195c02a863..d22eb383e1cf 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * | 5 | * |
6 | * nfs inode and superblock handling functions | 6 | * nfs inode and superblock handling functions |
7 | * | 7 | * |
8 | * Modularised by Alan Cox <Alan.Cox@linux.org>, while hacking some | 8 | * Modularised by Alan Cox <alan@lxorguk.ukuu.org.uk>, while hacking some |
9 | * experimental NFS changes. Modularisation taken straight from SYS5 fs. | 9 | * experimental NFS changes. Modularisation taken straight from SYS5 fs. |
10 | * | 10 | * |
11 | * Change to nfs_read_super() to permit NFS mounts to multi-homed hosts. | 11 | * Change to nfs_read_super() to permit NFS mounts to multi-homed hosts. |
@@ -908,21 +908,16 @@ static int nfs_size_need_update(const struct inode *inode, const struct nfs_fatt | |||
908 | return nfs_size_to_loff_t(fattr->size) > i_size_read(inode); | 908 | return nfs_size_to_loff_t(fattr->size) > i_size_read(inode); |
909 | } | 909 | } |
910 | 910 | ||
911 | static unsigned long nfs_attr_generation_counter; | 911 | static atomic_long_t nfs_attr_generation_counter; |
912 | 912 | ||
913 | static unsigned long nfs_read_attr_generation_counter(void) | 913 | static unsigned long nfs_read_attr_generation_counter(void) |
914 | { | 914 | { |
915 | smp_rmb(); | 915 | return atomic_long_read(&nfs_attr_generation_counter); |
916 | return nfs_attr_generation_counter; | ||
917 | } | 916 | } |
918 | 917 | ||
919 | unsigned long nfs_inc_attr_generation_counter(void) | 918 | unsigned long nfs_inc_attr_generation_counter(void) |
920 | { | 919 | { |
921 | unsigned long ret; | 920 | return atomic_long_inc_return(&nfs_attr_generation_counter); |
922 | smp_rmb(); | ||
923 | ret = ++nfs_attr_generation_counter; | ||
924 | smp_wmb(); | ||
925 | return ret; | ||
926 | } | 921 | } |
927 | 922 | ||
928 | void nfs_fattr_init(struct nfs_fattr *fattr) | 923 | void nfs_fattr_init(struct nfs_fattr *fattr) |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index a3b0061dfd45..f48db679a1c6 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * | 5 | * |
6 | * nfs superblock handling functions | 6 | * nfs superblock handling functions |
7 | * | 7 | * |
8 | * Modularised by Alan Cox <Alan.Cox@linux.org>, while hacking some | 8 | * Modularised by Alan Cox <alan@lxorguk.ukuu.org.uk>, while hacking some |
9 | * experimental NFS changes. Modularisation taken straight from SYS5 fs. | 9 | * experimental NFS changes. Modularisation taken straight from SYS5 fs. |
10 | * | 10 | * |
11 | * Change to nfs_read_super() to permit NFS mounts to multi-homed hosts. | 11 | * Change to nfs_read_super() to permit NFS mounts to multi-homed hosts. |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 0bc56f6d9276..848a03e83a42 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -1912,6 +1912,7 @@ static int nfsd_buffered_readdir(struct file *file, filldir_t func, | |||
1912 | de = (struct buffered_dirent *)((char *)de + reclen); | 1912 | de = (struct buffered_dirent *)((char *)de + reclen); |
1913 | } | 1913 | } |
1914 | offset = vfs_llseek(file, 0, SEEK_CUR); | 1914 | offset = vfs_llseek(file, 0, SEEK_CUR); |
1915 | cdp->err = nfserr_eof; | ||
1915 | if (!buf.full) | 1916 | if (!buf.full) |
1916 | break; | 1917 | break; |
1917 | } | 1918 | } |
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 8d3225a78073..7efe937a415f 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -679,8 +679,7 @@ leave: | |||
679 | 679 | ||
680 | /* Some parts of this taken from generic_cont_expand, which turned out | 680 | /* Some parts of this taken from generic_cont_expand, which turned out |
681 | * to be too fragile to do exactly what we need without us having to | 681 | * to be too fragile to do exactly what we need without us having to |
682 | * worry about recursive locking in ->prepare_write() and | 682 | * worry about recursive locking in ->write_begin() and ->write_end(). */ |
683 | * ->commit_write(). */ | ||
684 | static int ocfs2_write_zero_page(struct inode *inode, | 683 | static int ocfs2_write_zero_page(struct inode *inode, |
685 | u64 size) | 684 | u64 size) |
686 | { | 685 | { |
@@ -717,14 +717,12 @@ pipe_rdwr_fasync(int fd, struct file *filp, int on) | |||
717 | static int | 717 | static int |
718 | pipe_read_release(struct inode *inode, struct file *filp) | 718 | pipe_read_release(struct inode *inode, struct file *filp) |
719 | { | 719 | { |
720 | pipe_read_fasync(-1, filp, 0); | ||
721 | return pipe_release(inode, 1, 0); | 720 | return pipe_release(inode, 1, 0); |
722 | } | 721 | } |
723 | 722 | ||
724 | static int | 723 | static int |
725 | pipe_write_release(struct inode *inode, struct file *filp) | 724 | pipe_write_release(struct inode *inode, struct file *filp) |
726 | { | 725 | { |
727 | pipe_write_fasync(-1, filp, 0); | ||
728 | return pipe_release(inode, 0, 1); | 726 | return pipe_release(inode, 0, 1); |
729 | } | 727 | } |
730 | 728 | ||
@@ -733,7 +731,6 @@ pipe_rdwr_release(struct inode *inode, struct file *filp) | |||
733 | { | 731 | { |
734 | int decr, decw; | 732 | int decr, decw; |
735 | 733 | ||
736 | pipe_rdwr_fasync(-1, filp, 0); | ||
737 | decr = (filp->f_mode & FMODE_READ) != 0; | 734 | decr = (filp->f_mode & FMODE_READ) != 0; |
738 | decw = (filp->f_mode & FMODE_WRITE) != 0; | 735 | decw = (filp->f_mode & FMODE_WRITE) != 0; |
739 | return pipe_release(inode, decr, decw); | 736 | return pipe_release(inode, decr, decw); |
diff --git a/fs/proc/array.c b/fs/proc/array.c index bb9f4b05703d..6af7fba7abb1 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -40,7 +40,7 @@ | |||
40 | * | 40 | * |
41 | * | 41 | * |
42 | * Alan Cox : security fixes. | 42 | * Alan Cox : security fixes. |
43 | * <Alan.Cox@linux.org> | 43 | * <alan@lxorguk.ukuu.org.uk> |
44 | * | 44 | * |
45 | * Al Viro : safe handling of mm_struct | 45 | * Al Viro : safe handling of mm_struct |
46 | * | 46 | * |
diff --git a/fs/select.c b/fs/select.c index 448e44001286..87df51eadcf2 100644 --- a/fs/select.c +++ b/fs/select.c | |||
@@ -519,8 +519,9 @@ asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp, | |||
519 | return -EFAULT; | 519 | return -EFAULT; |
520 | 520 | ||
521 | to = &end_time; | 521 | to = &end_time; |
522 | if (poll_select_set_timeout(to, tv.tv_sec, | 522 | if (poll_select_set_timeout(to, |
523 | tv.tv_usec * NSEC_PER_USEC)) | 523 | tv.tv_sec + (tv.tv_usec / USEC_PER_SEC), |
524 | (tv.tv_usec % USEC_PER_SEC) * NSEC_PER_USEC)) | ||
524 | return -EINVAL; | 525 | return -EINVAL; |
525 | } | 526 | } |
526 | 527 | ||
diff --git a/fs/splice.c b/fs/splice.c index a1e701c27156..1abab5cee4ba 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -731,8 +731,8 @@ ssize_t splice_from_pipe(struct pipe_inode_info *pipe, struct file *out, | |||
731 | }; | 731 | }; |
732 | 732 | ||
733 | /* | 733 | /* |
734 | * The actor worker might be calling ->prepare_write and | 734 | * The actor worker might be calling ->write_begin and |
735 | * ->commit_write. Most of the time, these expect i_mutex to | 735 | * ->write_end. Most of the time, these expect i_mutex to |
736 | * be held. Since this may result in an ABBA deadlock with | 736 | * be held. Since this may result in an ABBA deadlock with |
737 | * pipe->inode, we have to order lock acquiry here. | 737 | * pipe->inode, we have to order lock acquiry here. |
738 | */ | 738 | */ |