Hi,

On 24/04/15 16:13, Benjamin Marzinski wrote:
When gfs2 was mounted read-only and then unmounted, it was writing a
header block to the journal in the syncing gfs2_log_flush() call from
kill_sb(). This is because the journal was not being marked as idle
until the first log header was written out, and on a read-only mount
there never was a log header written out. Since the journal was not
marked idle, gfs2_log_flush() was writing out a header lock to make
sure it was empty during the sync.  Not only did this cause IO to a
read-only filesystem, but the journalling isn't completely initialized
on read-only mounts, and so gfs2 was writing out the wrong sequence
number in the log header.

Now, the journal is marked idle on mount, and gfs2_log_flush() won't
write out anything until there starts being transactions to flush.
Does that mean that we should be doing more to initialize the log in the r/o mount case? It should know enough to recover the journals in the case that it is the first mounter, so did this perhaps only apply to subsequent mounters of the filesystem?

Still it is a good catch!

Acked-by: Steven Whitehouse <swhit...@redhat.com>

Steve.

Signed-off-by: Benjamin Marzinski <bmarz...@redhat.com>
---
  fs/gfs2/ops_fstype.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index 8633ad3..fd984f6 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -757,6 +757,7 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
                }
        }
+ sdp->sd_log_idle = 1;
        set_bit(SDF_JOURNAL_CHECKED, &sdp->sd_flags);
        gfs2_glock_dq_uninit(&ji_gh);
        jindex = 0;

Reply via email to