From a6bb73d1cfd20a73fbbe6076008376fb87879d1b Mon Sep 17 00:00:00 2001
From: Yuanjie Huang <yuanjie.huang@windriver.com>
Date: Thu, 18 Aug 2016 17:59:13 +0800
Subject: [PATCH] reset dl_load_write_lock after forking

The patch in this Bugzilla entry was requested by a customer:

  https://www.sourceware.org/bugzilla/show_bug.cgi?id=19282

The __libc_fork() code reset dl_load_lock, but it also needed to reset
dl_load_write_lock.  The patch has not yet been integrated upstream.

Upstream-Status: Pending [ Not Author See bugzilla]

Signed-off-by: Damodar Sonone <damodar.sonone@kpit.com>
Signed-off-by: Yuanjie Huang <yuanjie.huang@windriver.com>
---
 sysdeps/nptl/fork.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sysdeps/nptl/fork.c b/sysdeps/nptl/fork.c
index 2b9ae4b..3d0b8da 100644
--- a/sysdeps/nptl/fork.c
+++ b/sysdeps/nptl/fork.c
@@ -174,8 +174,9 @@ __libc_fork (void)
       /* Reset locks in the I/O code.  */
       _IO_list_resetlock ();
 
-      /* Reset the lock the dynamic loader uses to protect its data.  */
+      /* Reset the locks the dynamic loader uses to protect its data.  */
       __rtld_lock_initialize (GL(dl_load_lock));
+      __rtld_lock_initialize (GL(dl_load_write_lock));
 
       /* Run the handlers registered for the child.  */
       while (allp != NULL)
-- 
1.9.1
