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

302 Commits

Author SHA1 Message Date
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
Volker Lendecke
e0c68d0a1d r17177: Get rid of a global variable by adding a private data pointer to
share_mode_forall().

Volker
(This used to be commit f97f6cedff)
2007-10-10 11:38:17 -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
75a2f4dbc8 r17000: Allow CIFS POSIX locks to coexist with Windows locks.
We shouldn't allow this on the same smbd, but the cifsfs
client negotiates POSIX locks then sends Windows ones.
Doh ! Can't fix shipped client code....
Jeremy.
(This used to be commit 2f8cabe98d)
2007-10-10 11:19:17 -05:00
Jeremy Allison
8dbe2651d3 r16992: Fix bug #3922 reported by jason@ncac.gwu.edu, correctly
look at the return code.
Jeremy.
(This used to be commit f11933b3ac)
2007-10-10 11:19:17 -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
cc1457beb0 r16661: Fix from jason@ncac.gwu.edu for bug #3875,
bad cast warning.
Jeremy.
(This used to be commit d60e6e0abc)
2007-10-10 11:19:06 -05:00
Jeremy Allison
54ea3c23e3 r16435: Add in the uid info that Jerry needs into the
share_mode struct. Allows us to know the unix
uid of the opener of the file/directory. Needed
for info level queries on open files.
Jeremy.
(This used to be commit d929323d6f)
2007-10-10 11:18:54 -05:00
Jeremy Allison
a90026e7a6 r16307: Make sure we know we must pass a valid pointer here.
Klocwork #1129.
Jeremy.
(This used to be commit e8d86362ba)
2007-10-10 11:17:32 -05:00
Jeremy Allison
c115570b85 r16281: Start fixing up gcc4 -O6 warnings on an x86_64 box. size_t != unsigned
int
in a format string.
Jeremy.
(This used to be commit c49ad9200b)
2007-10-10 11:17:30 -05:00
James Peach
0a1ca7fa3d r15943: Update misleading DEBUG statements and comments that refer to
open_file_shared.
(This used to be commit 784126edff)
2007-10-10 11:17:14 -05:00
Jeremy Allison
6a026d5618 r15670: Fix valgrind-spotted issue in BASE-DELETE test.
We were forgetting to increment after copying
the primary group gid.
Jeremy
(This used to be commit 31d16c434e)
2007-10-10 11:17:06 -05:00
Jeremy Allison
cc9ea93456 r15668: DOS or FCB opens share one share mode entry from different
fsp pointers. Ensure we cope with this to pass Samba4
DENY tests (we used to pass these, there must have been
a regression with newer code). We now pass them.
Jeremy
(This used to be commit fd6fa1d4ea)
2007-10-10 11:17:06 -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
7f57dc61cb r14703: Clarify the return codes for the POSIX locking case. This
was confusing.
Jeremy.
(This used to be commit bc1a605a39)
2007-10-10 11:15:44 -05:00
James Peach
d6eebce490 r14428: Call fill_share_mode_entry with NO_OPLOCK instead of 0.
(This used to be commit a39cbaa699)
2007-10-10 11:15:30 -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
fb5362c069 r13571: Replace all calls to talloc_free() with thye TALLOC_FREE()
macro which sets the freed pointer to NULL.
(This used to be commit b65be8874a)
2007-10-10 11:10:14 -05:00
Jeremy Allison
30e47fdfe2 r13412: Don't use arbitrary uint32 size for uid and gid storage. Use
correct system size. Fixed a bug that was accidentally introduced
by use of uint32 - uid was stored twice, not uid and gid.
Jeremy.
(This used to be commit 89db006997)
2007-10-10 11:10:00 -05:00
Jeremy Allison
40d3c7ebb2 r13329: Fix libsmbsharemodes.so to work with the stored delete token.
Less trouble than I thought plus it didn't need an interface
change (thank goodness !).
Jeremy.
(This used to be commit dbe2572d1c)
2007-10-10 11:06:25 -05:00
Jeremy Allison
466230e5a1 r13294: Fix basic delete on close tests - don't forget to tell
the data struct how big the token is... :-).
Jeremy.
(This used to be commit f259de8b69)
2007-10-10 11:06:21 -05:00
Jeremy Allison
d14af63e6a r13293: Rather a big patch I'm afraid, but this should fix bug #3347
by saving the UNIX token used to set a delete on close flag,
and using it when doing the delete. libsmbsharemodes.so still
needs updating to cope with this change.
Samba4 torture tests to follow.
Jeremy.
(This used to be commit 23f16cbc2e)
2007-10-10 11:06:21 -05:00
Jeremy Allison
86c9bac4c3 r13274: Fix for bug #3467. Not a show stopper.
jason qian <jason@infrant.com> was a *fantastic*
help in tracking this down.
Jeremy.
(This used to be commit 9f4a9c70fa)
2007-10-10 11:06:20 -05:00
Jeremy Allison
bd34c2ac25 r13198: Fix issues exposed by Jerry's testing on 64-bit Solaris
(I hope). Separate 3.0.21b patch sent to Jerry.
Jeremy.
(This used to be commit 837e7ea7e4)
2007-10-10 11:06:17 -05:00
Jeremy Allison
6f08a557ba r13194: Don't do extra memcpy's unless we're asked to.
Jeremy.
(This used to be commit f93e1e7556)
2007-10-10 11:06:17 -05:00
Jeremy Allison
6a097ab20e r13192: Fix up alignment issues when printing share mode
entries. Add paranioa to debug so we know when an
entry is unused.
Jeremy.
(This used to be commit fa5fab313e)
2007-10-10 11:06:16 -05:00
Gerald Carter
6afd823e42 r13110: remove an invalid debug message about call get_share_mode_lock() with a NULL service path and fname (we do it all the time internally)
(This used to be commit e1f75ea637)
2007-10-10 11:06:14 -05:00
Jeremy Allison
3317484799 r12877: Stop passing structs around in smb messages, instead
always linearize into little-endian. Should fix all
Solaris issues with this, plus provide a cleaner base
moving forward for cluster-aware Samba where smbd's
can communicate across different compilers/architectures
(eventually these message will have to go cross-machine).
Jeremy.
(This used to be commit d01824b785)
2007-10-10 11:06:05 -05:00
Jeremy Allison
e7d2e311a2 r12234: Reduce the race condition for renames by holding the lock
longer. Instigated by complaints on the fix for #3303 from
SATOH Fumiyasu <fumiyas@miraclelinux.com>.
Jeremy.
(This used to be commit 855f5f8c32)
2007-10-10 11:05:50 -05:00
Jeremy Allison
762901cfb9 r12221: Fix error code paths that can potentially leave a dangling lock.
Jeremy.
(This used to be commit 123135ed1d)
2007-10-10 11:05:49 -05:00
Jeremy Allison
ab7a4f7e8e r12213: Final fix for #3303 - send rename messages to smbd's
that have open file handles to allow them to correctly
implement delete on close. There is a further correctness
fix I'm intending to add to this to cope with different share
paths, but not right now...
Jeremy.
(This used to be commit 932e337db8)
2007-10-10 11:05:49 -05:00
Jeremy Allison
7d2771e758 r12203: Add the share path into the sharemode db. This involves
revving the minor version number for libsmbsharemodes (we
now have a new _ex interface that takes the share path
as well as the filename). Needed for #3303. Some code written
by SATOH Fumiyasu <fumiya@samba.gr.jp> included in the changes
to locking/locking.c. The smbstatus output is a bit of a mess
and needs overhauling...
Jeremy.
(This used to be commit 9d93af713f)
2007-10-10 11:05:49 -05:00