提交 20e8a063 编写于 作者: B Brian Foster 提交者: Darrick J. Wong

xfs: fix up quotacheck buffer list error handling

The quotacheck error handling of the delwri buffer list assumes the
resident buffers are locked and doesn't clear the _XBF_DELWRI_Q flag
on the buffers that are dequeued. This can lead to assert failures
on buffer release and possibly other locking problems.

Move this code to a delwri queue cancel helper function to
encapsulate the logic required to properly release buffers from a
delwri queue. Update the helper to clear the delwri queue flag and
call it from quotacheck.
Signed-off-by: NBrian Foster <bfoster@redhat.com>
Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
上级 27af1bbf
...@@ -1079,6 +1079,8 @@ void ...@@ -1079,6 +1079,8 @@ void
xfs_buf_unlock( xfs_buf_unlock(
struct xfs_buf *bp) struct xfs_buf *bp)
{ {
ASSERT(xfs_buf_islocked(bp));
XB_CLEAR_OWNER(bp); XB_CLEAR_OWNER(bp);
up(&bp->b_sema); up(&bp->b_sema);
...@@ -1814,6 +1816,28 @@ xfs_alloc_buftarg( ...@@ -1814,6 +1816,28 @@ xfs_alloc_buftarg(
return NULL; return NULL;
} }
/*
* Cancel a delayed write list.
*
* Remove each buffer from the list, clear the delwri queue flag and drop the
* associated buffer reference.
*/
void
xfs_buf_delwri_cancel(
struct list_head *list)
{
struct xfs_buf *bp;
while (!list_empty(list)) {
bp = list_first_entry(list, struct xfs_buf, b_list);
xfs_buf_lock(bp);
bp->b_flags &= ~_XBF_DELWRI_Q;
list_del_init(&bp->b_list);
xfs_buf_relse(bp);
}
}
/* /*
* Add a buffer to the delayed write list. * Add a buffer to the delayed write list.
* *
......
...@@ -329,6 +329,7 @@ extern void *xfs_buf_offset(struct xfs_buf *, size_t); ...@@ -329,6 +329,7 @@ extern void *xfs_buf_offset(struct xfs_buf *, size_t);
extern void xfs_buf_stale(struct xfs_buf *bp); extern void xfs_buf_stale(struct xfs_buf *bp);
/* Delayed Write Buffer Routines */ /* Delayed Write Buffer Routines */
extern void xfs_buf_delwri_cancel(struct list_head *);
extern bool xfs_buf_delwri_queue(struct xfs_buf *, struct list_head *); extern bool xfs_buf_delwri_queue(struct xfs_buf *, struct list_head *);
extern int xfs_buf_delwri_submit(struct list_head *); extern int xfs_buf_delwri_submit(struct list_head *);
extern int xfs_buf_delwri_submit_nowait(struct list_head *); extern int xfs_buf_delwri_submit_nowait(struct list_head *);
......
...@@ -1384,12 +1384,7 @@ xfs_qm_quotacheck( ...@@ -1384,12 +1384,7 @@ xfs_qm_quotacheck(
mp->m_qflags |= flags; mp->m_qflags |= flags;
error_return: error_return:
while (!list_empty(&buffer_list)) { xfs_buf_delwri_cancel(&buffer_list);
struct xfs_buf *bp =
list_first_entry(&buffer_list, struct xfs_buf, b_list);
list_del_init(&bp->b_list);
xfs_buf_relse(bp);
}
if (error) { if (error) {
xfs_warn(mp, xfs_warn(mp,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册