aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Fasheh <mfasheh@suse.com>2008-11-21 17:06:55 -0500
committerMark Fasheh <mfasheh@suse.com>2008-12-01 17:46:58 -0500
commitd6b58f89f7257c8099c2260e2bea042a917d6cdf (patch)
tree0dea65bf25647146c6d4b5dcf022f20b0fdb4006
parent07d9a3954a68764aefe16855bcd0f86deeb5c825 (diff)
ocfs2: fix regression in ocfs2_read_blocks_sync()
We're panicing in ocfs2_read_blocks_sync() if a jbd-managed buffer is seen. At first glance, this seems ok but in reality it can happen. My test case was to just run 'exorcist'. A struct inode is being pushed out of memory but is then re-read at a later time, before the buffer has been checkpointed by jbd. This causes a BUG to be hit in ocfs2_read_blocks_sync(). Reviewed-by: Joel Becker <joel.becker@oracle.com> Signed-off-by: Mark Fasheh <mfasheh@suse.com>
-rw-r--r--fs/ocfs2/buffer_head_io.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/fs/ocfs2/buffer_head_io.c b/fs/ocfs2/buffer_head_io.c
index 7e947c672469..3a178ec48d7c 100644
--- a/fs/ocfs2/buffer_head_io.c
+++ b/fs/ocfs2/buffer_head_io.c
@@ -112,7 +112,7 @@ int ocfs2_read_blocks_sync(struct ocfs2_super *osb, u64 block,
112 bh = bhs[i]; 112 bh = bhs[i];
113 113
114 if (buffer_jbd(bh)) { 114 if (buffer_jbd(bh)) {
115 mlog(ML_ERROR, 115 mlog(ML_BH_IO,
116 "trying to sync read a jbd " 116 "trying to sync read a jbd "
117 "managed bh (blocknr = %llu), skipping\n", 117 "managed bh (blocknr = %llu), skipping\n",
118 (unsigned long long)bh->b_blocknr); 118 (unsigned long long)bh->b_blocknr);
@@ -147,15 +147,10 @@ int ocfs2_read_blocks_sync(struct ocfs2_super *osb, u64 block,
147 for (i = nr; i > 0; i--) { 147 for (i = nr; i > 0; i--) {
148 bh = bhs[i - 1]; 148 bh = bhs[i - 1];
149 149
150 if (buffer_jbd(bh)) { 150 /* No need to wait on the buffer if it's managed by JBD. */
151 mlog(ML_ERROR, 151 if (!buffer_jbd(bh))
152 "the journal got the buffer while it was " 152 wait_on_buffer(bh);
153 "locked for io! (blocknr = %llu)\n",
154 (unsigned long long)bh->b_blocknr);
155 BUG();
156 }
157 153
158 wait_on_buffer(bh);
159 if (!buffer_uptodate(bh)) { 154 if (!buffer_uptodate(bh)) {
160 /* Status won't be cleared from here on out, 155 /* Status won't be cleared from here on out,
161 * so we can safely record this and loop back 156 * so we can safely record this and loop back
@@ -251,8 +246,6 @@ int ocfs2_read_blocks(struct inode *inode, u64 block, int nr,
251 ignore_cache = 1; 246 ignore_cache = 1;
252 } 247 }
253 248
254 /* XXX: Can we ever get this and *not* have the cached
255 * flag set? */
256 if (buffer_jbd(bh)) { 249 if (buffer_jbd(bh)) {
257 if (ignore_cache) 250 if (ignore_cache)
258 mlog(ML_BH_IO, "trying to sync read a jbd " 251 mlog(ML_BH_IO, "trying to sync read a jbd "