s3/locking: Fix logging of lock reference count
authorAnoop C S <anoopcs@redhat.com>
Tue, 18 Sep 2018 16:23:54 +0000 (21:53 +0530)
committerVolker Lendecke <vl@samba.org>
Tue, 2 Oct 2018 08:40:05 +0000 (10:40 +0200)
lock reference count is always increased and reduced by a value of 1.
But lock_ref_count variable holds the old value prior to change and
was being logged wrongly under debug level 10. DEBUG statement must
log lock_ref_count+1 and lock_ref_count-1 respectively when value
gets increased and decreased.

Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/locking/posix.c

index a9fb58c8381015bfae44394b15066497b77a5fbb..a7bb5519bb460134aaeafe704785abe0f8f7ad43 100644 (file)
@@ -432,7 +432,7 @@ static void increment_lock_ref_count(const files_struct *fsp)
        SMB_ASSERT(lock_ref_count < INT32_MAX);
 
        DEBUG(10,("lock_ref_count for file %s = %d\n",
-                 fsp_str_dbg(fsp), (int)lock_ref_count));
+                 fsp_str_dbg(fsp), (int)(lock_ref_count + 1)));
 }
 
 /****************************************************************************
@@ -453,7 +453,7 @@ static void decrement_lock_ref_count(const files_struct *fsp)
        SMB_ASSERT(lock_ref_count > 0);
 
        DEBUG(10,("lock_ref_count for file %s = %d\n",
-                 fsp_str_dbg(fsp), (int)lock_ref_count));
+                 fsp_str_dbg(fsp), (int)(lock_ref_count - 1)));
 }
 
 /****************************************************************************