git: 2d5c2324af33 - stable/13 - rtld-elf: Avoid unnecessary lock_restart_for_upgrade() calls

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Thu, 29 Feb 2024 00:26:15 UTC
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=2d5c2324af335541c40bf9ba682283c7e735ef89

commit 2d5c2324af335541c40bf9ba682283c7e735ef89
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-02-01 22:43:05 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-02-29 00:24:43 +0000

    rtld-elf: Avoid unnecessary lock_restart_for_upgrade() calls
    
    (cherry picked from commit e7951d0b04e6464b37264b8166b1e9ce368a9f1d)
---
 libexec/rtld-elf/rtld.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index 27958ce00398..56fca9cd60b2 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -2617,8 +2617,8 @@ static void
 load_filtees(Obj_Entry *obj, int flags, RtldLockState *lockstate)
 {
 
-    lock_restart_for_upgrade(lockstate);
     if (!obj->filtees_loaded) {
+	lock_restart_for_upgrade(lockstate);
 	load_filtee1(obj, obj->needed_filtees, flags, lockstate);
 	load_filtee1(obj, obj->needed_aux_filtees, flags, lockstate);
 	obj->filtees_loaded = true;