]>
Commit | Line | Data |
---|---|---|
2cb7cef9 BS |
1 | From: Jeff Mahoney <jeffm@suse.com> |
2 | Subject: [PATCH] ext3: always mark super uptodate before dirty | |
3 | References: bnc#457043 | |
4 | ||
5 | The superblock's bh is something of an exception. It is only read | |
6 | during mount and is only released during unmount. The in-memory | |
7 | copy is invariably the most recent one. | |
8 | ||
9 | If a write error occurs while syncing the superblock, it will be marked | |
10 | !uptodate. When another error occurs, ext3_error will invoke | |
11 | ext3_commit_super, which will mark the superblock dirty and try to | |
12 | sync it out again. If the buffer is !uptodate, then mark_buffer_dirty | |
13 | will issue a warning, but continue anyway. | |
14 | ||
15 | This patch marks it uptodate before writing it out. This doesn't really | |
16 | change anything other than silencing the warning in mark_buffer_dirty. | |
17 | If the write succeeds, good. Otherwise, it will just have uptodate | |
18 | cleared again. | |
19 | ||
20 | Signed-off-by: Jeff Mahoney <jeffm@suse.com> | |
21 | --- | |
22 | fs/ext3/super.c | 7 +++++++ | |
23 | 1 file changed, 7 insertions(+) | |
24 | ||
25 | --- a/fs/ext3/super.c | |
26 | +++ b/fs/ext3/super.c | |
27 | @@ -2265,6 +2265,13 @@ static void ext3_commit_super (struct su | |
28 | es->s_free_blocks_count = cpu_to_le32(ext3_count_free_blocks(sb)); | |
29 | es->s_free_inodes_count = cpu_to_le32(ext3_count_free_inodes(sb)); | |
30 | BUFFER_TRACE(sbh, "marking dirty"); | |
31 | + | |
32 | + /* We only read the superblock once. The in-memory version is | |
33 | + * always the most recent. If ext3_error is called after a | |
34 | + * superblock write failure, it will be !uptodate. This write | |
35 | + * will likely fail also, but it avoids the WARN_ON in | |
36 | + * mark_buffer_dirty. */ | |
37 | + set_buffer_uptodate(sbh); | |
38 | mark_buffer_dirty(sbh); | |
39 | if (sync) | |
40 | sync_dirty_buffer(sbh); |