diff options
author | Robert Peterson <rpeterso@redhat.com> | 2007-06-12 12:24:36 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2007-07-09 03:23:40 -0400 |
commit | 8fb68595d508fd30ec90939572484b263600376c (patch) | |
tree | 218a457675c111e2224fb57998d38e45d5786bd1 /fs/gfs2/lops.c | |
parent | fad59c1390045b5adb7c7249ec4e77e0f868aca5 (diff) |
[GFS2] Journaled file write/unstuff bug
This patch is for bugzilla bug 283162, which uncovered a number of
bugs pertaining to writing to files that have the journaled bit on.
These bugs happen most often when writing to the meta_fs because
the files are always journaled. So operations like gfs2_grow were
particularly vulnerable, although many of the problems could be
recreated with normal files after setting the journaled bit on.
The problems fixed are:
-GFS2 wasn't ever writing unstuffed journaled data blocks to their
in-place location on disk. Now it does.
-If you unmounted too quickly after doing IO to a journaled file,
GFS2 was crashing because you would discard a buffer whose bufdata
was still on the active items list. GFS2 now deals with this
gracefully.
-GFS2 was losing track of the bufdata for journaled data blocks,
and it wasn't getting freed, causing an error when you tried to
unmount the module. GFS2 now frees all the bufdata structures.
-There was a memory corruption occurring because GFS2 wrote
twice as many log entries for journaled buffers.
-It was occasionally trying to write journal headers in buffers
that weren't currently mapped.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/lops.c')
-rw-r--r-- | fs/gfs2/lops.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c index 3e971f25120d..df6bceea379a 100644 --- a/fs/gfs2/lops.c +++ b/fs/gfs2/lops.c | |||
@@ -607,7 +607,8 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp) | |||
607 | if (unlikely(magic != 0)) | 607 | if (unlikely(magic != 0)) |
608 | set_buffer_escaped(bh1); | 608 | set_buffer_escaped(bh1); |
609 | gfs2_log_lock(sdp); | 609 | gfs2_log_lock(sdp); |
610 | if (n++ > num) | 610 | n += 2; |
611 | if (n >= num) | ||
611 | break; | 612 | break; |
612 | } else if (!bh1) { | 613 | } else if (!bh1) { |
613 | total_dbuf--; | 614 | total_dbuf--; |
@@ -624,6 +625,7 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp) | |||
624 | } | 625 | } |
625 | gfs2_log_unlock(sdp); | 626 | gfs2_log_unlock(sdp); |
626 | if (bh) { | 627 | if (bh) { |
628 | set_buffer_mapped(bh); | ||
627 | set_buffer_dirty(bh); | 629 | set_buffer_dirty(bh); |
628 | ll_rw_block(WRITE, 1, &bh); | 630 | ll_rw_block(WRITE, 1, &bh); |
629 | bh = NULL; | 631 | bh = NULL; |