Signed-off-by: Brian Foster <bfoster@xxxxxxxxxx> --- fs/xfs/libxfs/xfs_trans_resv.c | 3 ++- fs/xfs/xfs_dquot_item.c | 13 +++++++++++++ fs/xfs/xfs_qm_syscalls.c | 9 ++++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/fs/xfs/libxfs/xfs_trans_resv.c b/fs/xfs/libxfs/xfs_trans_resv.c index c55cd9a3dec9..88e222d0947a 100644 --- a/fs/xfs/libxfs/xfs_trans_resv.c +++ b/fs/xfs/libxfs/xfs_trans_resv.c @@ -866,7 +866,8 @@ xfs_trans_resv_calc( resp->tr_qm_setqlim.tr_logcount = XFS_DEFAULT_LOG_COUNT; resp->tr_qm_quotaoff.tr_logres = xfs_calc_qm_quotaoff_reservation(mp); - resp->tr_qm_quotaoff.tr_logcount = XFS_DEFAULT_LOG_COUNT; + resp->tr_qm_quotaoff.tr_logcount = XFS_DEFAULT_PERM_LOG_COUNT; + resp->tr_qm_quotaoff.tr_logflags |= XFS_TRANS_PERM_LOG_RES; resp->tr_qm_equotaoff.tr_logres = xfs_calc_qm_quotaoff_end_reservation(); diff --git a/fs/xfs/xfs_dquot_item.c b/fs/xfs/xfs_dquot_item.c index d60647d7197b..57b7c9b731b1 100644 --- a/fs/xfs/xfs_dquot_item.c +++ b/fs/xfs/xfs_dquot_item.c @@ -288,6 +288,18 @@ xfs_qm_qoff_logitem_format( xlog_finish_iovec(lv, vecp, sizeof(struct xfs_qoff_logitem)); } +/* + * XXX: simulate relog callback with hardcoded ->iop_committed() callback + */ +static xfs_lsn_t +xfs_qm_qoff_logitem_committed( + struct xfs_log_item *lip, + xfs_lsn_t lsn) +{ + xfs_trans_relog_queue(lip); + return lsn; +} + /* * There isn't much you can do to push a quotaoff item. It is simply * stuck waiting for the log to be flushed to disk. @@ -333,6 +345,7 @@ static const struct xfs_item_ops xfs_qm_qoffend_logitem_ops = { static const struct xfs_item_ops xfs_qm_qoff_logitem_ops = { .iop_size = xfs_qm_qoff_logitem_size, .iop_format = xfs_qm_qoff_logitem_format, + .iop_committed = xfs_qm_qoff_logitem_committed, .iop_push = xfs_qm_qoff_logitem_push, }; diff --git a/fs/xfs/xfs_qm_syscalls.c b/fs/xfs/xfs_qm_syscalls.c index 1ea82764bf89..3f15f8576027 100644 --- a/fs/xfs/xfs_qm_syscalls.c +++ b/fs/xfs/xfs_qm_syscalls.c @@ -18,6 +18,7 @@ #include "xfs_quota.h" #include "xfs_qm.h" #include "xfs_icache.h" +#include "xfs_log.h" STATIC int xfs_qm_log_quotaoff( @@ -50,7 +51,7 @@ xfs_qm_log_quotaoff( * We don't care about quotoff's performance. */ xfs_trans_set_sync(tp); - error = xfs_trans_commit(tp); + error = xfs_trans_relog(tp, &qoffi->qql_item); if (error) goto out; @@ -227,7 +228,13 @@ xfs_qm_scall_quotaoff( * * So, we have QUOTAOFF start and end logitems; the start * logitem won't get overwritten until the end logitem appears... + * + * XXX: qoffend expects qoffstart in the AIL but not in the CIL. Force + * the log after cancelling relogging to prevent item reinsert... */ + //ssleep(3); + xfs_trans_relog_cancel(&qoffstart->qql_item); + xfs_log_force(mp, XFS_LOG_SYNC); error = xfs_qm_log_quotaoff_end(mp, qoffstart, flags); if (error) { /* We're screwed now. Shutdown is the only option. */ -- 2.20.1