Skip to content

Commit 9592ea8

Browse files
committed
gfs2: instrumentation wrt ail1 stuck
Before this patch, if the ail1 flush got stuck for some reason, there were no clues as to why. This patch introduces a check for getting stuck for more than a minute, and if it happens, it dumps the items still remaining on the ail1 list. Signed-off-by: Bob Peterson <[email protected]>
1 parent e04d339 commit 9592ea8

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

fs/gfs2/log.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,40 @@ __acquires(&sdp->sd_ail_lock)
139139
return ret;
140140
}
141141

142+
static void dump_ail_list(struct gfs2_sbd *sdp)
143+
{
144+
struct gfs2_trans *tr;
145+
struct gfs2_bufdata *bd;
146+
struct buffer_head *bh;
147+
148+
fs_err(sdp, "Error: In gfs2_ail1_flush for ten minutes! t=%d\n",
149+
current->journal_info ? 1 : 0);
150+
151+
list_for_each_entry_reverse(tr, &sdp->sd_ail1_list, tr_list) {
152+
list_for_each_entry_reverse(bd, &tr->tr_ail1_list,
153+
bd_ail_st_list) {
154+
bh = bd->bd_bh;
155+
fs_err(sdp, "bd %p: blk:0x%llx bh=%p ", bd,
156+
(unsigned long long)bd->bd_blkno, bh);
157+
if (!bh) {
158+
fs_err(sdp, "\n");
159+
continue;
160+
}
161+
fs_err(sdp, "0x%llx up2:%d dirt:%d lkd:%d req:%d "
162+
"map:%d new:%d ar:%d aw:%d delay:%d "
163+
"io err:%d unwritten:%d dfr:%d pin:%d esc:%d\n",
164+
(unsigned long long)bh->b_blocknr,
165+
buffer_uptodate(bh), buffer_dirty(bh),
166+
buffer_locked(bh), buffer_req(bh),
167+
buffer_mapped(bh), buffer_new(bh),
168+
buffer_async_read(bh), buffer_async_write(bh),
169+
buffer_delay(bh), buffer_write_io_error(bh),
170+
buffer_unwritten(bh),
171+
buffer_defer_completion(bh),
172+
buffer_pinned(bh), buffer_escaped(bh));
173+
}
174+
}
175+
}
142176

143177
/**
144178
* gfs2_ail1_flush - start writeback of some ail1 entries
@@ -155,11 +189,16 @@ void gfs2_ail1_flush(struct gfs2_sbd *sdp, struct writeback_control *wbc)
155189
struct gfs2_trans *tr;
156190
struct blk_plug plug;
157191
int ret = 0;
192+
unsigned long flush_start = jiffies;
158193

159194
trace_gfs2_ail_flush(sdp, wbc, 1);
160195
blk_start_plug(&plug);
161196
spin_lock(&sdp->sd_ail_lock);
162197
restart:
198+
if (time_after(jiffies, flush_start + (HZ * 600))) {
199+
dump_ail_list(sdp);
200+
goto out;
201+
}
163202
list_for_each_entry_reverse(tr, head, tr_list) {
164203
if (wbc->nr_to_write <= 0)
165204
break;
@@ -170,6 +209,7 @@ void gfs2_ail1_flush(struct gfs2_sbd *sdp, struct writeback_control *wbc)
170209
break;
171210
}
172211
}
212+
out:
173213
spin_unlock(&sdp->sd_ail_lock);
174214
blk_finish_plug(&plug);
175215
if (ret) {

0 commit comments

Comments
 (0)