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 /fs/ext3 | |
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
Diffstat (limited to 'fs/ext3')
-rw-r--r-- | fs/ext3/ialloc.c | 8 | ||||
-rw-r--r-- | fs/ext3/inode.c | 43 | ||||
-rw-r--r-- | fs/ext3/ioctl.c | 6 | ||||
-rw-r--r-- | fs/ext3/namei.c | 9 | ||||
-rw-r--r-- | fs/ext3/super.c | 15 | ||||
-rw-r--r-- | fs/ext3/xattr_security.c | 1 | ||||
-rw-r--r-- | fs/ext3/xattr_trusted.c | 1 | ||||
-rw-r--r-- | fs/ext3/xattr_user.c | 1 |
8 files changed, 57 insertions, 27 deletions
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> |