]>
Commit | Line | Data |
---|---|---|
00e5a55c BS |
1 | From: Mark Fasheh <mfasheh@suse.com> |
2 | Date: Fri, 21 Nov 2008 14:06:55 -0800 | |
3 | Subject: ocfs2: fix regression in ocfs2_read_blocks_sync() | |
4 | ||
5 | We're panicing in ocfs2_read_blocks_sync() if a jbd-managed buffer is seen. | |
6 | At first glance, this seems ok but in reality it can happen. My test case | |
7 | was to just run 'exorcist'. A struct inode is being pushed out of memory but | |
8 | is then re-read at a later time, before the buffer has been checkpointed by | |
9 | jbd. This causes a BUG to be hit in ocfs2_read_blocks_sync(). | |
10 | ||
11 | Reviewed-by: Joel Becker <joel.becker@oracle.com> | |
12 | Signed-off-by: Mark Fasheh <mfasheh@suse.com> | |
13 | --- | |
14 | fs/ocfs2/buffer_head_io.c | 15 ++++----------- | |
15 | 1 files changed, 4 insertions(+), 11 deletions(-) | |
16 | ||
17 | Index: linux-2.6.27-ocfs2/fs/ocfs2/buffer_head_io.c | |
18 | =================================================================== | |
19 | --- linux-2.6.27-ocfs2.orig/fs/ocfs2/buffer_head_io.c | |
20 | +++ linux-2.6.27-ocfs2/fs/ocfs2/buffer_head_io.c | |
21 | @@ -112,7 +112,7 @@ int ocfs2_read_blocks_sync(struct ocfs2_ | |
22 | bh = bhs[i]; | |
23 | ||
24 | if (buffer_jbd(bh)) { | |
25 | - mlog(ML_ERROR, | |
26 | + mlog(ML_BH_IO, | |
27 | "trying to sync read a jbd " | |
28 | "managed bh (blocknr = %llu), skipping\n", | |
29 | (unsigned long long)bh->b_blocknr); | |
30 | @@ -147,15 +147,10 @@ int ocfs2_read_blocks_sync(struct ocfs2_ | |
31 | for (i = nr; i > 0; i--) { | |
32 | bh = bhs[i - 1]; | |
33 | ||
34 | - if (buffer_jbd(bh)) { | |
35 | - mlog(ML_ERROR, | |
36 | - "the journal got the buffer while it was " | |
37 | - "locked for io! (blocknr = %llu)\n", | |
38 | - (unsigned long long)bh->b_blocknr); | |
39 | - BUG(); | |
40 | - } | |
41 | + /* No need to wait on the buffer if it's managed by JBD. */ | |
42 | + if (!buffer_jbd(bh)) | |
43 | + wait_on_buffer(bh); | |
44 | ||
45 | - wait_on_buffer(bh); | |
46 | if (!buffer_uptodate(bh)) { | |
47 | /* Status won't be cleared from here on out, | |
48 | * so we can safely record this and loop back | |
49 | @@ -251,8 +246,6 @@ int ocfs2_read_blocks(struct inode *inod | |
50 | ignore_cache = 1; | |
51 | } | |
52 | ||
53 | - /* XXX: Can we ever get this and *not* have the cached | |
54 | - * flag set? */ | |
55 | if (buffer_jbd(bh)) { | |
56 | if (ignore_cache) | |
57 | mlog(ML_BH_IO, "trying to sync read a jbd " |