From 00d74ad7e1cef2c6135ee5ef82fe69adc78b550a Mon Sep 17 00:00:00 2001 From: Alexander Zarochentsev Date: Mon, 29 Apr 2024 17:37:34 +0000 Subject: [PATCH] LU-17851 ldiskfs: restart long fallocate tx __ext4_journal_ensure_credits() may allow a long fs operation like fallocate to run for too long, if the initial credits estimation is enough high. The fix is to force tx restart if tx state is not T_RUNNING. Lustre-change: https://review.whamcloud.com/55111 Lustre-commit: f317b5c30e478fdecceea4bd07c85ff305e9d81d HPE-bug-id: LUS-12311 Signed-off-by: Alexander Zarochentsev Change-Id: Ib03d78739997caa6d13690b41ef7d01609a3623b Reviewed-by: Andrew Perepechko Reviewed-by: Alex Zhuravlev Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/55247 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/osd-ldiskfs/osd_io.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lustre/osd-ldiskfs/osd_io.c b/lustre/osd-ldiskfs/osd_io.c index 137f94d..d5c5fcf 100644 --- a/lustre/osd-ldiskfs/osd_io.c +++ b/lustre/osd-ldiskfs/osd_io.c @@ -2487,7 +2487,15 @@ static int osd_fallocate_preallocate(const struct lu_env *env, } /* TODO: quota check */ - rc = osd_extend_restart_trans(handle, credits, inode); + if (handle->h_transaction->t_state == T_RUNNING) { + rc = osd_extend_restart_trans(handle, credits, inode); + } else { + rc = ldiskfs_journal_restart(handle, credits +#ifdef HAVE_LDISKFS_JOURNAL_ENSURE_CREDITS + ,ldiskfs_trans_default_revoke_credits(inode->i_sb) +#endif + ); + } if (rc) break; -- 1.8.3.1