mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
GFS2: Fix bug-trap in ail flush code
The assert was being tested under the wrong lock, a legacy of the original code. Also, if it does trigger, the resulting information was not always a lot of help. This moves the patch under the correct lock and also prints out more useful information in tacking down the source of the problem. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
This commit is contained in:
parent
2f0264d592
commit
75549186ed
@ -28,6 +28,17 @@
|
|||||||
#include "trans.h"
|
#include "trans.h"
|
||||||
#include "dir.h"
|
#include "dir.h"
|
||||||
|
|
||||||
|
static void gfs2_ail_error(struct gfs2_glock *gl, const struct buffer_head *bh)
|
||||||
|
{
|
||||||
|
fs_err(gl->gl_sbd, "AIL buffer %p: blocknr %llu state 0x%08lx mapping %p page state 0x%lx\n",
|
||||||
|
bh, (unsigned long long)bh->b_blocknr, bh->b_state,
|
||||||
|
bh->b_page->mapping, bh->b_page->flags);
|
||||||
|
fs_err(gl->gl_sbd, "AIL glock %u:%llu mapping %p\n",
|
||||||
|
gl->gl_name.ln_type, gl->gl_name.ln_number,
|
||||||
|
gfs2_glock2aspace(gl));
|
||||||
|
gfs2_lm_withdraw(gl->gl_sbd, "AIL error\n");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __gfs2_ail_flush - remove all buffers for a given lock from the AIL
|
* __gfs2_ail_flush - remove all buffers for a given lock from the AIL
|
||||||
* @gl: the glock
|
* @gl: the glock
|
||||||
@ -41,20 +52,24 @@ static void __gfs2_ail_flush(struct gfs2_glock *gl)
|
|||||||
struct list_head *head = &gl->gl_ail_list;
|
struct list_head *head = &gl->gl_ail_list;
|
||||||
struct gfs2_bufdata *bd;
|
struct gfs2_bufdata *bd;
|
||||||
struct buffer_head *bh;
|
struct buffer_head *bh;
|
||||||
|
sector_t blocknr;
|
||||||
|
|
||||||
spin_lock(&sdp->sd_ail_lock);
|
spin_lock(&sdp->sd_ail_lock);
|
||||||
while (!list_empty(head)) {
|
while (!list_empty(head)) {
|
||||||
bd = list_entry(head->next, struct gfs2_bufdata,
|
bd = list_entry(head->next, struct gfs2_bufdata,
|
||||||
bd_ail_gl_list);
|
bd_ail_gl_list);
|
||||||
bh = bd->bd_bh;
|
bh = bd->bd_bh;
|
||||||
gfs2_remove_from_ail(bd);
|
blocknr = bh->b_blocknr;
|
||||||
bd->bd_bh = NULL;
|
if (buffer_busy(bh))
|
||||||
|
gfs2_ail_error(gl, bh);
|
||||||
bh->b_private = NULL;
|
bh->b_private = NULL;
|
||||||
|
gfs2_remove_from_ail(bd); /* drops ref on bh */
|
||||||
spin_unlock(&sdp->sd_ail_lock);
|
spin_unlock(&sdp->sd_ail_lock);
|
||||||
|
|
||||||
bd->bd_blkno = bh->b_blocknr;
|
bd->bd_bh = NULL;
|
||||||
|
bd->bd_blkno = blocknr;
|
||||||
|
|
||||||
gfs2_log_lock(sdp);
|
gfs2_log_lock(sdp);
|
||||||
gfs2_assert_withdraw(sdp, !buffer_busy(bh));
|
|
||||||
gfs2_trans_add_revoke(sdp, bd);
|
gfs2_trans_add_revoke(sdp, bd);
|
||||||
gfs2_log_unlock(sdp);
|
gfs2_log_unlock(sdp);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user