There were two fdtab locks: one is in inode_t::del_my_locks(), and
the other is in fixup_lockf_after_exec().  The merely counts the file
descriptors affected by the corresponding lock, so locking fdtab seems
unnecessary.  The latter only only during execve(), when no other
threads exist.  Therefore, these two locks are redundant. This patch
removes them.

Suggested-by: Corinna Vinschen <[email protected]>
Signed-off-by: Takashi Yano <[email protected]>
---
 winsup/cygwin/flock.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/flock.cc b/winsup/cygwin/flock.cc
index 221501d65..857762f4a 100644
--- a/winsup/cygwin/flock.cc
+++ b/winsup/cygwin/flock.cc
@@ -379,7 +379,7 @@ inode_t::del_my_locks (long long id, HANDLE fhdl)
       else if (id && lock->lf_id == id)
        {
          int cnt = 0;
-         cygheap_fdenum cfd (true);
+         cygheap_fdenum cfd (false);
          while (cfd.next () >= 0)
            if (cfd->get_unique_id () == lock->lf_id && ++cnt > 1)
              break;
@@ -441,7 +441,7 @@ fixup_lockf_after_exec (bool exec)
     {
       node->notused ();
       int cnt = 0;
-      cygheap_fdenum cfd (true);
+      cygheap_fdenum cfd (false);
       while (cfd.next () >= 0)
        if (cfd->get_dev () == node->i_dev
            && cfd->get_ino () == node->i_ino
-- 
2.51.0

Reply via email to