Skip to content

Commit

Permalink
gfs2: return errors from gfs2_ail_empty_gl
Browse files Browse the repository at this point in the history
Before this patch, function gfs2_ail_empty_gl did not return errors it
encountered from __gfs2_trans_begin. Those errors usually came from the
fact that the file system was made read-only, often due to unmount
(but theoretically could be due to -o remount,ro), which prevented
the transaction from starting.

The inability to start a transaction prevented its revokes from being
properly written to the journal for glocks during unmount (and
transition to ro).

That meant glocks could be unlocked without the metadata properly
revoked in the journal. So other nodes could grab the glock thinking
that their lvb values were correct, but in fact corresponded to the
glock without its revokes properly synced. That presented as lvb
mismatch errors.

This patch allows gfs2_ail_empty_gl to return the error properly to
the caller.

Signed-off-by: Bob Peterson <[email protected]>
Signed-off-by: Andreas Gruenbacher <[email protected]>
  • Loading branch information
AstralBob authored and Andreas Gruenbacher committed Apr 25, 2023
1 parent 55534c0 commit 24ab158
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions fs/gfs2/glops.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ static int gfs2_ail_empty_gl(struct gfs2_glock *gl)
struct gfs2_sbd *sdp = gl->gl_name.ln_sbd;
struct gfs2_trans tr;
unsigned int revokes;
int ret;
int ret = 0;

revokes = atomic_read(&gl->gl_ail_count);

Expand Down Expand Up @@ -132,7 +132,7 @@ static int gfs2_ail_empty_gl(struct gfs2_glock *gl)
flush:
gfs2_log_flush(sdp, NULL, GFS2_LOG_HEAD_FLUSH_NORMAL |
GFS2_LFC_AIL_EMPTY_GL);
return 0;
return ret;
}

void gfs2_ail_flush(struct gfs2_glock *gl, bool fsync)
Expand Down Expand Up @@ -326,7 +326,9 @@ static int inode_go_sync(struct gfs2_glock *gl)
ret = gfs2_inode_metasync(gl);
if (!error)
error = ret;
gfs2_ail_empty_gl(gl);
ret = gfs2_ail_empty_gl(gl);
if (!error)
error = ret;
/*
* Writeback of the data mapping may cause the dirty flag to be set
* so we have to clear it again here.
Expand Down

0 comments on commit 24ab158

Please sign in to comment.