Skip to content

Commit

Permalink
gfs2: Clean up revokes on normal withdraws
Browse files Browse the repository at this point in the history
Before this patch, the system ail lists were cleaned up if the logd
process withdrew, but on other withdraws, they were not cleaned up.
This included the cleaning up of the revokes as well.

This patch reorganizes things a bit so that all withdraws (not just logd)
clean up the ail lists, including any pending revokes.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
  • Loading branch information
AstralBob authored and Andreas Gruenbacher committed May 20, 2021
1 parent 865cc3e commit f5456b5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
6 changes: 3 additions & 3 deletions fs/gfs2/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -926,10 +926,10 @@ static void log_write_header(struct gfs2_sbd *sdp, u32 flags)
}

/**
* ail_drain - drain the ail lists after a withdraw
* gfs2_ail_drain - drain the ail lists after a withdraw
* @sdp: Pointer to GFS2 superblock
*/
static void ail_drain(struct gfs2_sbd *sdp)
void gfs2_ail_drain(struct gfs2_sbd *sdp)
{
struct gfs2_trans *tr;

Expand All @@ -956,6 +956,7 @@ static void ail_drain(struct gfs2_sbd *sdp)
list_del(&tr->tr_list);
gfs2_trans_free(sdp, tr);
}
gfs2_drain_revokes(sdp);
spin_unlock(&sdp->sd_ail_lock);
}

Expand Down Expand Up @@ -1162,7 +1163,6 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags)
if (tr && list_empty(&tr->tr_list))
list_add(&tr->tr_list, &sdp->sd_ail1_list);
spin_unlock(&sdp->sd_ail_lock);
ail_drain(sdp); /* frees all transactions */
tr = NULL;
goto out_end;
}
Expand Down
1 change: 1 addition & 0 deletions fs/gfs2/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,6 @@ extern int gfs2_logd(void *data);
extern void gfs2_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd);
extern void gfs2_glock_remove_revoke(struct gfs2_glock *gl);
extern void gfs2_flush_revokes(struct gfs2_sbd *sdp);
extern void gfs2_ail_drain(struct gfs2_sbd *sdp);

#endif /* __LOG_DOT_H__ */
7 changes: 6 additions & 1 deletion fs/gfs2/lops.c
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
gfs2_log_write_page(sdp, page);
}

static void revoke_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
void gfs2_drain_revokes(struct gfs2_sbd *sdp)
{
struct list_head *head = &sdp->sd_log_revokes;
struct gfs2_bufdata *bd;
Expand All @@ -900,6 +900,11 @@ static void revoke_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
}
}

static void revoke_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
{
gfs2_drain_revokes(sdp);
}

static void revoke_lo_before_scan(struct gfs2_jdesc *jd,
struct gfs2_log_header_host *head, int pass)
{
Expand Down
1 change: 1 addition & 0 deletions fs/gfs2/lops.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ extern void gfs2_log_submit_bio(struct bio **biop, int opf);
extern void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh);
extern int gfs2_find_jhead(struct gfs2_jdesc *jd,
struct gfs2_log_header_host *head, bool keep_cache);
extern void gfs2_drain_revokes(struct gfs2_sbd *sdp);
static inline unsigned int buf_limit(struct gfs2_sbd *sdp)
{
return sdp->sd_ldptrs;
Expand Down
1 change: 1 addition & 0 deletions fs/gfs2/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ static void signal_our_withdraw(struct gfs2_sbd *sdp)
if (test_bit(SDF_NORECOVERY, &sdp->sd_flags) || !sdp->sd_jdesc)
return;

gfs2_ail_drain(sdp); /* frees all transactions */
inode = sdp->sd_jdesc->jd_inode;
ip = GFS2_I(inode);
i_gl = ip->i_gl;
Expand Down

0 comments on commit f5456b5

Please sign in to comment.