Whamcloud - gitweb
LU-14205 osd-ldiskfs: fix return of osd_extend_restart_trans() 89/40989/2
authorWang Shilong <wshilong@ddn.com>
Wed, 16 Dec 2020 02:50:24 +0000 (10:50 +0800)
committerOleg Drokin <green@whamcloud.com>
Tue, 22 Dec 2020 05:28:00 +0000 (05:28 +0000)
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 <wshilong@ddn.com>
Change-Id: I51ff0bd50575902b66529cbd71ff14710c202d03
Reviewed-on: https://review.whamcloud.com/40989
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/osd-ldiskfs/osd_io.c

index 9d62bae..7631d61 100644 (file)
@@ -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)
 {
 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));
                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,
 }
 #else
 static int osd_extend_trans(handle_t *handle, int needed,