}
/*
- * To simulate an I/O failure, the buffer must be locked and held with at least
- * two references.
+ * Fail a locked and referenced buffer outside the I/O path.
*
- * The buf item reference is dropped via ioend processing. The second reference
- * is owned by the caller and is dropped on I/O completion if the buffer is
- * XBF_ASYNC.
+ * The caller transfers a reference which will be released after processing the
+ * error.
*/
void
-xfs_buf_ioend_fail(
+xfs_buf_fail(
struct xfs_buf *bp)
{
+ ASSERT(xfs_buf_islocked(bp));
+
+ bp->b_flags |= XBF_ASYNC;
bp->b_flags &= ~XBF_DONE;
xfs_buf_stale(bp);
xfs_buf_ioerror(bp, -EIO);
xfs_failaddr_t failaddr);
#define xfs_buf_ioerror(bp, err) __xfs_buf_ioerror((bp), (err), __this_address)
extern void xfs_buf_ioerror_alert(struct xfs_buf *bp, xfs_failaddr_t fa);
-void xfs_buf_ioend_fail(struct xfs_buf *);
+void xfs_buf_fail(struct xfs_buf *bp);
void __xfs_buf_mark_corrupt(struct xfs_buf *bp, xfs_failaddr_t fa);
#define xfs_buf_mark_corrupt(bp) __xfs_buf_mark_corrupt((bp), __this_address)
* wait for the lock and then run the IO failure completion.
*/
xfs_buf_lock(bp);
- bp->b_flags |= XBF_ASYNC;
- xfs_buf_ioend_fail(bp);
+ xfs_buf_fail(bp);
return;
}
* inode cluster buffers.
*/
xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
- bp->b_flags |= XBF_ASYNC;
- xfs_buf_ioend_fail(bp);
+ xfs_buf_fail(bp);
return error;
}