The libxfs resync added to the deferred ops code the ability to capture
the unfinished deferred ops and transaction reservation for later replay
during log recovery. This nominally requires transactions to have the
ability to track rt extent reservations and usage, so port that missing
piece from the kernel now to avoid leaving logic bombs in case anyone
ever /does/ start messing with realtime.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
error = -ENOSPC;
goto undo_blocks;
}
+ tp->t_rtx_res += rtextents;
}
return 0;
tp->t_ifree_delta += delta;
break;
case XFS_TRANS_SB_FREXTENTS:
+ /*
+ * Track the number of rt extents allocated in the transaction.
+ * Make sure it does not exceed the number reserved.
+ */
+ if (delta < 0) {
+ tp->t_rtx_res_used += (uint)-delta;
+ if (tp->t_rtx_res_used > tp->t_rtx_res) {
+ fprintf(stderr,
+_("Transaction rt block reservation exceeded! %u > %u\n"),
+ tp->t_rtx_res_used, tp->t_rtx_res);
+ ASSERT(0);
+ }
+ }
tp->t_frextents_delta += delta;
break;
default: