diff options
author | Volker Lendecke <vl@samba.org> | 2014-08-20 09:07:14 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-08-23 00:24:18 +0200 |
commit | 85935097b9dd877791ed7447fe4314c6736c0414 (patch) | |
tree | 4686e5d3d922b2ee76e05a88ad6544cb78d33bea /source3/locking | |
parent | 105724073300af03eb0835b3c93d9b2e2bfacb07 (diff) | |
download | samba-85935097b9dd877791ed7447fe4314c6736c0414.tar.gz |
brlock: Remove validate_lock_entries
This is now only called during brl_forall. It does not really hurt if we list
dead processes here. If the upper layers really care, they can filter it out
themselves. The real lock conflicts are not removed on-demand.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/locking')
-rw-r--r-- | source3/locking/brlock.c | 95 |
1 files changed, 1 insertions, 94 deletions
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c index 078077f1e09..295e14780a4 100644 --- a/source3/locking/brlock.c +++ b/source3/locking/brlock.c @@ -1749,80 +1749,6 @@ bool brl_reconnect_disconnected(struct files_struct *fsp) return true; } -/**************************************************************************** - Ensure this set of lock entries is valid. -****************************************************************************/ -static bool validate_lock_entries(unsigned int *pnum_entries, struct lock_struct **pplocks, - bool keep_disconnected) -{ - unsigned int i; - struct lock_struct *locks = *pplocks; - unsigned int num_entries = *pnum_entries; - TALLOC_CTX *frame; - struct server_id *ids; - bool *exists; - - if (num_entries == 0) { - return true; - } - - frame = talloc_stackframe(); - - ids = talloc_array(frame, struct server_id, num_entries); - if (ids == NULL) { - DEBUG(0, ("validate_lock_entries: " - "talloc_array(struct server_id, %u) failed\n", - num_entries)); - talloc_free(frame); - return false; - } - - exists = talloc_array(frame, bool, num_entries); - if (exists == NULL) { - DEBUG(0, ("validate_lock_entries: " - "talloc_array(bool, %u) failed\n", - num_entries)); - talloc_free(frame); - return false; - } - - for (i = 0; i < num_entries; i++) { - ids[i] = locks[i].context.pid; - } - - if (!serverids_exist(ids, num_entries, exists)) { - DEBUG(3, ("validate_lock_entries: serverids_exists failed\n")); - talloc_free(frame); - return false; - } - - i = 0; - - while (i < num_entries) { - if (exists[i]) { - i++; - continue; - } - - if (keep_disconnected && - server_id_is_disconnected(&ids[i])) - { - i++; - continue; - } - - /* This process no longer exists */ - - brl_delete_lock_struct(locks, num_entries, i); - num_entries -= 1; - } - TALLOC_FREE(frame); - - *pnum_entries = num_entries; - - return True; -} - struct brl_forall_cb { void (*fn)(struct file_id id, struct server_id pid, enum brl_type lock_type, @@ -1844,7 +1770,6 @@ static int brl_traverse_fn(struct db_record *rec, void *state) struct file_id *key; unsigned int i; unsigned int num_locks = 0; - unsigned int orig_num_locks = 0; TDB_DATA dbkey; TDB_DATA value; @@ -1861,25 +1786,7 @@ static int brl_traverse_fn(struct db_record *rec, void *state) } key = (struct file_id *)dbkey.dptr; - orig_num_locks = num_locks = value.dsize/sizeof(*locks); - - /* Ensure the lock db is clean of entries from invalid processes. */ - - if (!validate_lock_entries(&num_locks, &locks, true)) { - TALLOC_FREE(locks); - return -1; /* Terminate traversal */ - } - - if (orig_num_locks != num_locks) { - if (num_locks) { - TDB_DATA data; - data.dptr = (uint8_t *)locks; - data.dsize = num_locks*sizeof(struct lock_struct); - dbwrap_record_store(rec, data, TDB_REPLACE); - } else { - dbwrap_record_delete(rec); - } - } + num_locks = value.dsize/sizeof(*locks); if (cb->fn) { for ( i=0; i<num_locks; i++) { |