From 4aa17923f08bea425a20961cb6eaa72ad9af38c1 Mon Sep 17 00:00:00 2001 From: Wang Shilong Date: Wed, 16 Dec 2020 10:50:24 +0800 Subject: [PATCH] LU-14205 osd-ldiskfs: fix return of osd_extend_restart_trans() ldiskfs_journal_ensure_credits() could possibly return 1 if transaction restarted, Lustre osd expect it return 0 or negative. Fixes: cf48a2d23b ("LU-13839 kernel: RHEL 8.3 server support") Signed-off-by: Wang Shilong Change-Id: I51ff0bd50575902b66529cbd71ff14710c202d03 Reviewed-on: https://review.whamcloud.com/40989 Reviewed-by: Andreas Dilger Tested-by: jenkins Reviewed-by: Jian Yu Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/osd-ldiskfs/osd_io.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lustre/osd-ldiskfs/osd_io.c b/lustre/osd-ldiskfs/osd_io.c index 9d62bae..7631d61 100644 --- a/lustre/osd-ldiskfs/osd_io.c +++ b/lustre/osd-ldiskfs/osd_io.c @@ -942,8 +942,15 @@ static int osd_extend_trans(handle_t *handle, int needed, static int osd_extend_restart_trans(handle_t *handle, int needed, struct inode *inode) { - return ldiskfs_journal_ensure_credits(handle, needed, + int rc; + + rc = ldiskfs_journal_ensure_credits(handle, needed, ldiskfs_trans_default_revoke_credits(inode->i_sb)); + /* this means journal has been restarted */ + if (rc > 0) + rc = 0; + + return rc; } #else static int osd_extend_trans(handle_t *handle, int needed, -- 1.8.3.1