1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-04 17:47:26 +03:00

222 Commits

Author SHA1 Message Date
Jeremy Allison
6999eef51c Fix for very subtle POSIX lock interaction race condition found by
Herb. We need to unlock POSIX locks before notifying pending lock
processes.
Jeremy.
-
Jeremy Allison
766928bbba 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.
-
Andrew Bartlett
d714254130 Merge off-by-one fix from HEAD (caused crash with --enable-developer) -
Jeremy Allison
1698092ba5 When checking is_locked() new WRITE locks conflict with existing READ locks even
if the context is the same. See LOCKTEST7 in smbtorture.
Jeremy.
-
Jeremy Allison
e9b4fb8b9a Fixes for HPUX only having limited POSIX lock range from Michael Steffens <michael.steffens@hp.com>
Jeremy.
-
Andrew Bartlett
c1cfc296c2 Cleanups: (merge from HEAD)
- use safe_strcpy() instead of pstrcpy() for malloc()ed strings

 - CUPS: a failure in an attempt to automaticly add a printer is not level 0 stuff.

 - Fix up a possible Realloc() failure segfault

Andrew Bartlett
-
Jeremy Allison
62038a0abf Fix problem with "hide unreadable". stat file opens are baaack :-).
Jeremy.
-
Jeremy Allison
09a218a9f6 Forward port the change to talloc_init() to make all talloc contexts
named. Ensure we can query them.
Jeremy.
-
Jeremy Allison
5d5762d178 Lots of fixes for error paths where tdb_fetch() data need freeing.
Found via a post from Arcady Chernyak <Arcady.Chernyak@efi.com>.
Jeremy.
-
Gerald Carter
65e7b5273b sync'ing up for 3.0alpha20 release -
Andrew Tridgell
03ac082dcb updated the 3.0 branch from the head branch - ready for alpha18 -
Jeremy Allison
3b1b8ac435 Fix the mp3 rename bug - also tidy up our open code and remove the special
cases for rename and unlink. Had to add desired_access into the share mode record.
Jeremy.
-
Andrew Tridgell
e7ae8003cb if our lock spin code fails then return the first error code, not the
last one. This is what caused the lock1 and lock2 tests to fail.
-
Jeremy Allison
8587dd95f8 Use sys_usleep not usleep.
Jeremy.
-
Jeremy Allison
62b80d5c65 Ensure we attempt to lock at least once. Only sleep if time param set.
Jeremy.
-
Jeremy Allison
8aa9860ea2 include/smb_macros.h: Don't round up an allocation if the size is zero.
"One of these locks is not like the others... One of these locks is not
quite the same" :-). When is a zero timeout lock not zero ? When it's
being processed by Windows 2000 of course.. This code change, ugly though
it is - completely fixes the foxpro/access multi-user file system database
problems that people have been having. I used a *wonderful* test program
donated by "Gerald Drouillard" <gerald@drouillard.ca> which allowed me
to completely reproduce this problem, and to finally determine the correct
fix. This also explains why Windows 2000 is *so slow* when responding to
the smbtorture lock tests. I *love* it when all these things come together
and finally make sense :-).
Jeremy.
-
Andrew Tridgell
e02d736470 this attempts to handle the rather bizarre lock cache semantics in
w2k. It isn't entirely accurate, but its close
-
Andrew Tridgell
8f7bf38de1 accept the 0/0 lock but don't treat it in any sort of special way -
Tim Potter
6a58c9bd06 Removed version number from file header.
Changed "SMB/Netbios" to "SMB/CIFS" in file header.
-
Jeremy Allison
ed5a9a0ee3 Debugs that print out a share mode table in debug level 10. This code
enabled me to track down a *nasty* bug.
Jeremy.
-
Jeremy Allison
32f4f3a45d Added DEBUG in set_share_mode to track down logic insanity.
Jeremy.
-
Tim Potter
f26e8205cf Removed unused function, delete_fn() -
Jeremy Allison
4098d44203 After conversations with Andrew, improved the robustness of the
sharemode db in the following way.

Originally, on startup and shutdown, smbd would scan the share mode
db to ensure it was correct. This lead to scalability issues as
scans lock the db for quite a long time. Andrew had the brainstorm
that we only care about the record we're about to read.

This new code (small change really, but quite significant) causes
get_share_modes() to do a process_exists() call against each pid
in each record, and to delete any that don't and re-write the
entry if any dead records were detected.

This allowed me to remove the startup/shutdown scans of the
db (they can be added into smbstatus if anyone really cares to
have them back). This will please the vfs author who was worried
about the time taken on open() calls, and will lead to much
greater robustness and scalability in the share mode db.

We need much testing of this, and also netbench tests to
ensure the extra process_exists() calls don't hurt performance
(they shouldn't it's a very simple system call).

Jeremy.
-
Jeremy Allison
59cfcd8a6c Don't scan locking db on closedown.
Jeremy.
-
Jeremy Allison
058ae6b58f Move from timestamp to gen count file id's for finding oplocked files
in a tdb.
Jeremy.
-
Jeremy Allison
eac6bbd24e Ensure we mask off deny modes correctly on being set (this shouldn't have
caused problems but is tidier).
Fix debug statement in locking.c
Jeremy.
-
Tim Potter
2d0922b0ea Removed 'extern int DEBUGLEVEL' as it is now in the smb.h header. -
Jeremy Allison
fc91ecc236 Removed test code that got added by accident.
Jeremy.
-
Jeremy Allison
22c5915bb4 Correct fix for unaligned memcpy - malloc'ed memory incremented by sizeof(struct locking_data)
was not forced to be 8 byte aligned. Use union to force it to be correctly aligned
for memcpy and use void *, to tell compiler not to optimize aligned copy (this last fix
suggested by Trond @ RedHat). The first fix should be sufficient, but this provides a
"belt and braces" fix.
Jeremy.
-
Jeremy Allison
b4b891279b Use structure copy to fix unaligned accesses on 64bit architectures on
Linux.
Jeremy.
-
Simo Sorce
e61aec84ed move to SAFE_FREE() -
Jeremy Allison
ce9f959964 Fix the 62bit locking onto 32 bit NFS mounts problem generically for HPUX.
Don. please check this out.
Jeremy.
-
Andrew Tridgell
c26e0d3f27 got rid of USE_TDB_MMAP_FLAG as its not needed any more -
Andrew Tridgell
b1b2a5fa5d use NTSTATUS not BOOL in do_lock() -
Andrew Tridgell
7b39c4c598 2nd DELETE_ON_CLOSE_FLAG fix ...
we set the DELETE_ON_CLOSE_FLAG on all share modes on the file, which
means the share mode in the fsp will not match the one in the tdb when
we come to close for other file handles, which means we end up with
share modes on files after all handles are closed

fixed by making the comparison function that says if two shares modes
are equal ignore the DELETE_ON_CLOSE_FLAG
-
Jeremy Allison
8fad517770 NFS v2 can return ENOLCK when greater than 31 bit offsets are used.
Treat this the same as an EFBIG error.
Jeremy
-
Andrew Tridgell
dcd6e735f7 the next stage in the NTSTATUS/WERROR change. smbd and nmbd now compile, but the client code still needs some work -
Andrew Tridgell
1d36250e33 converted another bunch of stuff to NTSTATUS -
Andrew Tridgell
1b778bc7d2 started converting NTSTATUS to be a structure on systems with gcc in order to make it type incompatible with BOOL so we catch errors sooner. This has already found a number of bugs -
Andrew Tridgell
83d9896c1e converted smbd to use NTSTATUS by default
major changes include:

- added NSTATUS type
- added automatic mapping between dos and nt error codes
- changed all ERROR() calls to ERROR_DOS() and many to ERROR_NT()
  these calls auto-translate to the client error code system
- got rid of the cached error code and the writebmpx code

We eventually will need to also:
- get rid of BOOL, so we don't lose error info
- replace all ERROR_DOS() calls with ERROR_NT() calls

but that is too much for one night
-
Jeremy Allison
bd9cbf4c68 Ignore locks of length zero as they mean different things in Win32
and POSIX.
Jeremy.
-
Jeremy Allison
f5ba19c129 Don't use CLEAR_IF_FIRST if opening read-only.
Jeremy.
-
Andrew Tridgell
98b6aef18c we now have all but the dreaded 0/0 lock working -
Andrew Tridgell
5498da6664 0 byte lock ranges ARE valid -
Jeremy Allison
27d3dd0e7c Tidyup fixes for fcntl spin problem.
Jeremy.
-
Jeremy Allison
fe4aa72018 Fixed the (incorrect) paranioa fix I put in for the fcntl lock spin.
Don't delete a share mode that failed to remove the oplock (doh!),
just set the oplock entry to zero....
Jeremy.
-
Jeremy Allison
e4a57fb456 Missed uninitialized variable return for del_share_mode().
Jeremy.
-
Volker Lendecke
1c94fa8064 This is Jeremy pretending to be Volker, 'cos the
link from Seattle is having problems.
I've added 3 things here to work on the fcntl spin
problem.
1). Check *all* tdb return codes... :-).
2). If we're asking ourselves to break an oplock, and we can't
find a fsp pointer that matches the entry, this is a *logic bug*
and we should abort and panic so someone with gdb can pick up
the pieces.
3). After we've broken an oplock, ensure that the entry itself
has been removed, and if not remove it ourselves. This should
not be neccessary in a correctly working environmen,t, but will
provide an added layer of robustness in error situations.
4). I hate german keyboards :-) :-).
Jeremy.
-
Jeremy Allison
41066208ad Ensure we are very explicit about what we're comparing when
we're comparing structures (ie. don't just do a memcmp). I
don't think this will fix the fcntl spin issue, but it's a
"just in case" change.
Jeremy.
-
Jeremy Allison
befbfea210 Add printing of errno when POSIX lock requests fail.
Jeremy.
-