r23516: Fix bug found & fixed by Doug Rudoff (doug_rudoff@isilon.com)
authorJeremy Allison <jra@samba.org>
Sat, 16 Jun 2007 01:04:22 +0000 (01:04 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:23:24 +0000 (12:23 -0500)
- when cleaning up invalid locks make sure we mark the lck
struct as modified so it'll get saved back correctly (that
was the original intent).
Jeremy.
(This used to be commit cbf0829abcc3689edd7ab225054dfc79d43c6309)

source3/locking/brlock.c

index e0cc4eec1e0cd42e1641dc82face5f6c4733e5f9..202fab36ccdbe34b125c834083f706434afd10c9 100644 (file)
@@ -1646,6 +1646,7 @@ static struct byte_range_lock *brl_get_locks_internal(TALLOC_CTX *mem_ctx,
        memcpy(br_lck->lock_data, data.dptr, data.dsize);
        
        if (!fsp->lockdb_clean) {
+               int orig_num_locks = br_lck->num_locks;
 
                /* This is the first time we've accessed this. */
                /* Go through and ensure all entries exist - remove any that don't. */
@@ -1658,6 +1659,11 @@ static struct byte_range_lock *brl_get_locks_internal(TALLOC_CTX *mem_ctx,
                        return NULL;
                }
 
+               /* Ensure invalid locks are cleaned up in the destructor. */
+               if (orig_num_locks != br_lck->num_locks) {
+                       br_lck->modified = True;
+               }
+
                /* Mark the lockdb as "clean" as seen from this open file. */
                fsp->lockdb_clean = True;
        }