Skip to content

Commit f5456b5

Browse files
AstralBobAndreas Gruenbacher
authored andcommitted
gfs2: Clean up revokes on normal withdraws
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 <[email protected]> Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent 865cc3e commit f5456b5

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

fs/gfs2/log.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -926,10 +926,10 @@ static void log_write_header(struct gfs2_sbd *sdp, u32 flags)
926926
}
927927

928928
/**
929-
* ail_drain - drain the ail lists after a withdraw
929+
* gfs2_ail_drain - drain the ail lists after a withdraw
930930
* @sdp: Pointer to GFS2 superblock
931931
*/
932-
static void ail_drain(struct gfs2_sbd *sdp)
932+
void gfs2_ail_drain(struct gfs2_sbd *sdp)
933933
{
934934
struct gfs2_trans *tr;
935935

@@ -956,6 +956,7 @@ static void ail_drain(struct gfs2_sbd *sdp)
956956
list_del(&tr->tr_list);
957957
gfs2_trans_free(sdp, tr);
958958
}
959+
gfs2_drain_revokes(sdp);
959960
spin_unlock(&sdp->sd_ail_lock);
960961
}
961962

@@ -1162,7 +1163,6 @@ void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl, u32 flags)
11621163
if (tr && list_empty(&tr->tr_list))
11631164
list_add(&tr->tr_list, &sdp->sd_ail1_list);
11641165
spin_unlock(&sdp->sd_ail_lock);
1165-
ail_drain(sdp); /* frees all transactions */
11661166
tr = NULL;
11671167
goto out_end;
11681168
}

fs/gfs2/log.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,6 @@ extern int gfs2_logd(void *data);
9393
extern void gfs2_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd);
9494
extern void gfs2_glock_remove_revoke(struct gfs2_glock *gl);
9595
extern void gfs2_flush_revokes(struct gfs2_sbd *sdp);
96+
extern void gfs2_ail_drain(struct gfs2_sbd *sdp);
9697

9798
#endif /* __LOG_DOT_H__ */

fs/gfs2/lops.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,7 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
885885
gfs2_log_write_page(sdp, page);
886886
}
887887

888-
static void revoke_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
888+
void gfs2_drain_revokes(struct gfs2_sbd *sdp)
889889
{
890890
struct list_head *head = &sdp->sd_log_revokes;
891891
struct gfs2_bufdata *bd;
@@ -900,6 +900,11 @@ static void revoke_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
900900
}
901901
}
902902

903+
static void revoke_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_trans *tr)
904+
{
905+
gfs2_drain_revokes(sdp);
906+
}
907+
903908
static void revoke_lo_before_scan(struct gfs2_jdesc *jd,
904909
struct gfs2_log_header_host *head, int pass)
905910
{

fs/gfs2/lops.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ extern void gfs2_log_submit_bio(struct bio **biop, int opf);
2020
extern void gfs2_pin(struct gfs2_sbd *sdp, struct buffer_head *bh);
2121
extern int gfs2_find_jhead(struct gfs2_jdesc *jd,
2222
struct gfs2_log_header_host *head, bool keep_cache);
23+
extern void gfs2_drain_revokes(struct gfs2_sbd *sdp);
2324
static inline unsigned int buf_limit(struct gfs2_sbd *sdp)
2425
{
2526
return sdp->sd_ldptrs;

fs/gfs2/util.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ static void signal_our_withdraw(struct gfs2_sbd *sdp)
131131
if (test_bit(SDF_NORECOVERY, &sdp->sd_flags) || !sdp->sd_jdesc)
132132
return;
133133

134+
gfs2_ail_drain(sdp); /* frees all transactions */
134135
inode = sdp->sd_jdesc->jd_inode;
135136
ip = GFS2_I(inode);
136137
i_gl = ip->i_gl;

0 commit comments

Comments
 (0)