aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext3/inode.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-01-09 15:51:21 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-01-09 15:51:21 -0500
commitac69e0928054ff29a5049902fb477f9c7605c773 (patch)
tree05be6b9285186823452e0adeffe40e1dfee6e354 /fs/ext3/inode.c
parent9e203936eac786f9268d6a13e6442d2accef1829 (diff)
parent302bf2f3259948c93361d501b04a5ed69c3bd4f8 (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/inode.c')
-rw-r--r--fs/ext3/inode.c43
1 files changed, 32 insertions, 11 deletions
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