Whamcloud - gitweb
LU-17278 ldlm: don't grant failed lock 51/53051/2
authorAlex Zhuravlev <bzzz@whamcloud.com>
Thu, 9 Nov 2023 13:29:03 +0000 (16:29 +0300)
committerOleg Drokin <green@whamcloud.com>
Wed, 29 Nov 2023 21:29:58 +0000 (21:29 +0000)
lock convert can re-grant lock if it loses some bits. this
procedure can race with the import's invalidation. thus
lock can become invalid (l_granted_mode=LCK_MINMODE):
LustreError: 8637:0:(ldlm_lock.c:1095:ldlm_grant_lock_with_skiplist())
ASSERTION( ldlm_is_granted(lock) )

Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Change-Id: I7bb20d62948224647d7632f2822fba44d39a7713
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53051
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Mikhail Pershin <mpershin@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/ldlm/ldlm_inodebits.c

index 0fc4c1b..85df949 100644 (file)
@@ -571,6 +571,14 @@ int ldlm_cli_inodebits_convert(struct ldlm_lock *lock,
        if (rc)
                GOTO(full_cancel, rc);
 
+       /*
+        * check that the lock is still actual as it could get
+        * invalidated by an eviction being unproteced few
+        * lines above.
+        */
+       if (ldlm_is_failed(lock))
+               GOTO(full_cancel, rc = -EINVAL);
+
        /* Finally clear these bits in lock ibits */
        ldlm_inodebits_drop(lock, drop_bits);