diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-09 15:51:21 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-09 15:51:21 -0500 |
commit | ac69e0928054ff29a5049902fb477f9c7605c773 (patch) | |
tree | 05be6b9285186823452e0adeffe40e1dfee6e354 | |
parent | 9e203936eac786f9268d6a13e6442d2accef1829 (diff) | |
parent | 302bf2f3259948c93361d501b04a5ed69c3bd4f8 (diff) |
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
ext2/3/4: delete unneeded includes of module.h
ext{3,4}: Fix potential race when setversion ioctl updates inode
udf: Mark LVID buffer as uptodate before marking it dirty
ext3: Don't warn from writepage when readonly inode is spotted after error
jbd: Remove j_barrier mutex
reiserfs: Force inode evictions before umount to avoid crash
reiserfs: Fix quota mount option parsing
udf: Treat symlink component of type 2 as /
udf: Fix deadlock when converting file from in-ICB one to normal one
udf: Cleanup calling convention of inode_getblk()
ext2: Fix error handling on inode bitmap corruption
ext3: Fix error handling on inode bitmap corruption
ext3: replace ll_rw_block with other functions
ext3: NULL dereference in ext3_evict_inode()
jbd: clear revoked flag on buffers before a new transaction started
ext3: call ext3_mark_recovery_complete() when recovery is really needed
35 files changed, 201 insertions, 111 deletions
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c index cd7f5f424a75..8b15cf8cef37 100644 --- a/fs/ext2/ialloc.c +++ b/fs/ext2/ialloc.c | |||
@@ -573,8 +573,11 @@ got: | |||
573 | inode->i_generation = sbi->s_next_generation++; | 573 | inode->i_generation = sbi->s_next_generation++; |
574 | spin_unlock(&sbi->s_next_gen_lock); | 574 | spin_unlock(&sbi->s_next_gen_lock); |
575 | if (insert_inode_locked(inode) < 0) { | 575 | if (insert_inode_locked(inode) < 0) { |
576 | err = -EINVAL; | 576 | ext2_error(sb, "ext2_new_inode", |
577 | goto fail_drop; | 577 | "inode number already in use - inode=%lu", |
578 | (unsigned long) ino); | ||
579 | err = -EIO; | ||
580 | goto fail; | ||
578 | } | 581 | } |
579 | 582 | ||
580 | dquot_initialize(inode); | 583 | dquot_initialize(inode); |
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 91a6945af6d8..740cad8dcd8d 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/highuid.h> | 26 | #include <linux/highuid.h> |
27 | #include <linux/pagemap.h> | 27 | #include <linux/pagemap.h> |
28 | #include <linux/quotaops.h> | 28 | #include <linux/quotaops.h> |
29 | #include <linux/module.h> | ||
30 | #include <linux/writeback.h> | 29 | #include <linux/writeback.h> |
31 | #include <linux/buffer_head.h> | 30 | #include <linux/buffer_head.h> |
32 | #include <linux/mpage.h> | 31 | #include <linux/mpage.h> |
@@ -36,10 +35,6 @@ | |||
36 | #include "acl.h" | 35 | #include "acl.h" |
37 | #include "xip.h" | 36 | #include "xip.h" |
38 | 37 | ||
39 | MODULE_AUTHOR("Remy Card and others"); | ||
40 | MODULE_DESCRIPTION("Second Extended Filesystem"); | ||
41 | MODULE_LICENSE("GPL"); | ||
42 | |||
43 | static int __ext2_write_inode(struct inode *inode, int do_sync); | 38 | static int __ext2_write_inode(struct inode *inode, int do_sync); |
44 | 39 | ||
45 | /* | 40 | /* |
diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 9b403f064ce0..0090595beb28 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c | |||
@@ -1520,5 +1520,8 @@ static void __exit exit_ext2_fs(void) | |||
1520 | exit_ext2_xattr(); | 1520 | exit_ext2_xattr(); |
1521 | } | 1521 | } |
1522 | 1522 | ||
1523 | MODULE_AUTHOR("Remy Card and others"); | ||
1524 | MODULE_DESCRIPTION("Second Extended Filesystem"); | ||
1525 | MODULE_LICENSE("GPL"); | ||
1523 | module_init(init_ext2_fs) | 1526 | module_init(init_ext2_fs) |
1524 | module_exit(exit_ext2_fs) | 1527 | module_exit(exit_ext2_fs) |
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c index d27b71f1d183..6dcafc7efdfd 100644 --- a/fs/ext2/xattr.c +++ b/fs/ext2/xattr.c | |||
@@ -54,7 +54,6 @@ | |||
54 | */ | 54 | */ |
55 | 55 | ||
56 | #include <linux/buffer_head.h> | 56 | #include <linux/buffer_head.h> |
57 | #include <linux/module.h> | ||
58 | #include <linux/init.h> | 57 | #include <linux/init.h> |
59 | #include <linux/slab.h> | 58 | #include <linux/slab.h> |
60 | #include <linux/mbcache.h> | 59 | #include <linux/mbcache.h> |
diff --git a/fs/ext2/xattr_security.c b/fs/ext2/xattr_security.c index c922adc8ef41..be7a8d02c9a7 100644 --- a/fs/ext2/xattr_security.c +++ b/fs/ext2/xattr_security.c | |||
@@ -3,7 +3,6 @@ | |||
3 | * Handler for storing security labels as extended attributes. | 3 | * Handler for storing security labels as extended attributes. |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/module.h> | ||
7 | #include <linux/slab.h> | 6 | #include <linux/slab.h> |
8 | #include <linux/string.h> | 7 | #include <linux/string.h> |
9 | #include <linux/fs.h> | 8 | #include <linux/fs.h> |
diff --git a/fs/ext2/xattr_trusted.c b/fs/ext2/xattr_trusted.c index 667e46a8d62d..2989467d3595 100644 --- a/fs/ext2/xattr_trusted.c +++ b/fs/ext2/xattr_trusted.c | |||
@@ -5,7 +5,6 @@ | |||
5 | * Copyright (C) 2003 by Andreas Gruenbacher, <a.gruenbacher@computer.org> | 5 | * Copyright (C) 2003 by Andreas Gruenbacher, <a.gruenbacher@computer.org> |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <linux/module.h> | ||
9 | #include <linux/string.h> | 8 | #include <linux/string.h> |
10 | #include <linux/capability.h> | 9 | #include <linux/capability.h> |
11 | #include <linux/fs.h> | 10 | #include <linux/fs.h> |
diff --git a/fs/ext2/xattr_user.c b/fs/ext2/xattr_user.c index 099d20f47163..f470e44c4b8d 100644 --- a/fs/ext2/xattr_user.c +++ b/fs/ext2/xattr_user.c | |||
@@ -6,7 +6,6 @@ | |||
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <linux/init.h> | 8 | #include <linux/init.h> |
9 | #include <linux/module.h> | ||
10 | #include <linux/string.h> | 9 | #include <linux/string.h> |
11 | #include "ext2.h" | 10 | #include "ext2.h" |
12 | #include "xattr.h" | 11 | #include "xattr.h" |
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c index 92cc86dfa23d..1cde28438014 100644 --- a/fs/ext3/ialloc.c +++ b/fs/ext3/ialloc.c | |||
@@ -525,8 +525,12 @@ got: | |||
525 | if (IS_DIRSYNC(inode)) | 525 | if (IS_DIRSYNC(inode)) |
526 | handle->h_sync = 1; | 526 | handle->h_sync = 1; |
527 | if (insert_inode_locked(inode) < 0) { | 527 | if (insert_inode_locked(inode) < 0) { |
528 | err = -EINVAL; | 528 | /* |
529 | goto fail_drop; | 529 | * Likely a bitmap corruption causing inode to be allocated |
530 | * twice. | ||
531 | */ | ||
532 | err = -EIO; | ||
533 | goto fail; | ||
530 | } | 534 | } |
531 | spin_lock(&sbi->s_next_gen_lock); | 535 | spin_lock(&sbi->s_next_gen_lock); |
532 | inode->i_generation = sbi->s_next_generation++; | 536 | inode->i_generation = sbi->s_next_generation++; |
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index 15cb47088aac..2d0afeca0b47 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c | |||
@@ -22,7 +22,6 @@ | |||
22 | * Assorted race fixes, rewrite of ext3_get_block() by Al Viro, 2000 | 22 | * Assorted race fixes, rewrite of ext3_get_block() by Al Viro, 2000 |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/fs.h> | 25 | #include <linux/fs.h> |
27 | #include <linux/time.h> | 26 | #include <linux/time.h> |
28 | #include <linux/ext3_jbd.h> | 27 | #include <linux/ext3_jbd.h> |
@@ -223,8 +222,12 @@ void ext3_evict_inode (struct inode *inode) | |||
223 | * | 222 | * |
224 | * Note that directories do not have this problem because they don't | 223 | * Note that directories do not have this problem because they don't |
225 | * use page cache. | 224 | * use page cache. |
225 | * | ||
226 | * The s_journal check handles the case when ext3_get_journal() fails | ||
227 | * and puts the journal inode. | ||
226 | */ | 228 | */ |
227 | if (inode->i_nlink && ext3_should_journal_data(inode) && | 229 | if (inode->i_nlink && ext3_should_journal_data(inode) && |
230 | EXT3_SB(inode->i_sb)->s_journal && | ||
228 | (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode))) { | 231 | (S_ISLNK(inode->i_mode) || S_ISREG(inode->i_mode))) { |
229 | tid_t commit_tid = atomic_read(&ei->i_datasync_tid); | 232 | tid_t commit_tid = atomic_read(&ei->i_datasync_tid); |
230 | journal_t *journal = EXT3_SB(inode->i_sb)->s_journal; | 233 | journal_t *journal = EXT3_SB(inode->i_sb)->s_journal; |
@@ -1132,9 +1135,11 @@ struct buffer_head *ext3_bread(handle_t *handle, struct inode *inode, | |||
1132 | bh = ext3_getblk(handle, inode, block, create, err); | 1135 | bh = ext3_getblk(handle, inode, block, create, err); |
1133 | if (!bh) | 1136 | if (!bh) |
1134 | return bh; | 1137 | return bh; |
1135 | if (buffer_uptodate(bh)) | 1138 | if (bh_uptodate_or_lock(bh)) |
1136 | return bh; | 1139 | return bh; |
1137 | ll_rw_block(READ | REQ_META | REQ_PRIO, 1, &bh); | 1140 | get_bh(bh); |
1141 | bh->b_end_io = end_buffer_read_sync; | ||
1142 | submit_bh(READ | REQ_META | REQ_PRIO, bh); | ||
1138 | wait_on_buffer(bh); | 1143 | wait_on_buffer(bh); |
1139 | if (buffer_uptodate(bh)) | 1144 | if (buffer_uptodate(bh)) |
1140 | return bh; | 1145 | return bh; |
@@ -1617,7 +1622,13 @@ static int ext3_ordered_writepage(struct page *page, | |||
1617 | int err; | 1622 | int err; |
1618 | 1623 | ||
1619 | J_ASSERT(PageLocked(page)); | 1624 | J_ASSERT(PageLocked(page)); |
1620 | WARN_ON_ONCE(IS_RDONLY(inode)); | 1625 | /* |
1626 | * We don't want to warn for emergency remount. The condition is | ||
1627 | * ordered to avoid dereferencing inode->i_sb in non-error case to | ||
1628 | * avoid slow-downs. | ||
1629 | */ | ||
1630 | WARN_ON_ONCE(IS_RDONLY(inode) && | ||
1631 | !(EXT3_SB(inode->i_sb)->s_mount_state & EXT3_ERROR_FS)); | ||
1621 | 1632 | ||
1622 | /* | 1633 | /* |
1623 | * We give up here if we're reentered, because it might be for a | 1634 | * We give up here if we're reentered, because it might be for a |
@@ -1692,7 +1703,13 @@ static int ext3_writeback_writepage(struct page *page, | |||
1692 | int err; | 1703 | int err; |
1693 | 1704 | ||
1694 | J_ASSERT(PageLocked(page)); | 1705 | J_ASSERT(PageLocked(page)); |
1695 | WARN_ON_ONCE(IS_RDONLY(inode)); | 1706 | /* |
1707 | * We don't want to warn for emergency remount. The condition is | ||
1708 | * ordered to avoid dereferencing inode->i_sb in non-error case to | ||
1709 | * avoid slow-downs. | ||
1710 | */ | ||
1711 | WARN_ON_ONCE(IS_RDONLY(inode) && | ||
1712 | !(EXT3_SB(inode->i_sb)->s_mount_state & EXT3_ERROR_FS)); | ||
1696 | 1713 | ||
1697 | if (ext3_journal_current_handle()) | 1714 | if (ext3_journal_current_handle()) |
1698 | goto out_fail; | 1715 | goto out_fail; |
@@ -1735,7 +1752,13 @@ static int ext3_journalled_writepage(struct page *page, | |||
1735 | int err; | 1752 | int err; |
1736 | 1753 | ||
1737 | J_ASSERT(PageLocked(page)); | 1754 | J_ASSERT(PageLocked(page)); |
1738 | WARN_ON_ONCE(IS_RDONLY(inode)); | 1755 | /* |
1756 | * We don't want to warn for emergency remount. The condition is | ||
1757 | * ordered to avoid dereferencing inode->i_sb in non-error case to | ||
1758 | * avoid slow-downs. | ||
1759 | */ | ||
1760 | WARN_ON_ONCE(IS_RDONLY(inode) && | ||
1761 | !(EXT3_SB(inode->i_sb)->s_mount_state & EXT3_ERROR_FS)); | ||
1739 | 1762 | ||
1740 | if (ext3_journal_current_handle()) | 1763 | if (ext3_journal_current_handle()) |
1741 | goto no_write; | 1764 | goto no_write; |
@@ -2064,12 +2087,10 @@ static int ext3_block_truncate_page(struct inode *inode, loff_t from) | |||
2064 | if (PageUptodate(page)) | 2087 | if (PageUptodate(page)) |
2065 | set_buffer_uptodate(bh); | 2088 | set_buffer_uptodate(bh); |
2066 | 2089 | ||
2067 | if (!buffer_uptodate(bh)) { | 2090 | if (!bh_uptodate_or_lock(bh)) { |
2068 | err = -EIO; | 2091 | err = bh_submit_read(bh); |
2069 | ll_rw_block(READ, 1, &bh); | ||
2070 | wait_on_buffer(bh); | ||
2071 | /* Uhhuh. Read error. Complain and punt. */ | 2092 | /* Uhhuh. Read error. Complain and punt. */ |
2072 | if (!buffer_uptodate(bh)) | 2093 | if (err) |
2073 | goto unlock; | 2094 | goto unlock; |
2074 | } | 2095 | } |
2075 | 2096 | ||
diff --git a/fs/ext3/ioctl.c b/fs/ext3/ioctl.c index 8e37c41a071b..4af574ce4a46 100644 --- a/fs/ext3/ioctl.c +++ b/fs/ext3/ioctl.c | |||
@@ -134,10 +134,11 @@ flags_out: | |||
134 | goto setversion_out; | 134 | goto setversion_out; |
135 | } | 135 | } |
136 | 136 | ||
137 | mutex_lock(&inode->i_mutex); | ||
137 | handle = ext3_journal_start(inode, 1); | 138 | handle = ext3_journal_start(inode, 1); |
138 | if (IS_ERR(handle)) { | 139 | if (IS_ERR(handle)) { |
139 | err = PTR_ERR(handle); | 140 | err = PTR_ERR(handle); |
140 | goto setversion_out; | 141 | goto unlock_out; |
141 | } | 142 | } |
142 | err = ext3_reserve_inode_write(handle, inode, &iloc); | 143 | err = ext3_reserve_inode_write(handle, inode, &iloc); |
143 | if (err == 0) { | 144 | if (err == 0) { |
@@ -146,6 +147,9 @@ flags_out: | |||
146 | err = ext3_mark_iloc_dirty(handle, inode, &iloc); | 147 | err = ext3_mark_iloc_dirty(handle, inode, &iloc); |
147 | } | 148 | } |
148 | ext3_journal_stop(handle); | 149 | ext3_journal_stop(handle); |
150 | |||
151 | unlock_out: | ||
152 | mutex_unlock(&inode->i_mutex); | ||
149 | setversion_out: | 153 | setversion_out: |
150 | mnt_drop_write_file(filp); | 154 | mnt_drop_write_file(filp); |
151 | return err; | 155 | return err; |
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c index d269821203fd..e8e211795e9f 100644 --- a/fs/ext3/namei.c +++ b/fs/ext3/namei.c | |||
@@ -921,9 +921,12 @@ restart: | |||
921 | num++; | 921 | num++; |
922 | bh = ext3_getblk(NULL, dir, b++, 0, &err); | 922 | bh = ext3_getblk(NULL, dir, b++, 0, &err); |
923 | bh_use[ra_max] = bh; | 923 | bh_use[ra_max] = bh; |
924 | if (bh) | 924 | if (bh && !bh_uptodate_or_lock(bh)) { |
925 | ll_rw_block(READ | REQ_META | REQ_PRIO, | 925 | get_bh(bh); |
926 | 1, &bh); | 926 | bh->b_end_io = end_buffer_read_sync; |
927 | submit_bh(READ | REQ_META | REQ_PRIO, | ||
928 | bh); | ||
929 | } | ||
927 | } | 930 | } |
928 | } | 931 | } |
929 | if ((bh = bh_use[ra_ptr++]) == NULL) | 932 | if ((bh = bh_use[ra_ptr++]) == NULL) |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 3a10b884e1be..726c7ef6cdf1 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -2059,9 +2059,10 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
2059 | EXT3_SB(sb)->s_mount_state |= EXT3_ORPHAN_FS; | 2059 | EXT3_SB(sb)->s_mount_state |= EXT3_ORPHAN_FS; |
2060 | ext3_orphan_cleanup(sb, es); | 2060 | ext3_orphan_cleanup(sb, es); |
2061 | EXT3_SB(sb)->s_mount_state &= ~EXT3_ORPHAN_FS; | 2061 | EXT3_SB(sb)->s_mount_state &= ~EXT3_ORPHAN_FS; |
2062 | if (needs_recovery) | 2062 | if (needs_recovery) { |
2063 | ext3_mark_recovery_complete(sb, es); | ||
2063 | ext3_msg(sb, KERN_INFO, "recovery complete"); | 2064 | ext3_msg(sb, KERN_INFO, "recovery complete"); |
2064 | ext3_mark_recovery_complete(sb, es); | 2065 | } |
2065 | ext3_msg(sb, KERN_INFO, "mounted filesystem with %s data mode", | 2066 | ext3_msg(sb, KERN_INFO, "mounted filesystem with %s data mode", |
2066 | test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA ? "journal": | 2067 | test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_JOURNAL_DATA ? "journal": |
2067 | test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA ? "ordered": | 2068 | test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA ? "ordered": |
@@ -2229,11 +2230,11 @@ static journal_t *ext3_get_dev_journal(struct super_block *sb, | |||
2229 | goto out_bdev; | 2230 | goto out_bdev; |
2230 | } | 2231 | } |
2231 | journal->j_private = sb; | 2232 | journal->j_private = sb; |
2232 | ll_rw_block(READ, 1, &journal->j_sb_buffer); | 2233 | if (!bh_uptodate_or_lock(journal->j_sb_buffer)) { |
2233 | wait_on_buffer(journal->j_sb_buffer); | 2234 | if (bh_submit_read(journal->j_sb_buffer)) { |
2234 | if (!buffer_uptodate(journal->j_sb_buffer)) { | 2235 | ext3_msg(sb, KERN_ERR, "I/O error on journal device"); |
2235 | ext3_msg(sb, KERN_ERR, "I/O error on journal device"); | 2236 | goto out_journal; |
2236 | goto out_journal; | 2237 | } |
2237 | } | 2238 | } |
2238 | if (be32_to_cpu(journal->j_superblock->s_nr_users) != 1) { | 2239 | if (be32_to_cpu(journal->j_superblock->s_nr_users) != 1) { |
2239 | ext3_msg(sb, KERN_ERR, | 2240 | ext3_msg(sb, KERN_ERR, |
diff --git a/fs/ext3/xattr_security.c b/fs/ext3/xattr_security.c index 3c218b8a51d4..ea26f2acab94 100644 --- a/fs/ext3/xattr_security.c +++ b/fs/ext3/xattr_security.c | |||
@@ -3,7 +3,6 @@ | |||
3 | * Handler for storing security labels as extended attributes. | 3 | * Handler for storing security labels as extended attributes. |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/module.h> | ||
7 | #include <linux/slab.h> | 6 | #include <linux/slab.h> |
8 | #include <linux/string.h> | 7 | #include <linux/string.h> |
9 | #include <linux/fs.h> | 8 | #include <linux/fs.h> |
diff --git a/fs/ext3/xattr_trusted.c b/fs/ext3/xattr_trusted.c index dc8edda9ffe0..2526a8829de8 100644 --- a/fs/ext3/xattr_trusted.c +++ b/fs/ext3/xattr_trusted.c | |||
@@ -5,7 +5,6 @@ | |||
5 | * Copyright (C) 2003 by Andreas Gruenbacher, <a.gruenbacher@computer.org> | 5 | * Copyright (C) 2003 by Andreas Gruenbacher, <a.gruenbacher@computer.org> |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <linux/module.h> | ||
9 | #include <linux/string.h> | 8 | #include <linux/string.h> |
10 | #include <linux/capability.h> | 9 | #include <linux/capability.h> |
11 | #include <linux/fs.h> | 10 | #include <linux/fs.h> |
diff --git a/fs/ext3/xattr_user.c b/fs/ext3/xattr_user.c index 7a321974d584..b32e473a1e33 100644 --- a/fs/ext3/xattr_user.c +++ b/fs/ext3/xattr_user.c | |||
@@ -5,7 +5,6 @@ | |||
5 | * Copyright (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org> | 5 | * Copyright (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org> |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <linux/module.h> | ||
9 | #include <linux/string.h> | 8 | #include <linux/string.h> |
10 | #include <linux/fs.h> | 9 | #include <linux/fs.h> |
11 | #include <linux/ext3_jbd.h> | 10 | #include <linux/ext3_jbd.h> |
diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c index 8efb2f0a3447..3f11656bd72e 100644 --- a/fs/ext4/block_validity.c +++ b/fs/ext4/block_validity.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <linux/namei.h> | 13 | #include <linux/namei.h> |
14 | #include <linux/quotaops.h> | 14 | #include <linux/quotaops.h> |
15 | #include <linux/buffer_head.h> | 15 | #include <linux/buffer_head.h> |
16 | #include <linux/module.h> | ||
17 | #include <linux/swap.h> | 16 | #include <linux/swap.h> |
18 | #include <linux/pagemap.h> | 17 | #include <linux/pagemap.h> |
19 | #include <linux/blkdev.h> | 18 | #include <linux/blkdev.h> |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 607b1557d292..841faf5fb785 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -29,7 +29,6 @@ | |||
29 | * - smart tree reduction | 29 | * - smart tree reduction |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include <linux/module.h> | ||
33 | #include <linux/fs.h> | 32 | #include <linux/fs.h> |
34 | #include <linux/time.h> | 33 | #include <linux/time.h> |
35 | #include <linux/jbd2.h> | 34 | #include <linux/jbd2.h> |
diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c index 3cfc73fbca8e..830e1b2bf145 100644 --- a/fs/ext4/indirect.c +++ b/fs/ext4/indirect.c | |||
@@ -20,7 +20,6 @@ | |||
20 | * (sct@redhat.com), 1993, 1998 | 20 | * (sct@redhat.com), 1993, 1998 |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <linux/module.h> | ||
24 | #include "ext4_jbd2.h" | 23 | #include "ext4_jbd2.h" |
25 | #include "truncate.h" | 24 | #include "truncate.h" |
26 | 25 | ||
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 7dbcc3e84570..aa8efa6572d6 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -18,7 +18,6 @@ | |||
18 | * Assorted race fixes, rewrite of ext4_get_block() by Al Viro, 2000 | 18 | * Assorted race fixes, rewrite of ext4_get_block() by Al Viro, 2000 |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/module.h> | ||
22 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
23 | #include <linux/time.h> | 22 | #include <linux/time.h> |
24 | #include <linux/jbd2.h> | 23 | #include <linux/jbd2.h> |
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index d37b3bb2a3b8..e87a932b073b 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c | |||
@@ -158,10 +158,11 @@ flags_out: | |||
158 | goto setversion_out; | 158 | goto setversion_out; |
159 | } | 159 | } |
160 | 160 | ||
161 | mutex_lock(&inode->i_mutex); | ||
161 | handle = ext4_journal_start(inode, 1); | 162 | handle = ext4_journal_start(inode, 1); |
162 | if (IS_ERR(handle)) { | 163 | if (IS_ERR(handle)) { |
163 | err = PTR_ERR(handle); | 164 | err = PTR_ERR(handle); |
164 | goto setversion_out; | 165 | goto unlock_out; |
165 | } | 166 | } |
166 | err = ext4_reserve_inode_write(handle, inode, &iloc); | 167 | err = ext4_reserve_inode_write(handle, inode, &iloc); |
167 | if (err == 0) { | 168 | if (err == 0) { |
@@ -170,6 +171,9 @@ flags_out: | |||
170 | err = ext4_mark_iloc_dirty(handle, inode, &iloc); | 171 | err = ext4_mark_iloc_dirty(handle, inode, &iloc); |
171 | } | 172 | } |
172 | ext4_journal_stop(handle); | 173 | ext4_journal_stop(handle); |
174 | |||
175 | unlock_out: | ||
176 | mutex_unlock(&inode->i_mutex); | ||
173 | setversion_out: | 177 | setversion_out: |
174 | mnt_drop_write_file(filp); | 178 | mnt_drop_write_file(filp); |
175 | return err; | 179 | return err; |
diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c index 16ac228dbec6..e7d6bb0acfa6 100644 --- a/fs/ext4/migrate.c +++ b/fs/ext4/migrate.c | |||
@@ -12,7 +12,6 @@ | |||
12 | * | 12 | * |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/module.h> | ||
16 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
17 | #include "ext4_jbd2.h" | 16 | #include "ext4_jbd2.h" |
18 | 17 | ||
diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c index 7e106c810c62..475851896518 100644 --- a/fs/ext4/page-io.c +++ b/fs/ext4/page-io.c | |||
@@ -6,7 +6,6 @@ | |||
6 | * Written by Theodore Ts'o, 2010. | 6 | * Written by Theodore Ts'o, 2010. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/module.h> | ||
10 | #include <linux/fs.h> | 9 | #include <linux/fs.h> |
11 | #include <linux/time.h> | 10 | #include <linux/time.h> |
12 | #include <linux/jbd2.h> | 11 | #include <linux/jbd2.h> |
diff --git a/fs/ext4/xattr_security.c b/fs/ext4/xattr_security.c index 34e4350dd4d9..b60f9f81e33c 100644 --- a/fs/ext4/xattr_security.c +++ b/fs/ext4/xattr_security.c | |||
@@ -3,7 +3,6 @@ | |||
3 | * Handler for storing security labels as extended attributes. | 3 | * Handler for storing security labels as extended attributes. |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <linux/module.h> | ||
7 | #include <linux/string.h> | 6 | #include <linux/string.h> |
8 | #include <linux/fs.h> | 7 | #include <linux/fs.h> |
9 | #include <linux/security.h> | 8 | #include <linux/security.h> |
diff --git a/fs/ext4/xattr_trusted.c b/fs/ext4/xattr_trusted.c index 37e6ebca2cc3..95f1f4ab59a4 100644 --- a/fs/ext4/xattr_trusted.c +++ b/fs/ext4/xattr_trusted.c | |||
@@ -5,7 +5,6 @@ | |||
5 | * Copyright (C) 2003 by Andreas Gruenbacher, <a.gruenbacher@computer.org> | 5 | * Copyright (C) 2003 by Andreas Gruenbacher, <a.gruenbacher@computer.org> |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <linux/module.h> | ||
9 | #include <linux/string.h> | 8 | #include <linux/string.h> |
10 | #include <linux/capability.h> | 9 | #include <linux/capability.h> |
11 | #include <linux/fs.h> | 10 | #include <linux/fs.h> |
diff --git a/fs/ext4/xattr_user.c b/fs/ext4/xattr_user.c index 98c375352d0e..0edb7611ffbe 100644 --- a/fs/ext4/xattr_user.c +++ b/fs/ext4/xattr_user.c | |||
@@ -5,7 +5,6 @@ | |||
5 | * Copyright (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org> | 5 | * Copyright (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org> |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <linux/module.h> | ||
9 | #include <linux/string.h> | 8 | #include <linux/string.h> |
10 | #include <linux/fs.h> | 9 | #include <linux/fs.h> |
11 | #include "ext4_jbd2.h" | 10 | #include "ext4_jbd2.h" |
diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c index 8799207df058..f2b9a571f4cf 100644 --- a/fs/jbd/commit.c +++ b/fs/jbd/commit.c | |||
@@ -392,6 +392,12 @@ void journal_commit_transaction(journal_t *journal) | |||
392 | jbd_debug (3, "JBD: commit phase 1\n"); | 392 | jbd_debug (3, "JBD: commit phase 1\n"); |
393 | 393 | ||
394 | /* | 394 | /* |
395 | * Clear revoked flag to reflect there is no revoked buffers | ||
396 | * in the next transaction which is going to be started. | ||
397 | */ | ||
398 | journal_clear_buffer_revoked_flags(journal); | ||
399 | |||
400 | /* | ||
395 | * Switch to a new revoke table. | 401 | * Switch to a new revoke table. |
396 | */ | 402 | */ |
397 | journal_switch_revoke_table(journal); | 403 | journal_switch_revoke_table(journal); |
diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c index a96cff0c5f1d..59c09f9541b5 100644 --- a/fs/jbd/journal.c +++ b/fs/jbd/journal.c | |||
@@ -721,7 +721,6 @@ static journal_t * journal_init_common (void) | |||
721 | init_waitqueue_head(&journal->j_wait_checkpoint); | 721 | init_waitqueue_head(&journal->j_wait_checkpoint); |
722 | init_waitqueue_head(&journal->j_wait_commit); | 722 | init_waitqueue_head(&journal->j_wait_commit); |
723 | init_waitqueue_head(&journal->j_wait_updates); | 723 | init_waitqueue_head(&journal->j_wait_updates); |
724 | mutex_init(&journal->j_barrier); | ||
725 | mutex_init(&journal->j_checkpoint_mutex); | 724 | mutex_init(&journal->j_checkpoint_mutex); |
726 | spin_lock_init(&journal->j_revoke_lock); | 725 | spin_lock_init(&journal->j_revoke_lock); |
727 | spin_lock_init(&journal->j_list_lock); | 726 | spin_lock_init(&journal->j_list_lock); |
diff --git a/fs/jbd/revoke.c b/fs/jbd/revoke.c index 305a90763154..25c713e7071c 100644 --- a/fs/jbd/revoke.c +++ b/fs/jbd/revoke.c | |||
@@ -47,6 +47,10 @@ | |||
47 | * overwriting the new data. We don't even need to clear the revoke | 47 | * overwriting the new data. We don't even need to clear the revoke |
48 | * bit here. | 48 | * bit here. |
49 | * | 49 | * |
50 | * We cache revoke status of a buffer in the current transaction in b_states | ||
51 | * bits. As the name says, revokevalid flag indicates that the cached revoke | ||
52 | * status of a buffer is valid and we can rely on the cached status. | ||
53 | * | ||
50 | * Revoke information on buffers is a tri-state value: | 54 | * Revoke information on buffers is a tri-state value: |
51 | * | 55 | * |
52 | * RevokeValid clear: no cached revoke status, need to look it up | 56 | * RevokeValid clear: no cached revoke status, need to look it up |
@@ -479,6 +483,36 @@ int journal_cancel_revoke(handle_t *handle, struct journal_head *jh) | |||
479 | return did_revoke; | 483 | return did_revoke; |
480 | } | 484 | } |
481 | 485 | ||
486 | /* | ||
487 | * journal_clear_revoked_flags clears revoked flag of buffers in | ||
488 | * revoke table to reflect there is no revoked buffer in the next | ||
489 | * transaction which is going to be started. | ||
490 | */ | ||
491 | void journal_clear_buffer_revoked_flags(journal_t *journal) | ||
492 | { | ||
493 | struct jbd_revoke_table_s *revoke = journal->j_revoke; | ||
494 | int i = 0; | ||
495 | |||
496 | for (i = 0; i < revoke->hash_size; i++) { | ||
497 | struct list_head *hash_list; | ||
498 | struct list_head *list_entry; | ||
499 | hash_list = &revoke->hash_table[i]; | ||
500 | |||
501 | list_for_each(list_entry, hash_list) { | ||
502 | struct jbd_revoke_record_s *record; | ||
503 | struct buffer_head *bh; | ||
504 | record = (struct jbd_revoke_record_s *)list_entry; | ||
505 | bh = __find_get_block(journal->j_fs_dev, | ||
506 | record->blocknr, | ||
507 | journal->j_blocksize); | ||
508 | if (bh) { | ||
509 | clear_buffer_revoked(bh); | ||
510 | __brelse(bh); | ||
511 | } | ||
512 | } | ||
513 | } | ||
514 | } | ||
515 | |||
482 | /* journal_switch_revoke table select j_revoke for next transaction | 516 | /* journal_switch_revoke table select j_revoke for next transaction |
483 | * we do not want to suspend any processing until all revokes are | 517 | * we do not want to suspend any processing until all revokes are |
484 | * written -bzzz | 518 | * written -bzzz |
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c index 7e59c6e66f9b..7fce94b04bc3 100644 --- a/fs/jbd/transaction.c +++ b/fs/jbd/transaction.c | |||
@@ -426,17 +426,34 @@ int journal_restart(handle_t *handle, int nblocks) | |||
426 | * void journal_lock_updates () - establish a transaction barrier. | 426 | * void journal_lock_updates () - establish a transaction barrier. |
427 | * @journal: Journal to establish a barrier on. | 427 | * @journal: Journal to establish a barrier on. |
428 | * | 428 | * |
429 | * This locks out any further updates from being started, and blocks | 429 | * This locks out any further updates from being started, and blocks until all |
430 | * until all existing updates have completed, returning only once the | 430 | * existing updates have completed, returning only once the journal is in a |
431 | * journal is in a quiescent state with no updates running. | 431 | * quiescent state with no updates running. |
432 | * | 432 | * |
433 | * The journal lock should not be held on entry. | 433 | * We do not use simple mutex for synchronization as there are syscalls which |
434 | * want to return with filesystem locked and that trips up lockdep. Also | ||
435 | * hibernate needs to lock filesystem but locked mutex then blocks hibernation. | ||
436 | * Since locking filesystem is rare operation, we use simple counter and | ||
437 | * waitqueue for locking. | ||
434 | */ | 438 | */ |
435 | void journal_lock_updates(journal_t *journal) | 439 | void journal_lock_updates(journal_t *journal) |
436 | { | 440 | { |
437 | DEFINE_WAIT(wait); | 441 | DEFINE_WAIT(wait); |
438 | 442 | ||
443 | wait: | ||
444 | /* Wait for previous locked operation to finish */ | ||
445 | wait_event(journal->j_wait_transaction_locked, | ||
446 | journal->j_barrier_count == 0); | ||
447 | |||
439 | spin_lock(&journal->j_state_lock); | 448 | spin_lock(&journal->j_state_lock); |
449 | /* | ||
450 | * Check reliably under the lock whether we are the ones winning the race | ||
451 | * and locking the journal | ||
452 | */ | ||
453 | if (journal->j_barrier_count > 0) { | ||
454 | spin_unlock(&journal->j_state_lock); | ||
455 | goto wait; | ||
456 | } | ||
440 | ++journal->j_barrier_count; | 457 | ++journal->j_barrier_count; |
441 | 458 | ||
442 | /* Wait until there are no running updates */ | 459 | /* Wait until there are no running updates */ |
@@ -460,14 +477,6 @@ void journal_lock_updates(journal_t *journal) | |||
460 | spin_lock(&journal->j_state_lock); | 477 | spin_lock(&journal->j_state_lock); |
461 | } | 478 | } |
462 | spin_unlock(&journal->j_state_lock); | 479 | spin_unlock(&journal->j_state_lock); |
463 | |||
464 | /* | ||
465 | * We have now established a barrier against other normal updates, but | ||
466 | * we also need to barrier against other journal_lock_updates() calls | ||
467 | * to make sure that we serialise special journal-locked operations | ||
468 | * too. | ||
469 | */ | ||
470 | mutex_lock(&journal->j_barrier); | ||
471 | } | 480 | } |
472 | 481 | ||
473 | /** | 482 | /** |
@@ -475,14 +484,11 @@ void journal_lock_updates(journal_t *journal) | |||
475 | * @journal: Journal to release the barrier on. | 484 | * @journal: Journal to release the barrier on. |
476 | * | 485 | * |
477 | * Release a transaction barrier obtained with journal_lock_updates(). | 486 | * Release a transaction barrier obtained with journal_lock_updates(). |
478 | * | ||
479 | * Should be called without the journal lock held. | ||
480 | */ | 487 | */ |
481 | void journal_unlock_updates (journal_t *journal) | 488 | void journal_unlock_updates (journal_t *journal) |
482 | { | 489 | { |
483 | J_ASSERT(journal->j_barrier_count != 0); | 490 | J_ASSERT(journal->j_barrier_count != 0); |
484 | 491 | ||
485 | mutex_unlock(&journal->j_barrier); | ||
486 | spin_lock(&journal->j_state_lock); | 492 | spin_lock(&journal->j_state_lock); |
487 | --journal->j_barrier_count; | 493 | --journal->j_barrier_count; |
488 | spin_unlock(&journal->j_state_lock); | 494 | spin_unlock(&journal->j_state_lock); |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 19c454e61b79..1d42e707d5fa 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -455,16 +455,20 @@ int remove_save_link(struct inode *inode, int truncate) | |||
455 | static void reiserfs_kill_sb(struct super_block *s) | 455 | static void reiserfs_kill_sb(struct super_block *s) |
456 | { | 456 | { |
457 | if (REISERFS_SB(s)) { | 457 | if (REISERFS_SB(s)) { |
458 | if (REISERFS_SB(s)->xattr_root) { | 458 | /* |
459 | d_invalidate(REISERFS_SB(s)->xattr_root); | 459 | * Force any pending inode evictions to occur now. Any |
460 | dput(REISERFS_SB(s)->xattr_root); | 460 | * inodes to be removed that have extended attributes |
461 | REISERFS_SB(s)->xattr_root = NULL; | 461 | * associated with them need to clean them up before |
462 | } | 462 | * we can release the extended attribute root dentries. |
463 | if (REISERFS_SB(s)->priv_root) { | 463 | * shrink_dcache_for_umount will BUG if we don't release |
464 | d_invalidate(REISERFS_SB(s)->priv_root); | 464 | * those before it's called so ->put_super is too late. |
465 | dput(REISERFS_SB(s)->priv_root); | 465 | */ |
466 | REISERFS_SB(s)->priv_root = NULL; | 466 | shrink_dcache_sb(s); |
467 | } | 467 | |
468 | dput(REISERFS_SB(s)->xattr_root); | ||
469 | REISERFS_SB(s)->xattr_root = NULL; | ||
470 | dput(REISERFS_SB(s)->priv_root); | ||
471 | REISERFS_SB(s)->priv_root = NULL; | ||
468 | } | 472 | } |
469 | 473 | ||
470 | kill_block_super(s); | 474 | kill_block_super(s); |
@@ -1249,7 +1253,8 @@ static void handle_quota_files(struct super_block *s, char **qf_names, | |||
1249 | kfree(REISERFS_SB(s)->s_qf_names[i]); | 1253 | kfree(REISERFS_SB(s)->s_qf_names[i]); |
1250 | REISERFS_SB(s)->s_qf_names[i] = qf_names[i]; | 1254 | REISERFS_SB(s)->s_qf_names[i] = qf_names[i]; |
1251 | } | 1255 | } |
1252 | REISERFS_SB(s)->s_jquota_fmt = *qfmt; | 1256 | if (*qfmt) |
1257 | REISERFS_SB(s)->s_jquota_fmt = *qfmt; | ||
1253 | } | 1258 | } |
1254 | #endif | 1259 | #endif |
1255 | 1260 | ||
diff --git a/fs/udf/file.c b/fs/udf/file.c index d8ffa7cc661d..dca0c3881e82 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c | |||
@@ -125,7 +125,6 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
125 | err = udf_expand_file_adinicb(inode); | 125 | err = udf_expand_file_adinicb(inode); |
126 | if (err) { | 126 | if (err) { |
127 | udf_debug("udf_expand_adinicb: err=%d\n", err); | 127 | udf_debug("udf_expand_adinicb: err=%d\n", err); |
128 | up_write(&iinfo->i_data_sem); | ||
129 | return err; | 128 | return err; |
130 | } | 129 | } |
131 | } else { | 130 | } else { |
@@ -133,9 +132,10 @@ static ssize_t udf_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
133 | iinfo->i_lenAlloc = pos + count; | 132 | iinfo->i_lenAlloc = pos + count; |
134 | else | 133 | else |
135 | iinfo->i_lenAlloc = inode->i_size; | 134 | iinfo->i_lenAlloc = inode->i_size; |
135 | up_write(&iinfo->i_data_sem); | ||
136 | } | 136 | } |
137 | } | 137 | } else |
138 | up_write(&iinfo->i_data_sem); | 138 | up_write(&iinfo->i_data_sem); |
139 | 139 | ||
140 | retval = generic_file_aio_write(iocb, iov, nr_segs, ppos); | 140 | retval = generic_file_aio_write(iocb, iov, nr_segs, ppos); |
141 | if (retval > 0) | 141 | if (retval > 0) |
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index 4598904be1bb..7699df7b3198 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
@@ -53,8 +53,7 @@ static int udf_update_inode(struct inode *, int); | |||
53 | static void udf_fill_inode(struct inode *, struct buffer_head *); | 53 | static void udf_fill_inode(struct inode *, struct buffer_head *); |
54 | static int udf_sync_inode(struct inode *inode); | 54 | static int udf_sync_inode(struct inode *inode); |
55 | static int udf_alloc_i_data(struct inode *inode, size_t size); | 55 | static int udf_alloc_i_data(struct inode *inode, size_t size); |
56 | static struct buffer_head *inode_getblk(struct inode *, sector_t, int *, | 56 | static sector_t inode_getblk(struct inode *, sector_t, int *, int *); |
57 | sector_t *, int *); | ||
58 | static int8_t udf_insert_aext(struct inode *, struct extent_position, | 57 | static int8_t udf_insert_aext(struct inode *, struct extent_position, |
59 | struct kernel_lb_addr, uint32_t); | 58 | struct kernel_lb_addr, uint32_t); |
60 | static void udf_split_extents(struct inode *, int *, int, int, | 59 | static void udf_split_extents(struct inode *, int *, int, int, |
@@ -151,6 +150,12 @@ const struct address_space_operations udf_aops = { | |||
151 | .bmap = udf_bmap, | 150 | .bmap = udf_bmap, |
152 | }; | 151 | }; |
153 | 152 | ||
153 | /* | ||
154 | * Expand file stored in ICB to a normal one-block-file | ||
155 | * | ||
156 | * This function requires i_data_sem for writing and releases it. | ||
157 | * This function requires i_mutex held | ||
158 | */ | ||
154 | int udf_expand_file_adinicb(struct inode *inode) | 159 | int udf_expand_file_adinicb(struct inode *inode) |
155 | { | 160 | { |
156 | struct page *page; | 161 | struct page *page; |
@@ -169,9 +174,15 @@ int udf_expand_file_adinicb(struct inode *inode) | |||
169 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG; | 174 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG; |
170 | /* from now on we have normal address_space methods */ | 175 | /* from now on we have normal address_space methods */ |
171 | inode->i_data.a_ops = &udf_aops; | 176 | inode->i_data.a_ops = &udf_aops; |
177 | up_write(&iinfo->i_data_sem); | ||
172 | mark_inode_dirty(inode); | 178 | mark_inode_dirty(inode); |
173 | return 0; | 179 | return 0; |
174 | } | 180 | } |
181 | /* | ||
182 | * Release i_data_sem so that we can lock a page - page lock ranks | ||
183 | * above i_data_sem. i_mutex still protects us against file changes. | ||
184 | */ | ||
185 | up_write(&iinfo->i_data_sem); | ||
175 | 186 | ||
176 | page = find_or_create_page(inode->i_mapping, 0, GFP_NOFS); | 187 | page = find_or_create_page(inode->i_mapping, 0, GFP_NOFS); |
177 | if (!page) | 188 | if (!page) |
@@ -187,6 +198,7 @@ int udf_expand_file_adinicb(struct inode *inode) | |||
187 | SetPageUptodate(page); | 198 | SetPageUptodate(page); |
188 | kunmap(page); | 199 | kunmap(page); |
189 | } | 200 | } |
201 | down_write(&iinfo->i_data_sem); | ||
190 | memset(iinfo->i_ext.i_data + iinfo->i_lenEAttr, 0x00, | 202 | memset(iinfo->i_ext.i_data + iinfo->i_lenEAttr, 0x00, |
191 | iinfo->i_lenAlloc); | 203 | iinfo->i_lenAlloc); |
192 | iinfo->i_lenAlloc = 0; | 204 | iinfo->i_lenAlloc = 0; |
@@ -196,17 +208,20 @@ int udf_expand_file_adinicb(struct inode *inode) | |||
196 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG; | 208 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG; |
197 | /* from now on we have normal address_space methods */ | 209 | /* from now on we have normal address_space methods */ |
198 | inode->i_data.a_ops = &udf_aops; | 210 | inode->i_data.a_ops = &udf_aops; |
211 | up_write(&iinfo->i_data_sem); | ||
199 | err = inode->i_data.a_ops->writepage(page, &udf_wbc); | 212 | err = inode->i_data.a_ops->writepage(page, &udf_wbc); |
200 | if (err) { | 213 | if (err) { |
201 | /* Restore everything back so that we don't lose data... */ | 214 | /* Restore everything back so that we don't lose data... */ |
202 | lock_page(page); | 215 | lock_page(page); |
203 | kaddr = kmap(page); | 216 | kaddr = kmap(page); |
217 | down_write(&iinfo->i_data_sem); | ||
204 | memcpy(iinfo->i_ext.i_data + iinfo->i_lenEAttr, kaddr, | 218 | memcpy(iinfo->i_ext.i_data + iinfo->i_lenEAttr, kaddr, |
205 | inode->i_size); | 219 | inode->i_size); |
206 | kunmap(page); | 220 | kunmap(page); |
207 | unlock_page(page); | 221 | unlock_page(page); |
208 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB; | 222 | iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB; |
209 | inode->i_data.a_ops = &udf_adinicb_aops; | 223 | inode->i_data.a_ops = &udf_adinicb_aops; |
224 | up_write(&iinfo->i_data_sem); | ||
210 | } | 225 | } |
211 | page_cache_release(page); | 226 | page_cache_release(page); |
212 | mark_inode_dirty(inode); | 227 | mark_inode_dirty(inode); |
@@ -310,7 +325,6 @@ static int udf_get_block(struct inode *inode, sector_t block, | |||
310 | struct buffer_head *bh_result, int create) | 325 | struct buffer_head *bh_result, int create) |
311 | { | 326 | { |
312 | int err, new; | 327 | int err, new; |
313 | struct buffer_head *bh; | ||
314 | sector_t phys = 0; | 328 | sector_t phys = 0; |
315 | struct udf_inode_info *iinfo; | 329 | struct udf_inode_info *iinfo; |
316 | 330 | ||
@@ -323,7 +337,6 @@ static int udf_get_block(struct inode *inode, sector_t block, | |||
323 | 337 | ||
324 | err = -EIO; | 338 | err = -EIO; |
325 | new = 0; | 339 | new = 0; |
326 | bh = NULL; | ||
327 | iinfo = UDF_I(inode); | 340 | iinfo = UDF_I(inode); |
328 | 341 | ||
329 | down_write(&iinfo->i_data_sem); | 342 | down_write(&iinfo->i_data_sem); |
@@ -332,13 +345,10 @@ static int udf_get_block(struct inode *inode, sector_t block, | |||
332 | iinfo->i_next_alloc_goal++; | 345 | iinfo->i_next_alloc_goal++; |
333 | } | 346 | } |
334 | 347 | ||
335 | err = 0; | ||
336 | 348 | ||
337 | bh = inode_getblk(inode, block, &err, &phys, &new); | 349 | phys = inode_getblk(inode, block, &err, &new); |
338 | BUG_ON(bh); | 350 | if (!phys) |
339 | if (err) | ||
340 | goto abort; | 351 | goto abort; |
341 | BUG_ON(!phys); | ||
342 | 352 | ||
343 | if (new) | 353 | if (new) |
344 | set_buffer_new(bh_result); | 354 | set_buffer_new(bh_result); |
@@ -547,11 +557,10 @@ out: | |||
547 | return err; | 557 | return err; |
548 | } | 558 | } |
549 | 559 | ||
550 | static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, | 560 | static sector_t inode_getblk(struct inode *inode, sector_t block, |
551 | int *err, sector_t *phys, int *new) | 561 | int *err, int *new) |
552 | { | 562 | { |
553 | static sector_t last_block; | 563 | static sector_t last_block; |
554 | struct buffer_head *result = NULL; | ||
555 | struct kernel_long_ad laarr[EXTENT_MERGE_SIZE]; | 564 | struct kernel_long_ad laarr[EXTENT_MERGE_SIZE]; |
556 | struct extent_position prev_epos, cur_epos, next_epos; | 565 | struct extent_position prev_epos, cur_epos, next_epos; |
557 | int count = 0, startnum = 0, endnum = 0; | 566 | int count = 0, startnum = 0, endnum = 0; |
@@ -566,6 +575,8 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, | |||
566 | int goal = 0, pgoal = iinfo->i_location.logicalBlockNum; | 575 | int goal = 0, pgoal = iinfo->i_location.logicalBlockNum; |
567 | int lastblock = 0; | 576 | int lastblock = 0; |
568 | 577 | ||
578 | *err = 0; | ||
579 | *new = 0; | ||
569 | prev_epos.offset = udf_file_entry_alloc_offset(inode); | 580 | prev_epos.offset = udf_file_entry_alloc_offset(inode); |
570 | prev_epos.block = iinfo->i_location; | 581 | prev_epos.block = iinfo->i_location; |
571 | prev_epos.bh = NULL; | 582 | prev_epos.bh = NULL; |
@@ -635,8 +646,7 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, | |||
635 | brelse(cur_epos.bh); | 646 | brelse(cur_epos.bh); |
636 | brelse(next_epos.bh); | 647 | brelse(next_epos.bh); |
637 | newblock = udf_get_lb_pblock(inode->i_sb, &eloc, offset); | 648 | newblock = udf_get_lb_pblock(inode->i_sb, &eloc, offset); |
638 | *phys = newblock; | 649 | return newblock; |
639 | return NULL; | ||
640 | } | 650 | } |
641 | 651 | ||
642 | last_block = block; | 652 | last_block = block; |
@@ -664,7 +674,7 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, | |||
664 | brelse(cur_epos.bh); | 674 | brelse(cur_epos.bh); |
665 | brelse(next_epos.bh); | 675 | brelse(next_epos.bh); |
666 | *err = ret; | 676 | *err = ret; |
667 | return NULL; | 677 | return 0; |
668 | } | 678 | } |
669 | c = 0; | 679 | c = 0; |
670 | offset = 0; | 680 | offset = 0; |
@@ -729,7 +739,7 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, | |||
729 | if (!newblocknum) { | 739 | if (!newblocknum) { |
730 | brelse(prev_epos.bh); | 740 | brelse(prev_epos.bh); |
731 | *err = -ENOSPC; | 741 | *err = -ENOSPC; |
732 | return NULL; | 742 | return 0; |
733 | } | 743 | } |
734 | iinfo->i_lenExtents += inode->i_sb->s_blocksize; | 744 | iinfo->i_lenExtents += inode->i_sb->s_blocksize; |
735 | } | 745 | } |
@@ -761,10 +771,10 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, | |||
761 | 771 | ||
762 | newblock = udf_get_pblock(inode->i_sb, newblocknum, | 772 | newblock = udf_get_pblock(inode->i_sb, newblocknum, |
763 | iinfo->i_location.partitionReferenceNum, 0); | 773 | iinfo->i_location.partitionReferenceNum, 0); |
764 | if (!newblock) | 774 | if (!newblock) { |
765 | return NULL; | 775 | *err = -EIO; |
766 | *phys = newblock; | 776 | return 0; |
767 | *err = 0; | 777 | } |
768 | *new = 1; | 778 | *new = 1; |
769 | iinfo->i_next_alloc_block = block; | 779 | iinfo->i_next_alloc_block = block; |
770 | iinfo->i_next_alloc_goal = newblocknum; | 780 | iinfo->i_next_alloc_goal = newblocknum; |
@@ -775,7 +785,7 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, | |||
775 | else | 785 | else |
776 | mark_inode_dirty(inode); | 786 | mark_inode_dirty(inode); |
777 | 787 | ||
778 | return result; | 788 | return newblock; |
779 | } | 789 | } |
780 | 790 | ||
781 | static void udf_split_extents(struct inode *inode, int *c, int offset, | 791 | static void udf_split_extents(struct inode *inode, int *c, int offset, |
@@ -1111,10 +1121,9 @@ int udf_setsize(struct inode *inode, loff_t newsize) | |||
1111 | if (bsize < | 1121 | if (bsize < |
1112 | (udf_file_entry_alloc_offset(inode) + newsize)) { | 1122 | (udf_file_entry_alloc_offset(inode) + newsize)) { |
1113 | err = udf_expand_file_adinicb(inode); | 1123 | err = udf_expand_file_adinicb(inode); |
1114 | if (err) { | 1124 | if (err) |
1115 | up_write(&iinfo->i_data_sem); | ||
1116 | return err; | 1125 | return err; |
1117 | } | 1126 | down_write(&iinfo->i_data_sem); |
1118 | } else | 1127 | } else |
1119 | iinfo->i_lenAlloc = newsize; | 1128 | iinfo->i_lenAlloc = newsize; |
1120 | } | 1129 | } |
diff --git a/fs/udf/super.c b/fs/udf/super.c index 0c33225647a0..c09a84daaf50 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
@@ -1798,6 +1798,12 @@ static void udf_close_lvid(struct super_block *sb) | |||
1798 | le16_to_cpu(lvid->descTag.descCRCLength))); | 1798 | le16_to_cpu(lvid->descTag.descCRCLength))); |
1799 | 1799 | ||
1800 | lvid->descTag.tagChecksum = udf_tag_checksum(&lvid->descTag); | 1800 | lvid->descTag.tagChecksum = udf_tag_checksum(&lvid->descTag); |
1801 | /* | ||
1802 | * We set buffer uptodate unconditionally here to avoid spurious | ||
1803 | * warnings from mark_buffer_dirty() when previous EIO has marked | ||
1804 | * the buffer as !uptodate | ||
1805 | */ | ||
1806 | set_buffer_uptodate(bh); | ||
1801 | mark_buffer_dirty(bh); | 1807 | mark_buffer_dirty(bh); |
1802 | sbi->s_lvid_dirty = 0; | 1808 | sbi->s_lvid_dirty = 0; |
1803 | mutex_unlock(&sbi->s_alloc_mutex); | 1809 | mutex_unlock(&sbi->s_alloc_mutex); |
diff --git a/fs/udf/symlink.c b/fs/udf/symlink.c index b1d4488b0f14..d7c6dbe4194b 100644 --- a/fs/udf/symlink.c +++ b/fs/udf/symlink.c | |||
@@ -41,10 +41,16 @@ static void udf_pc_to_char(struct super_block *sb, unsigned char *from, | |||
41 | pc = (struct pathComponent *)(from + elen); | 41 | pc = (struct pathComponent *)(from + elen); |
42 | switch (pc->componentType) { | 42 | switch (pc->componentType) { |
43 | case 1: | 43 | case 1: |
44 | if (pc->lengthComponentIdent == 0) { | 44 | /* |
45 | p = to; | 45 | * Symlink points to some place which should be agreed |
46 | *p++ = '/'; | 46 | * upon between originator and receiver of the media. Ignore. |
47 | } | 47 | */ |
48 | if (pc->lengthComponentIdent > 0) | ||
49 | break; | ||
50 | /* Fall through */ | ||
51 | case 2: | ||
52 | p = to; | ||
53 | *p++ = '/'; | ||
48 | break; | 54 | break; |
49 | case 3: | 55 | case 3: |
50 | memcpy(p, "../", 3); | 56 | memcpy(p, "../", 3); |
diff --git a/include/linux/jbd.h b/include/linux/jbd.h index c7acdde3243d..d211732b9e99 100644 --- a/include/linux/jbd.h +++ b/include/linux/jbd.h | |||
@@ -497,7 +497,6 @@ struct transaction_s | |||
497 | * @j_format_version: Version of the superblock format | 497 | * @j_format_version: Version of the superblock format |
498 | * @j_state_lock: Protect the various scalars in the journal | 498 | * @j_state_lock: Protect the various scalars in the journal |
499 | * @j_barrier_count: Number of processes waiting to create a barrier lock | 499 | * @j_barrier_count: Number of processes waiting to create a barrier lock |
500 | * @j_barrier: The barrier lock itself | ||
501 | * @j_running_transaction: The current running transaction.. | 500 | * @j_running_transaction: The current running transaction.. |
502 | * @j_committing_transaction: the transaction we are pushing to disk | 501 | * @j_committing_transaction: the transaction we are pushing to disk |
503 | * @j_checkpoint_transactions: a linked circular list of all transactions | 502 | * @j_checkpoint_transactions: a linked circular list of all transactions |
@@ -580,9 +579,6 @@ struct journal_s | |||
580 | */ | 579 | */ |
581 | int j_barrier_count; | 580 | int j_barrier_count; |
582 | 581 | ||
583 | /* The barrier lock itself */ | ||
584 | struct mutex j_barrier; | ||
585 | |||
586 | /* | 582 | /* |
587 | * Transactions: The current running transaction... | 583 | * Transactions: The current running transaction... |
588 | * [j_state_lock] [caller holding open handle] | 584 | * [j_state_lock] [caller holding open handle] |
@@ -913,6 +909,7 @@ extern int journal_set_revoke(journal_t *, unsigned int, tid_t); | |||
913 | extern int journal_test_revoke(journal_t *, unsigned int, tid_t); | 909 | extern int journal_test_revoke(journal_t *, unsigned int, tid_t); |
914 | extern void journal_clear_revoke(journal_t *); | 910 | extern void journal_clear_revoke(journal_t *); |
915 | extern void journal_switch_revoke_table(journal_t *journal); | 911 | extern void journal_switch_revoke_table(journal_t *journal); |
912 | extern void journal_clear_buffer_revoked_flags(journal_t *journal); | ||
916 | 913 | ||
917 | /* | 914 | /* |
918 | * The log thread user interface: | 915 | * The log thread user interface: |