bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 5/7] Fix double call to pthread_mutex_unlock in _treefs_s_dir


From: Cyril Roelandt
Subject: Re: [PATCH 5/7] Fix double call to pthread_mutex_unlock in _treefs_s_dir_lookup.
Date: Mon, 17 Dec 2012 20:49:21 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.10) Gecko/20121027 Icedove/10.0.10

On 12/17/2012 01:31 AM, Samuel Thibault wrote:
Cyril Roelandt, le Mon 17 Dec 2012 00:51:28 +0100, a écrit :
* libtreefs/dir-lookup.c (_treefs_s_dir_lookup): remove a redundant call to
pthread_mutex_unlock.

Signed-off-by: Cyril Roelandt<address@hidden>
---
  libtreefs/dir-lookup.c |    1 -
  1 file changed, 1 deletion(-)

diff --git a/libtreefs/dir-lookup.c b/libtreefs/dir-lookup.c
index ce2acaf..41c34ea 100644
--- a/libtreefs/dir-lookup.c
+++ b/libtreefs/dir-lookup.c
@@ -199,7 +199,6 @@ _treefs_s_dir_lookup (struct treefs_handle *h,
             in the right order. */
          if (strcmp (path, "..") != 0)
            {
-             pthread_mutex_unlock (&node->lock);
              pthread_mutex_lock (&dir->lock);
              pthread_mutex_lock (&node->lock);

At quick sight I don't think this one is spurious, see the comment: this
code seems to be used when one wants to lock dir->lock, which we can
not do when we already have node->lock, that's why we have to release
node->lock before taking dir->lock again.



node->lock is unlocked at line 150 (before the do ... while block), so I think that unlocking it at line 202 is an error. I'm not even sure where it is locked in the first place: after line 61, we jump to the gotit label.

Cyril Roelandt.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]