1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00
Commit Graph

80 Commits

Author SHA1 Message Date
Volker Lendecke
e6383f4762 r22736: Start to merge the low-hanging fruit from the now 7000-line cluster patch.
This changes "struct process_id" to "struct server_id", keeping both is
just too much hassle. No functional change (I hope ;-))

Volker
(This used to be commit 0ad4b1226c)
2007-10-10 12:21:52 -05:00
Volker Lendecke
1bcee2679d r22688: Change lock_data in struct byte_range_lock from void * to struct lock_struct *
(This used to be commit 8e0e278961)
2007-10-10 12:21:46 -05:00
Jeremy Allison
79de0ad946 r22588: Make all uses of TALLOC_MEMDUP consistent.
Jeremy.
(This used to be commit 8ad13718af)
2007-10-10 12:19:48 -05:00
Stefan Metzmacher
bc2b6436d0 r22009: change TDB_DATA from char * to unsigned char *
and fix all compiler warnings in the users

metze
(This used to be commit 3a28443079)
2007-10-10 12:19:00 -05:00
Volker Lendecke
94a1b230f3 r21723: Make use of the per-hashchain "freelists"
(This used to be commit f3421ae4cf)
2007-10-10 12:18:25 -05:00
Volker Lendecke
b6b84f98c0 r19668: Convert the locking params to use struct share_param instead of snum
(This used to be commit 609dbec600)
2007-10-10 12:15:46 -05:00
Volker Lendecke
3bc4fd1bb9 r17924: Get rid of warnings now that talloc is merged.
Destructors now take a pointer to the "real" destroyed object as an argument.

Volker
(This used to be commit 70edd716ef)
2007-10-10 11:38:59 -05:00
Volker Lendecke
70660495b3 r17452: Some C++ warnings
(This used to be commit e4b8c79a9d)
2007-10-10 11:38:34 -05:00
Jeremy Allison
49001a5b1b r17346: Add optimisation vl needs for the cluster code where
we don't get the chainlock when getting the byte range
lock record read-only.
Jeremy.
(This used to be commit fcd798ca0c)
2007-10-10 11:38:27 -05:00
Jeremy Allison
2c6030415e r17314: Optimisation for POSIX locking. If we're downgrading
a POSIX lock (applying a read-lock) and we overlap
pending read locks then send them an unlock message,
we may have allowed them to proceed.
Jeremy.
(This used to be commit a7a0b6ba50)
2007-10-10 11:38:25 -05:00
Jeremy Allison
a093a76dc1 r17293: After the results from the cluster tests in Germany,
fix the messaging code to call the efficient calls :

save_re_uid()
set_effective_uid(0);

messaging_op

restore_re_uid();

instead of using heavyweight become_root()/unbecome_root()
pairs around all messaging code. Fixup the messaging
code to ensure sec_init() is called (only once) so that non-root
processes still work when sending messages.

This is a lighter weight solution to become_root()/unbecome_root()
(which swaps all the supplemental groups) and should be more
efficient. I will migrate all server code over to using this
(a similar technique should be used in the passdb backend
where needed).

Jeremy.
(This used to be commit 4ace291278)
2007-10-10 11:38:24 -05:00
Volker Lendecke
d30bcf9c48 r17279: conn->cnum is the tid we've given to the client. This has nothing to do with
our internal share number.

Funny that it worked at all :-)

Volker
(This used to be commit afa6e90946)
2007-10-10 11:38:23 -05:00
Jeremy Allison
54cdd1dfe2 r17276: Don't change the POSIX lock ref count if posix locking = no.
Jeremy.
(This used to be commit 42dec2192c)
2007-10-10 11:38:23 -05:00
Jeremy Allison
7f5f781fe9 r17181: Fix the build farm RAW-READ bug. When making a copy
of the lock array in order to delete them individually
it's also important to make a copy of the *size* of
this array. Otherwise the unlock decrements the termination
index of your for loop :-). Doh ! Big thanks to Volker
for showing me how to set up the build farm to track
this one down. This is not a 3.0.23a issue.
Jeremy.
(This used to be commit 2c82a159ae)
2007-10-10 11:38:18 -05:00
Jeremy Allison
b737f26764 r17105: Fix the race Volker found - we had a non-locked
region between detecting a pending lock was needed
and when we added the blocking lock record. Make
sure that we hold the lock over all this period.
Removed the old code for doing blocking locks on
SMB requests that never block (the old SMBlock
and friends).
Discovered something interesting about the strange
NT_STATUS_FILE_LOCK_CONFLICT return. If we asked
for a lock with zero timeout, and we got an error
of NT_STATUS_FILE_LOCK_CONFLICT, treat it as though
it was a blocking lock with a timeout of 150 - 300ms.
This only happens when timeout is sent as zero and
can be seen quite clearly in ethereal. This is the
real replacement for old do_lock_spin() code.
Re-worked the blocking lock select timeout to correctly
use milliseconds instead of the old second level
resolution (far too coarse for this work).
Jeremy.
(This used to be commit b81d6d1ae9)
2007-10-10 11:38:12 -05:00
Jeremy Allison
e1da1fcf12 r17098: Samba3 now cleanly passes Samba4 RAW-LOCK torture
test. Phew - that was painful :-). But what it means
is that we now implement lock cancels and I can add
lock cancels into POSIX lock handling which will fix
the fast/slow system call issue with cifsfs !
Jeremy.
(This used to be commit f1a9cf075b)
2007-10-10 11:38:11 -05:00
Jeremy Allison
354e444ee3 r17046: Ensure we're using the right pointers ...
Jeremy.
(This used to be commit a8df1863bf)
2007-10-10 11:19:22 -05:00
Jeremy Allison
ad673ea988 r17043: Fix memleak when processing CIFS POSIX lock/unlock
requests. Maybe the Linux kernel OOM killer will
be kinder to smbd now :-). Back to tdbtorture
tests on cifsfs.
Jeremy.
(This used to be commit 1201383e7a)
2007-10-10 11:19:21 -05:00
Jeremy Allison
d22d540c32 r17041: Trying to track down a *big* memory leak in the new lock code.
Fix a small one first.... (easy to valgrind).
Jeremy
(This used to be commit 43d24fbd41)
2007-10-10 11:19:21 -05:00
Jeremy Allison
1722226189 r16987: Fix the logic errors in ref-counting Windows locks.
Hopefully will fix the build farm. Still a few errors
in RAW-LOCK to look at though...
Jeremy.
(This used to be commit edd72d37de)
2007-10-10 11:19:16 -05:00
Jeremy Allison
297df32751 r16973: Fix subtle logic error in lock ref counting found by
cifsfs client code.
Jeremy.
(This used to be commit 53094435d8)
2007-10-10 11:19:16 -05:00
Jeremy Allison
fbdcf2663b r16945: Sync trunk -> 3.0 for 3.0.24 code. Still need
to do the upper layer directories but this is what
everyone is waiting for....

Jeremy.
(This used to be commit 9dafb7f48c)
2007-10-10 11:19:14 -05:00
Jeremy Allison
fca8766ee1 r15419: Never write the same function twice :-). In a traversal
function we must copy the data before modifying.
Jeremy.
(This used to be commit ef4c70f58e)
2007-10-10 11:16:42 -05:00
Jeremy Allison
6eb1187765 r15402: Fix for bug #3587. Dead entries can be left in the locking
db. Make this db self-cleaning on first read of entry after
open, and also on smbstatus -b call. Needs more testing when
I get back from Boston but passes valgrind at first look.
Jeremy.
(This used to be commit c665310963)
2007-10-10 11:16:40 -05:00
Jeremy Allison
f93da6d684 r15269: Fix incorrect boolean in assert to make POSIX lock tests
pass with CIFSFS.
Jeremy.
(This used to be commit 89b604285e)
2007-10-10 11:16:31 -05:00
Tim Potter
f353704bbf r15255: Add return statement after abort to placate fussy compilers. Closes #3721.
(This used to be commit ab5a55ec8b)
2007-10-10 11:16:30 -05:00
Jeremy Allison
713eaf1d67 r15083: Using talloc with destructors is nice and all, but in this
case it's in a performace critical path and it *hurts* us.
Go back to plain malloc/free with an explicit destructor
call.
Jeremy.
(This used to be commit 1c99aed563)
2007-10-10 11:16:22 -05:00
Jeremy Allison
fdd55885da r15060: The brlock code gets called a lot. Ensure we keep the
key around while we're using it - saves many calls to
locking_key() (now deleted).
Jeremy.
(This used to be commit 2f8b527dcf)
2007-10-10 11:16:00 -05:00
Jeremy Allison
423352b90e r15026: Fix warning until POSIX locking finished.
Jeremy.
(This used to be commit 15f39a4c72)
2007-10-10 11:15:57 -05:00
Jeremy Allison
22dbd67708 r15018: Merge Volker's ipc/trans2/nttrans changes over
into 3.0. Also merge the new POSIX lock code - this
is not enabled unless -DDEVELOPER is defined.
This doesn't yet map onto underlying system POSIX
locks. Updates vfs to allow lock queries.
Jeremy.
(This used to be commit 08e52ead03)
2007-10-10 11:15:57 -05:00
Jeremy Allison
81d4f40bbe r14763: Add a new tuning parameter, open files database hash size,
this allows us to experiment with ensuring the tdb hash
size for our open files and locking db are appropriately
sized. Make the hash size larger by default (10007 instead
of 1049) and make the locking db hash size the same as the
open file db hash size.
Jeremy.
(This used to be commit e7225f7e81)
2007-10-10 11:15:46 -05:00
Jeremy Allison
894358a8f3 r13915: Fixed a very interesting class of realloc() bugs found by Coverity.
realloc can return NULL in one of two cases - (1) the realloc failed,
(2) realloc succeeded but the new size requested was zero, in which
case this is identical to a free() call.

The error paths dealing with these two cases should be different,
but mostly weren't. Secondly the standard idiom for dealing with
realloc when you know the new size is non-zero is the following :

 tmp = realloc(p, size);
 if (!tmp) {
    SAFE_FREE(p);
    return error;
 } else {
    p = tmp;
 }

However, there were *many* *many* places in Samba where we were
using the old (broken) idiom of :

 p = realloc(p, size)
 if (!p) {
    return error;
 }

which will leak the memory pointed to by p on realloc fail.

This commit (hopefully) fixes all these cases by moving to
a standard idiom of :

 p = SMB_REALLOC(p, size)
 if (!p) {
    return error;
 }

Where if the realloc returns null due to the realloc failing
or size == 0 we *guarentee* that the storage pointed to by p
has been freed. This allows me to remove a lot of code that
was dealing with the standard (more verbose) method that required
a tmp pointer. This is almost always what you want. When a
realloc fails you never usually want the old memory, you
want to free it and get into your error processing asap.

For the 11 remaining cases where we really do need to keep the
old pointer I have invented the new macro SMB_REALLOC_KEEP_OLD_ON_ERROR,
which can be used as follows :

 tmp = SMB_REALLOC_KEEP_OLD_ON_ERROR(p, size);
 if (!tmp) {
    SAFE_FREE(p);
    return error;
 } else {
    p = tmp;
 }

SMB_REALLOC_KEEP_OLD_ON_ERROR guarentees never to free the
pointer p, even on size == 0 or realloc fail. All this is
done by a hidden extra argument to Realloc(), BOOL free_old_on_error
which is set appropriately by the SMB_REALLOC and SMB_REALLOC_KEEP_OLD_ON_ERROR
macros (and their array counterparts).

It remains to be seen what this will do to our Coverity bug count :-).

Jeremy.
(This used to be commit 1d710d06a2)
2007-10-10 11:10:59 -05:00
Gerald Carter
54abd2aa66 r10656: BIG merge from trunk. Features not copied over
* \PIPE\unixinfo
* winbindd's {group,alias}membership new functions
* winbindd's lookupsids() functionality
* swat (trunk changes to be reverted as per discussion with Deryck)
(This used to be commit 939c3cb5d7)
2007-10-10 11:04:48 -05:00
Herb Lewis
ed1f7121a3 r6502: add LOCKING debug class - pull PRINTINGDB class definition from trunk
so our numbers don't get out of sync
(This used to be commit 58e307664e)
2007-10-10 10:56:43 -05:00
Jeremy Allison
8dddd763d8 r5634: Fix 64-bit overflow problems found by BlueArc torture tester.
We still have a few strange bugs with 64-bit locking values. I will
get traces.
Jeremy.
(This used to be commit ff4c201d93)
2007-10-10 10:55:51 -05:00
Jeremy Allison
695188cc26 r4108: As check_self is *always* False in every invokation, remove the
logic for it. We still pass Samba4 RAW-LOCK test.
Jeremy.
(This used to be commit 596f230513)
2007-10-10 10:53:34 -05:00
Jeremy Allison
acf9d61421 r4088: Get medieval on our ass about malloc.... :-). Take control of all our allocation
functions so we can funnel through some well known functions. Should help greatly with
malloc checking.
HEAD patch to follow.
Jeremy.
(This used to be commit 620f2e608f)
2007-10-10 10:53:32 -05:00
Jeremy Allison
8c1c918c94 r3050: Steal from Samba4 :-). Make us pass most of the new lock tests (except for
the cancel lock which I have to add).
Jeremy.
(This used to be commit cf7f89999e)
2007-10-10 10:52:59 -05:00
Andrew Tridgell
b0202c7b85 r3008: when checking for the existance of a lock we are only doing a single
tdb call, so there is no need to get the chainlock. This reduces the
number of tdb locking calls made on file IO
(This used to be commit 78e904c27b)
2007-10-10 10:52:59 -05:00
Gerald Carter
386a11f49e r1011: fix bad merge (from a few months ago) and ensure that we always use tdb_open_log() instead of tdb_open_ex()
(This used to be commit e65564ab4a)
2007-10-10 10:51:53 -05:00
Gerald Carter
df6d2db4ce merge from old APP_HEAD
* remove corrupt tdb and shutdown (only for printing tdbs, connections,
  sessionid & locking)
* decrement smbd counter in connections.tdb in smb_panic()
* various Makefile hack to get things to link

'max smbd processes' looks like it might be broken.  The counter KEY is not
being set.  Will look into that tomorrow.
(This used to be commit 6e22c5da92)
2004-02-12 05:24:02 +00:00
Jeremy Allison
22c0241571 Changes to allow Samba3 to pass the Samba4 RAW-READ tests.
Jeremy.
(This used to be commit e7565dbba6)
2003-10-09 01:46:01 +00:00
Jeremy Allison
34226f1bd4 Fix for very subtle POSIX lock interaction race condition found by
Herb. We need to unlock POSIX locks before notifying pending lock
processes.
Jeremy.
(This used to be commit 6999eef51c)
2003-04-04 20:38:12 +00:00
Jeremy Allison
fb3e4b8797 Fix to allow blocking lock notification to be done rapidly (no wait
for smb -> smb lock release). Adds new PENDING_LOCK type to lockdb
(does not interfere with existing locks).
Jeremy.
(This used to be commit 766928bbba)
2003-02-27 01:04:34 +00:00
Jeremy Allison
285a3b0ef8 When checking is_locked() new WRITE locks conflict with existing READ locks even
if the context is the same. See LOCKTEST7 in smbtorture.
Jeremy.
(This used to be commit 1698092ba5)
2003-02-22 01:09:57 +00:00
Andrew Tridgell
e90b652848 updated the 3.0 branch from the head branch - ready for alpha18
(This used to be commit 03ac082dcb)
2002-07-15 10:35:28 +00:00
Andrew Tridgell
be389e25dd this attempts to handle the rather bizarre lock cache semantics in
w2k. It isn't entirely accurate, but its close
(This used to be commit e02d736470)
2002-03-10 23:17:07 +00:00
Andrew Tridgell
d160b35240 accept the 0/0 lock but don't treat it in any sort of special way
(This used to be commit 8f7bf38de1)
2002-03-05 19:54:45 +00:00
Tim Potter
cd68afe312 Removed version number from file header.
Changed "SMB/Netbios" to "SMB/CIFS" in file header.
(This used to be commit 6a58c9bd06)
2002-01-30 06:08:46 +00:00
Tim Potter
dc1fc3ee8e Removed 'extern int DEBUGLEVEL' as it is now in the smb.h header.
(This used to be commit 2d0922b0ea)
2001-10-02 04:29:50 +00:00