summaryrefslogtreecommitdiffstats
path: root/source/locking
Commit message (Collapse)AuthorAgeFilesLines
* the first cut of the internal messaging system.Andrew Tridgell2000-09-111-1/+1
| | | | | The motivation for this system is to replace the UDP message for oplocks, but this commit only does the "set debug level" message.
* allow posix locking database to be opened read-only (for smbstatus)Andrew Tridgell2000-06-132-11/+11
|
* add some bracketsAndrew Tridgell2000-06-131-1/+1
|
* Fixed misunderstanding found during CIFS conference. Overlapping lockJeremy Allison2000-05-251-340/+278
| | | | | | ranges (not just included lock ranges) should be handled correctly. UNIT test still needed. Jeremy.
* Using a structure for a tdb key can lead to insideous, hardHerb Lewis2000-05-103-20/+25
| | | | | | | | | | | | | | | | | to find bugs. On 64 bit IRIX, structure packing means that a struct { SMB_DEV_T dev /* 4 bytes */ SMB_INO_T ino /* 8 bytes */ } has 4 bytes of padding between the two members. If you don't null the memory before using it as a tdb key, you randomly can't find keys depending on what is in the padding. This caused me immense pain and was hard to track down.... :-) Jeremy.
* Fix for uninitialized memory read in brlock code. brl_locktest now needsJeremy Allison2000-05-052-2/+3
| | | | | to correctly set the fnum, as the brl_conflict code looks at it. Jeremy.
* Two fixes. Added missong logic & case in lock split code.Jeremy Allison2000-05-051-4/+12
| | | | | Fixed range split into two, as DLIST_ADD has the wrong semantics... Jeremy.
* Updated to fix overlapping problem.Jeremy Allison2000-05-041-68/+142
| | | | Jeremy.
* Fix for debug statement crash.Jeremy Allison2000-05-041-1/+1
| | | | Jeremy.
* Fix based on Elrond's code to reduce the store size on removing dead records.Jeremy Allison2000-05-031-0/+1
| | | | Jeremy.
* Fixed the bug locktest.c found, it was an off-by-one error in the non-overlapJeremy Allison2000-05-031-1/+1
| | | | | case. Jeremy.
* Fixed silly bug where I wasn't checking for matching fd's in closing a file.Jeremy Allison2000-05-031-7/+24
| | | | | This caused smbd crashes on SIGKILL. Jeremy.
* Added range info to the panic message to track down the bug withJeremy Allison2000-05-031-1/+5
| | | | | locktest. Jeremy.
* - clear dead locks at startupAndrew Tridgell2000-05-031-2/+47
| | | | - fixed a bug which caused lock records to not decrease in size
* Fix for stacking locks in brlock and POSIX. Windows only allows a read lockJeremy Allison2000-05-032-92/+130
| | | | | | | | to overlay a write lock on the same fnum. When overlaying read locks onto a write lock, the number of locks is counted, and the first unlock removes the write lock and downgrades this to a read lock. Do the same when mapping to POSIX. Jeremy.
* Implemented the last (I hope:-) part of the locking puzzle, the referenceJeremy Allison2000-05-021-23/+90
| | | | | | | counting when Windows downgrades a write lock to a read lock, then reference counts the unlocks to match the locks. With this code the POSIX unlock isn't done until the final Windows unlock. Jeremy.
* split the username in the vuser structure into a separateAndrew Tridgell2000-05-021-1/+2
| | | | | | | | userdom_struct. As the name implies this also contains a domain (unused at the moment). This will be important shortly, as operation in appliance mode needs the domain to be always carried with the username.
* Moved uglyness needed in fcntl locking (64->32 bit mapping, NFSJeremy Allison2000-05-021-3/+121
| | | | | | | errors etc.) into locking/posix.c, where it is needed. fcntl_lock in lib/util.c is now very small and clean. Added (*lock) op to vfs layer. Jeremy.
* Added sys_fork() and sys_getpid() functions to stop the overheadJeremy Allison2000-05-021-8/+8
| | | | | of doing a system call every time we want to just get our pid. Jeremy.
* locking/posix.c: Fixed double-free nasty crash bug found by insure.Jeremy Allison2000-05-011-3/+0
| | | | | | utils/make_smbcodepage.c: utils/make_unicodemap.c: Insure 'make install' fixes. Jeremy.
* added TDB_INTERNAL, TDB_NOLOCK and TDB_NOMMAP flags.Andrew Tridgell2000-05-011-3/+3
| | | | TDB_INTERNAL replaces the old method of passing a null filename
* - removed all our old wildcard matching code and replaced it with aAndrew Tridgell2000-04-301-2/+2
| | | | | | | | | | | | | | | | call to ms_fnmatch(). This also removes all the Win9X semantics stuff and a bunch of other associated cruft. - moved the stat cache code into statcache.c - fixed the uint16 alignment requirements of ascii_to_unistr() and unistr_to_ascii() - trans2 SMB_FIND_FILE_BOTH_DIRECTORY_INFO returns the short name as unicode always (at least thats what NT4 does) - fixed some errors in the in-memory tdb code. Still ugly, but doesn't crash as much
* Removed tdb locking calls (picky Andrew...:-)Jeremy Allison2000-04-291-25/+12
|
* Ok - this is the *third* implementation of this (third time's the charm :-).Jeremy Allison2000-04-283-1122/+137
| | | | | | | | | | | | | | | | | This implementation keeps all POSIX lock records in a separate in memory tdb database only known about in locking/posix.c. In addition, the pending close fd's are also held in a tdb which has an array of fd's indexed by device and inode. The walk-split code uglyness has been moved to posix.c from brlock.c, which is the only place that needs to know about it, and the extra functions hacked into brlock to expose internal state have been removed. This implementation passes smbtorture locktest4, the only thing I need to check now for completeness is what to do about lock upgrade/downgrades which Win32 allows under some *very* strange circumstances. Jeremy.
* Split off of POSIX locking into separate unit as Andrew requested.Jeremy Allison2000-04-281-0/+1208
| | | | | Done so I don't lose my edits... :-). Jeremy.
* Forgot to close when "posix locking" is set to False.Jeremy Allison2000-04-281-2/+5
| | | | Jeremy.
* Added optimization where we are single opener (don't free POSIX locks).Jeremy Allison2000-04-281-1/+21
| | | | Jeremy.
* Made changes suggested by Andrew review.Jeremy Allison2000-04-281-37/+52
| | | | | | | fd_close now calls fd_close_posix() directly. set_posix_lock/release_posix_lock() now handle the reference counting. More changes due when this gets moved to the file locking/posix.c Jeremy.
* Ok - this is more subtle than it looks :-).Jeremy Allison2000-04-272-7/+15
| | | | | | | | | | | | | | | When a file is being closed, once it passes the fnum and tid tests then the locking context should be ignored when removing all locks. This is what is done in the brl close case, but when you have outstanding POSIX locks, then you cannot remove all the brl locks in one go, you have to get the lock list and call do_unlock individually. As this uses global_smbpid as the locking context, you need to make sure that this is set correctly for the specific lock being removed. I now do this by storing the smbpid in each entry in the unlock list returned from the query call. I removed the smbpid from fsp (not needed) and things seem ok (even with the stupid smbpid tricks that smbtorture plays :-). Jeremy.
* Fixed subtle unlocking bug when a file is closed. We need to store theJeremy Allison2000-04-272-16/+32
| | | | | | | | smbpid used when a file was opened in the files_struct. Else we use the wrong global_smbpid when we are closing the file and trying to remove the brl locks - this causes the brl locks to be left when the file is closed as the samba_context check fails. Jeremy.
* Did the rewrite Andrew wanted where all knowledge of POSIX locking isJeremy Allison2000-04-271-5/+179
| | | | | | | | | | removed from the smbd/open.c code. We now use a dlink list of structures indexed by dev/inode to store all pending fd's for close. This could be rewritten to use lib/hash.c if this is discovered to be too slow in use. Andrew, please take a look and let me know if this is what you had in mind. Jeremy.
* Fixed crash bugs Andrew pointed out with LOCK4 smbtortureJeremy Allison2000-04-271-10/+7
| | | | | | | test. Was miscounting posix locks, plus was not taking into account the case where other_fsp == fsp in the 'move locks' case. DOH ! This code will be re-written anyway :-). Jeremy.
* Added the hard code :-).Jeremy Allison2000-04-252-77/+453
| | | | | | | | | | HEAD should now map brl locks correctly into POSIX locks, including the really nasty case of large range unlock. There is a lot of pretty ASCII art in locking/brlock.c explaining exactly how this code works. If it is unclear, please ask me. Jeremy.
* Added the code that keeps fd's open across a close if there are other fsp'sJeremy Allison2000-04-241-36/+23
| | | | | | | | | | | | | | | open on the same dev/inode pair with existing POSIX locks. This is done at the smbd/open layer, so smbd just calls fd_close() and the transfer of any open fd's is done under the covers of fd_close(). When an fsp is closed and no other fsp's open on the same dev/inode pair have existing POSIX locks then all fd's associated with this fsp are closed. Now only the hard part of doing the POSIX range unlock code when read locks overlap remains for full POSIX/SMB lock integration.... Jeremy.
* fixed a locking database bug - it was actually harmless except thatAndrew Tridgell2000-04-231-2/+10
| | | | | smbstatus could display the wrong filename when files change dev/inum after a rename
* This is a *big* checkin that may break some things, but implements theJeremy Allison2000-04-221-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | new open mechanism Andrew & I discussed. config.sub: configure: Included the QNX patch. include/vfs.h: smbd/vfs-wrap.c: smbd/vfs.c: Added ftruncate vfs call (needed). Note that we will also need locking calls in the vfs (to be added). lib/util_unistr.c: nmbd/nmbd_processlogon.c: Fix for NT domain logons causing nmbd to core dump. Also fix for sidsize DOS bug. locking/locking.c: Check value of ret before using it for memdup. printing/printing.c: Convert print_fsp_open to return an allocated fsp. rpc_server/srv_lsa.c: Fix for NT domain logons. I have removed all use of lp_share_modes() from the code (although I left the parameter in the table for backwards compatibility). It no longer makes sense for this to exist. smbd/close.c: Removed lp_share_modes(). smbd/fileio.c: Fixed parameters to unlock_share_entry call in panic code. smbd/files.c: Correctly set the unix_ERR_code to ERRnofids on fsp allocation fail. smbd/nttrans.c: smbd/reply.c: smbd/trans2.c: Changed all occurrences of open_file_shared/open_directory/ open_file_stat to return an fsp from the call. smbd/open.c: Changed all occurrences of open_file_shared/open_directory/ open_file_stat to return an fsp from the call. In addition I have fixed a long standing race condition in the deny mode processing w.r.t. two smbd's creating a file. Andrew, please note that your original idea of using open with O_EXCL in this case would not work (I went over the races very carefully) and so we must re-check deny modes *after* the open() call returns. This is because there is a race between the open with O_EXCL and the lock of the share mode entry. Imagine the case where the first smbd does the open with O_EXCL and a deny mode of DENY_ALL, but is pre-empted before it locks the share modes and creates the deny mode entry for DENY_ALL. A second smbd could then come in with O_RDONLY and a deny mode of DENY_NONE and the two opens would be allowed. The *only* way to fix this race is to lock the share modes after the open and then do the deny mode checks *after* this lock in the case where the file did not originally exist. This code will need extensive testing but seems to initially work. Jeremy.
* locking/locking.c: Fixed placeholder code for POSIX locking.Jeremy Allison2000-04-181-17/+49
| | | | | | | | printing/printing.c: Cast tdb_delete to (tdb_traverse_func) to stop warning. tmpfile gives mirror warning. smbd/groupname.c: Remember to file_lines_free() on exit. tdb/tdb.h: Add tdb_traverse_func typedef. Jeremy
* Typo - missing '}'.Jeremy Allison2000-04-131-0/+1
| | | | Jeremy.
* Removed "ole locking compat" parameter (no longer used).Jeremy Allison2000-04-121-18/+113
| | | | | | We now get/set/check POSIX locks, but I still need to code up the close fd braindamage... Jeremy.
* Implmented mapping of lock offset/count from 64 bit MS rangesJeremy Allison2000-04-121-13/+157
| | | | | | to either 63 or 31 bit POSIX ranges. Code to get these locks not yet added. Jeremy.
* Code to map tdb locks onto POSIX. Mainly placeholder code at the moment,Jeremy Allison2000-04-121-9/+157
| | | | | | but the structure is done enough so that Andrew can look it over and give a yea/nay decision. Jeremy.
* include/byteorder.h: ALIGN4/ALIGN2 macros.Jeremy Allison2000-04-111-3/+3
| | | | | | | | | | | | include/includes.h: Added SMB_BIG_UINT_BITS. lib/util.c: Removed align2/align4 - use macros. libsmb/namequery.c: Use ALIGN2. locking/locking.c: Replace do_lock, do_unlock, args with SMB_BIG_UINT, not SMB_OFF_T. Needed to move to hiding POSIX locks at a lower layer. nmbd/nmbd_processlogon.c: Use ALIGN2/ALIGN4 macros. smbd/blocking.c: Replace do_lock, do_unlock, args with SMB_BIG_UINT, not SMB_OFF_T. smbd/reply.c: Replace do_lock, do_unlock, args with SMB_BIG_UINT, not SMB_OFF_T. Jeremy.
* the first of a bunch of changes to code with getting rid of the fd_ptrAndrew Tridgell2000-04-101-6/+23
| | | | | | element in the fsp pretty mechanical stuff, but it affects lots of files.
* Fixed compile warning in locking.c:traverse_fn()Tim Potter2000-02-071-1/+2
|
* 1) added void* state argument to tdb_traverse. guess what! there wereLuke Leighton2000-02-042-15/+10
| | | | | | | | | | | | | | | | | | two places i found where it was appropriate to _use_ that third argument, in locking.c and brlock.c! there was a static traverse_function and i removed the static variable, typecast it to a void*, passed it to tdb_traverse and re-cast it back to the traverse_function inside the tdb_traverse function. this makes the use of tdb_traverse() reentrant, which is never going to happen, i know, i just don't like to see statics lying about when there's no need for them. as i had to do in samba-tng, all uses of tdb_traverse modified to take the new void* state argument. 2) disabled rpcclient: referring people to use SAMBA_TNG rpcclient. i don't know how the other samba team members would react if i deleted rpcclient from cvs main. damn, that code's so old, it's unreal. 20 rpcclient commands, instead of about 70 in SAMBA_TNG.
* added code to allow traversal of the byte range lock databaseAndrew Tridgell2000-01-162-3/+43
| | | | this is used with "smbstatus -B" to dump the lock list
* damn, Solaris already has a "enum lock_type"Andrew Tridgell2000-01-142-6/+7
| | | | changed it to "enum brl_type"
* we now pass all byte range locking testsAndrew Tridgell2000-01-142-4/+72
| | | | | the last piece was to use a smb timeout slightly larger than the locking timeout in bloking locks to prevent a race
* some more work on the byte range lockingAndrew Tridgell2000-01-141-6/+8
| | | | | | | | note the ugly global_smbpid - I hope that won't bethere for long, I just didn't want to do two lots of major surgery at the one time. Using global_smbpid avoids the big change of getting rid of our inbuf/outbuf interface to reply routines. I'll do that once the locking stuff passes all tests.
* the bulk of the new byte range locking coodeAndrew Tridgell2000-01-132-45/+296
| | | | it doesn't map to posix locks yet, that will come later.