From: Alexander Zarochentsev Date: Mon, 29 Apr 2024 17:37:34 +0000 (+0000) Subject: LU-17851 ldiskfs: restart long fallocate tx X-Git-Tag: 2.15.64~187 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F11%2F55111%2F3;p=fs%2Flustre-release.git 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. HPE-bug-id: LUS-12311 Signed-off-by: Alexander Zarochentsev Change-Id: Ib03d78739997caa6d13690b41ef7d01609a3623b Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55111 Reviewed-by: Andrew Perepechko Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin Tested-by: jenkins Tested-by: Maloo --- diff --git a/lustre/osd-ldiskfs/osd_io.c b/lustre/osd-ldiskfs/osd_io.c index 7d7a609..7f6688a 100644 --- a/lustre/osd-ldiskfs/osd_io.c +++ b/lustre/osd-ldiskfs/osd_io.c @@ -2243,7 +2243,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;