File 0005-autofs-5.1.4-fix-incorrect-locking-in-sss-lookup.patch of Package autofs.28865

From 040ef71d7ea85b7f27e6cf0c1c73b4709ad098e8 Mon Sep 17 00:00:00 2001
From: Ian Kent <raven@themaw.net>
Date: Tue, 11 Sep 2018 09:36:12 +0800
Subject: [PATCH] autofs-5.1.4 - fix incorrect locking in sss lookup

Commit 766e0f6c4, autofs-5.0.7 - fix fix wildcard multi map regression,
introduced a deadlock during restart when the sss modules is used.

Looking at the comment above the code which takes the lock it clearly
does this incorrectly.

Signed-off-by: Ian Kent <raven@themaw.net>
---
 modules/lookup_sss.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/modules/lookup_sss.c
+++ b/modules/lookup_sss.c
@@ -788,9 +788,9 @@ int lookup_mount(struct autofs_point *ap
 	 * when we're starting up so just take the readlock in that
 	 */
 	if (ap->flags & MOUNT_FLAG_REMOUNT)
-		cache_writelock(mc);
-	else
 		cache_readlock(mc);
+	else
+		cache_writelock(mc);
 	me = cache_lookup(mc, key);
 	/* Stale mapent => check for entry in alternate source or wildcard */
 	if (me && !me->mapent) {
openSUSE Build Service is sponsored by