The Samba-Bugzilla – Attachment 1990 Details for
Bug 3587
Locking problem
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for 3.0.22
lockpatch (text/plain), 1.83 KB, created by
Daniel Beschorner (dead mail address)
on 2006-06-27 04:45:58 UTC
(
hide
)
Description:
Patch for 3.0.22
Filename:
MIME Type:
Creator:
Daniel Beschorner (dead mail address)
Created:
2006-06-27 04:45:58 UTC
Size:
1.83 KB
patch
obsolete
>diff -urN locking/brlock.c locking/brlock.c >--- locking/brlock.c 2006-06-23 15:19:55.000000000 +0200 >+++ locking/brlock.c 2006-06-23 15:26:01.000000000 +0200 >@@ -711,13 +711,62 @@ > { > struct lock_struct *locks; > struct lock_key *key; >- int i; >+ unsigned int i; >+ unsigned int num_locks = 0; >+ unsigned int num_valid_entries = 0; > > BRLOCK_FN(traverse_callback) = (BRLOCK_FN_CAST())state; > > locks = (struct lock_struct *)dbuf.dptr; > key = (struct lock_key *)kbuf.dptr; > >+ num_locks = dbuf.dsize/sizeof(*locks); >+ >+ /* Ensure the lock db is clean of invalid processes. */ >+ >+ for (i = 0; i < num_locks; i++) { >+ struct lock_struct *lock_data = &locks[i]; >+ if (!process_exists(lock_data->context.pid)) { >+ /* This process no longer exists - mark this >+ entry as invalid by zeroing it. */ >+ ZERO_STRUCTP(lock_data); >+ } else { >+ num_valid_entries++; >+ } >+ } >+ >+ if (num_valid_entries != num_locks) { >+ struct lock_struct *new_lock_data = NULL; >+ >+ if (num_valid_entries) { >+ new_lock_data = SMB_MALLOC_ARRAY(struct lock_struct, num_valid_entries); >+ if (!new_lock_data) { >+ DEBUG(3, ("malloc fail\n")); >+ return 0; >+ } >+ num_valid_entries = 0; >+ for (i = 0; i < num_locks; i++) { >+ struct lock_struct *lock_data = &locks[i]; >+ if (lock_data->context.smbpid && >+ lock_data->context.tid) { >+ /* Valid (nonzero) entry - copy it. */ >+ memcpy(&new_lock_data[num_valid_entries], >+ lock_data, sizeof(struct lock_struct)); >+ num_valid_entries++; >+ } >+ } >+ } >+ SAFE_FREE(dbuf.dptr); >+ dbuf.dptr = (void *)new_lock_data; >+ dbuf.dsize = (num_valid_entries) * sizeof(*locks); >+ >+ if (dbuf.dsize) { >+ tdb_store(ttdb, kbuf, dbuf, TDB_REPLACE); >+ } else { >+ tdb_delete(ttdb, kbuf); >+ } >+ } >+ > for (i=0;i<dbuf.dsize/sizeof(*locks);i++) { > traverse_callback(key->device, key->inode, > locks[i].context.pid,
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 3587
:
1777
|
1886
|
1962
|
1963
| 1990