smbd: Keep "the_lock"s file id separately
authorVolker Lendecke <vl@samba.org>
Thu, 20 Mar 2014 13:57:19 +0000 (14:57 +0100)
committerJeremy Allison <jra@samba.org>
Fri, 21 Mar 2014 18:20:17 +0000 (19:20 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/locking/share_mode_lock.c

index a34f3043b1dcaaf88d6cc98614d01a05725f2e83..50d5cf1f5470b95c85392689f335eff623add242 100644 (file)
@@ -351,10 +351,12 @@ static struct share_mode_lock *get_share_mode_lock_internal(
  * talloc_reference.
  */
 static struct share_mode_lock *the_lock;
+static struct file_id the_lock_id;
 
 static int the_lock_destructor(struct share_mode_lock *l)
 {
        the_lock = NULL;
+       ZERO_STRUCT(the_lock_id);
        return 0;
 }
 
@@ -384,8 +386,9 @@ struct share_mode_lock *get_share_mode_lock(
                        goto fail;
                }
                talloc_set_destructor(the_lock, the_lock_destructor);
+               the_lock_id = id;
        } else {
-               if (!file_id_equal(&the_lock->data->id, &id)) {
+               if (!file_id_equal(&the_lock_id, &id)) {
                        DEBUG(1, ("Can not lock two share modes "
                                  "simultaneously\n"));
                        goto fail;