summaryrefslogtreecommitdiff
path: root/source4/ntvfs/posix/pvfs_open.c
AgeCommit message (Collapse)AuthorFilesLines
2007-10-10r3631: a couple of tweaks to the talloc hierarchy for async requests inAndrew Tridgell1-0/+2
pvfs. This prevents a possible crash due to free ordering on unexpected disconnect. (This used to be commit bfca9eb7cb7a2caf3a232d538808ff2ade8e1ca9)
2007-10-10r3618: - this adds the special case for DENY_DOS semantics, as shown by the ↵Andrew Tridgell1-35/+119
BASE-DENYDOS test. - pvfs now passes BASE-DENY1 and BASE-DENYDOS. (This used to be commit aa09df22ee729c02552638859236d9068e9748ae)
2007-10-10r3615: split out struct pvfs_file_handle from struct pvfs_file. This is inAndrew Tridgell1-111/+151
preparation for adding code to pass the BASE-DENY1 and BASE-DENYDOS tests, which require a shared filesystem handle for some specific combinations of two DENY_DOS opens on the same connection. (This used to be commit 6e4fdf01d19051e3923d7703dbf990fc1722b09a)
2007-10-10r3595: - fixed a talloc_free ordering problem on cleanup with pending requestsAndrew Tridgell1-0/+10
- added initial support for MODE_INFORMATION in setfileinfo (I have no idea what "mode information" on a file is - it takes a value of 0, 2, 4 or 6. What could it be?) (This used to be commit e53ec2f6b68e1d19149c36ea8fcd25a204db38fb)
2007-10-10r3580: - on file overwrite in ntcreatex we need to replace the file permissions.Andrew Tridgell1-0/+16
- pvfs now passes BASE-OPENATTR - pvfs also passes the BASE-DEFER_OPEN test, but it is not a well formed test for regular running so I am removing it from the list of tests to run in test_posix.sh (the test is covered better by RAW-MUX anyway) (This used to be commit cb76bd218ed4194ea151264d495aa902ddf03b3c)
2007-10-10r3574: the RAW-OPEN test changes broke a couple of the other tests. ThisAndrew Tridgell1-1/+26
fixes most of them, although RAW-SEARCH still fails (due to an interaction with the new xattr code) (This used to be commit 09b4652b40c4cfca027765178bd5a0adbaa666c2)
2007-10-10r3573: added trans2open support to smbd and pvfs, and fine-tuned the ↵Andrew Tridgell1-0/+37
open->generic ntvfs mapping code. (This used to be commit ed844192d7f7ed487290f719df65f256a5b0b9bc)
2007-10-10r3550: fixed initial attribute on file create (inlusion of ↵Andrew Tridgell1-2/+4
FILE_ATTRIBUTE_ARCHIVE) (This used to be commit b07feaafd16e42e84ba51004a6a9d4a3cb8f9a37)
2007-10-10r3549: added support for DOS extended attribute lists (name/value pairs)Andrew Tridgell1-5/+5
stored in posix xattrs (This used to be commit bad6a88371264cffce2bf5d6ce904b7b357081de)
2007-10-10r3545: initial support for using extended attributes to hold extended dos ↵Andrew Tridgell1-1/+13
attributes of files. I decided to use IDL/NDR to encode the attribute, as it gives us a simple way to describe and extend the saved attributes. The xattr code needs to hook into quite a few more places in the pvfs code, but this at least gets the basics done. I will start encoding alternate data streams streams, DOS EAs etc soon using the same basic mechanism. I'll probably stick to "version 1" for the xattr.idl for quite a while even though it will be changing, as I don't expect anyone to be deploying this in production just yet. Once we have production users we will need to keep compatibility by supporting all the old version numbers in xattr.idl. (This used to be commit c54253ed1b7dce1d14f43e747da61089aea87094)
2007-10-10r3540: added testing of SMBntcancel in the open/open/close muxAndrew Tridgell1-2/+8
testing. Interestingly, w2k3 does not allow the cancel of an outstanding async open request, whereas it does allow the cancel of an outstanding async lock request. To support this I have changed the pvfs_wait interface to provide a enum on why the event is happening, so the callback can decide what to do. (This used to be commit f23d6a28008a13588cde24b5012ec21e488ac47a)
2007-10-10r3539: much nicer async open delay code.Andrew Tridgell1-95/+83
The previous code didn't handle the case where the file got renamed or deleted while waiting for the sharing violation delay. To handle this we need to make the 2nd open a full open call, including the name resolve call etc. Luckily this simplifies the logic. I also expanded the RAW-MUX test to include the case where we do open/open/open/close/close, with the 3rd open async, and that open gets retried after both the first close and the 2nd close, with the first retry failing and the 2nd retry working. The tests the "async reply after a async reply" logic in pvfs_open(). (This used to be commit eded2ad9c91f5ba587ef4f7f5f5a6dceb4b51ff3)
2007-10-10r3532: make sharing violation delay in pvfs configurable with ↵Andrew Tridgell1-3/+1
"posix:sharedelay = usecs" (This used to be commit c4758776491e5ed9f5b8c387226d1e75bc70eb2e)
2007-10-10r3528: added support for the SMBntcancel() operation, which cancels anyAndrew Tridgell1-1/+0
outstanding async operation (triggering an immediate timeout). pvfs now passes the RAW-MUX test (This used to be commit 3423e2f41461d054067ef168b9b986f62cc8f77c)
2007-10-10r3507: - added deferred replies on sharing violation in pvfs open. TheAndrew Tridgell1-55/+199
deferred reply is short-circuited immediately when the file is closed by another user, allowing it to be opened by the waiting user. - added a sane set of timeval manipulation routines - converted all the events code and code that uses it to use struct timeval instead of time_t, which allows for microsecond resolution instead of 1 second resolution. This was needed for doing the pvfs deferred open code, and is why the patch is so big. (This used to be commit 0d51511d408d91eb5f68a35e980e0875299b1831)
2007-10-10r3463: separated out some more headers (asn_1.h, messages.h, dlinklist.h and ↵Andrew Tridgell1-0/+1
ioctl.h) (This used to be commit b97e395c814762024336c1cf4d7c25be8da5813a)
2007-10-10r3455: some more portability fixes. We nearly compile on solaris again now.Andrew Tridgell1-0/+1
(This used to be commit 4f33247f1ca60416415a61a7afac43c9dc8a61fd)
2007-10-10r3447: more include/system/XXX.h include filesAndrew Tridgell1-0/+1
(This used to be commit 264ce9181089922547e8f6f67116f2d7277a5105)
2007-10-10r3387: fixed pvfs to pass the NTDENY tests. The tricky bit wasAndrew Tridgell1-4/+4
SA_RIGHT_FILE_EXECUTE, which depends on a flags2 bit (This used to be commit c36851d230bcf552ed79322f8358060ab164ec09)
2007-10-10r3373: added better error reporting in pvfs_openAndrew Tridgell1-6/+6
(This used to be commit 22abdfca961a00e7c48ba4231e12f254781d315d)
2007-10-10r3363: added basic support for SA_RIGHT_FILE_EXECUTE, needed for opening ↵Andrew Tridgell1-18/+12
.dll files (This used to be commit ba1bfd51e1b694cb69afe559f695addaf03b4d81)
2007-10-10r3249: - change_time is closer to ctime than mtimeAndrew Tridgell1-0/+4
- pvfs now passes the RAW-CLOSE test (This used to be commit 98aea91ce67a0c64a98537bfe244495f10672323)
2007-10-10r3246: new files should get created with FILE_ATTRIBUTE_ARCHIVEAndrew Tridgell1-1/+1
(This used to be commit 090574c6982f703b124a5a123d2199be8f5b3968)
2007-10-10r3240: - update the rules for what error codes should be given on theAndrew Tridgell1-3/+5
different type of unlink an seach mismatches - wildcard directory listings that have attribute FILE_ATTRIBUTE_DIRECTORY and match "." or ".." should be failed. - don't set the write_time on SMBclose unless it is non-zero - added much better support for setfileinfo and setpathinfo in pvfs - better (and more efficient) handling of .. and . components in filenames (This used to be commit 9305b07af395a158cb9f0c1c9486f7122c79d357)
2007-10-10r3200: - improved the accuracy of openx emulation. We now nearly pass the ↵Andrew Tridgell1-5/+2
openx portion of RAW-OPEN - fixed directory size reporting to make it consistent. we now pass the ntcreatex portion of RAW-OPEN (This used to be commit 6282e5811b8d4f1c17152d86875ac60d1323779d)
2007-10-10r3193: improved the initial permissions choice for file create, based upon ↵Andrew Tridgell1-9/+27
dos attribute (This used to be commit f6fb1e3493a2a0734747f769cd1013215d967cde)
2007-10-10r3189: improved the share_conflict() logic (both in terms of readability andAndrew Tridgell1-4/+11
correctness). pvfs now passes the BASE-RENAME test. (This used to be commit 4cf3f65a5c19fdad62a0bdef225b2d9002cf8c8b)
2007-10-10r3180: - basic support for SEC_RIGHT_MAXIMUM_ALLOWED in pvfsAndrew Tridgell1-2/+14
- RAW-CONTEXT test now passes (This used to be commit 0dae9fef09ec8bce19c39a0caf36e0882e507bc4)
2007-10-10r3178: honor the write_time on pvfs_close()Andrew Tridgell1-0/+5
(This used to be commit 4e28c45bafa453eaa94716a5b77d830b81efe6cf)
2007-10-10r3174: added pvfs_is_open() to allow us to check for open files on unlink. WeAndrew Tridgell1-0/+17
now pass BASE-UNLINK. (This used to be commit f23a2f8538bda8f6790e86c93ee22436388b2975)
2007-10-10r3161: pvfs now passes the RAW-SEEK testAndrew Tridgell1-0/+6
(This used to be commit a953d4a42c8fa3fe930c319d5157fc406a1035da)
2007-10-10r3159: use easy to recognise file handle numbers for new file, old file and ↵Andrew Tridgell1-9/+17
directory in pvfs_open, to make analysing sniffs easy (This used to be commit 5c16ed02542f7e143d66f4ba8d166bb6882bf53a)
2007-10-10r3154: pvfs now passes all of BASE-DELETEAndrew Tridgell1-2/+24
(This used to be commit abbfca1401818edd896493ab9c875224e3b7e0e7)
2007-10-10r3153: pvfs now passes the first 9 of the BASE-DELETE testsAndrew Tridgell1-27/+75
(This used to be commit f8041feaebc9170763ce04d2dd90cfc1c7889c21)
2007-10-10r3147: added basic share modes support for pvfs (or more precisely, ntcreatexAndrew Tridgell1-40/+91
share_access support). This is enough for us to pass the BASE-DENY2 test, but is a long way from fully correct share modes. (This used to be commit b5a6dd3cbf28a3a3b3a3656042ac8f50fca29e1c)
2007-10-10r3142: fill in all the ntcreatex response fields explicitly, rather thanAndrew Tridgell1-35/+41
zeroing. This makes it clearer what bits are not yet implemented (and is more valgrind friendly) (This used to be commit 18b471327b596f3ea8f6a7b39ba0a83b2584ed0b)
2007-10-10r3135: split the "create new" logic out from the "open existing" logic inAndrew Tridgell1-27/+186
pvfs_open, and handle the various race conditions that are inherent in cifs on unix, so we do the best we can when the race happens. the ntcreatex code is really starting to take shape now (This used to be commit 395c3815b468ae55de9a1135e478711f0e7d8cfc)
2007-10-10r3081: several updates to ntvfs and server side async request handling inAndrew Tridgell1-44/+157
preparation for the full share modes and ntcreatex code that I am working on. highlights include: - changed the way a backend determines if it is allowed to process a request asynchronously. The previous method of looking at the send_fn caused problems when an intermediate ntvfs module disabled it, and the caller then wanted to finished processing using this function. The new method is a REQ_CONTROL_MAY_ASYNC flag in req->control_flags, which is also a bit easier to read - fixed 2 bugs in the readbraw server code. One related to trying to answer a readbraw with smb signing (which can't work, and crashed our signing code), the second related to error handling, which attempted to send a normal SMB error packet, when readbraw must send a 0 read reply (as it has no header) - added several more ntvfs_generic.c generic mapping functions. This means that backends no longer need to implement such esoteric functions as SMBwriteunlock() if they don't want to. The backend can just request the mapping layer turn it into a write followed by an unlock. This makes the backends considerably simpler as they only need to implement one style of each function for lock, read, write, open etc, rather than the full host of functions that SMB provides. A backend can still choose to implement them individually, of course, and the CIFS backend does that. - simplified the generic structures to make them identical to the principal call for several common SMB calls (such as RAW_WRITE_GENERIC now being an alias for RAW_WRITE_WRITEX). - started rewriting the pvfs_open() code in preparation for the full ntcreatex semantics. - in pvfs_open and ipc_open, initially allocate the open file structure as a child of the request, so on error we don't need to clean up. Then when we are going to succeed the open steal the pointer into the long term backend context. This makes for much simpler error handling (and fixes some bugs) - use a destructor in the ipc backend to make sure that everthing is cleaned up on receive error conditions. - switched the ipc backend to using idtree for fnum allocation - in the ntvfs_generic mapping routines, use a allocated secondary structure not a stack structure to ensure the request pointer remains valid even if the backend replies async. (This used to be commit 3457c1836c09c82956697eb21627dfa2ed37682e)
2007-10-10r3064: - use UINT8_MAX and UINT16_MAX instead of hex values for ↵Andrew Tridgell1-1/+1
idr_get_new() limits - change idr_get_new() to use > instead of >= in the limit check (This used to be commit 834b09929bcb8aabdd151b7c2306001497cabdb4)
2007-10-10r3056: added a id -> pointer data structure (a type of radix tree). This isAndrew Tridgell1-30/+33
an extremely efficient way of mapping from an integer handle (such as an open file handle) to a pointer (such as the structure containing the open file information). The code is taken from lib/idr.c in the 2.6 Linux kernel, and is very fast and space efficient. By using talloc it even has auto cleanup. This commit converts the handling of open file handles and open directory search handles to use the idtree routines. In combination with talloc destructors, this simplifies the structure handling in the pvfs backend a lot. For example, we no longer need to keep a linked list of open directory searches at all, and we no longer need to do linear scans of the list of open files on most operations. The end result is that the pvfs code is now extremely scalable. You can have 10s of thousands of open files and open searches and the code still runs very fast. I have also added a small optimisation into the file close path, to avoid looking in the byte range locking database if we know that there are no locks outstanding. (This used to be commit 16835a0ef91a16fa01145b773aad8d43da215dbf)
2007-10-10r3034: - fixed a bug in message dispatch, when the dispatch function called ↵Andrew Tridgell1-0/+4
messaging_deregister() - added a pvfs_lock_close_pending() hook to remove pending locks on file close - fixed the private ptr argument to messaging_deregister() in pvfs_wait - fixed a bug in continuing lock requests after a lock that is blocking a pending lock is removed - removed bogus brl_unlock() call in lock continue - corrected error code for LOCKING_ANDX_CHANGE_LOCKTYPE - expanded the lock cancel test suite to test lock cancel by unlock and by close - added a testsuite for LOCKING_ANDX_CHANGE_LOCKTYPE (This used to be commit 5ef80f034d4aa4dd6810532c63ad041bfc019cb8)
2007-10-10r3031: added support for lock cancelation, which effectively just triggers ↵Andrew Tridgell1-0/+1
an early lock timeout added support for more of the bizarre special lock offset semantics of w2k3 (This used to be commit d5bfc910b1200fb283e26572dc57fcf93652fd32)
2007-10-10r3029: implemented byte range lock timeouts.Andrew Tridgell1-2/+4
This adds a pvfs_wait_message() routine which uses the new messaging system, event timers and talloc destructors to give a nice generic async event handling system with a easy to use interface. The extensions to pvfs_lock.c are based on calls to pvfs_wait_message() routines. We now pass all of our smbtorture locking tests, although while writing this code I have thought of some additonal tests that should be added, particularly for lock cancel operations. I'll work on that soon. This commit also extends the smbtorture lock tests to test the rather weird 0xEEFFFFFF locking semantics that I have discovered in win2003. Win2003 treats the 0xEEFFFFFF boundary as special, and will give different error codes on either side of it. Locks on both sides are allowed, the only difference is which error code is given when a lock is denied. Anyone like to hazard a guess as to why? It has me stumped. (This used to be commit 4395c0557ab175d6a8dd99df03c266325949ffa5)
2007-10-10r3012: added initial support for byte range locking in the posix vfs. This isAndrew Tridgell1-0/+19
enough for us to pass locktest, but does not yet support lock timeouts and some of the other esoteric features. (This used to be commit 58a92abd88f190bc60894a68e0528e95ae33fe39)
2007-10-10r2926: name->dos.attrib is not valid unless name->exists is trueAndrew Tridgell1-2/+4
(This used to be commit f85a0b725d3bf67531e6874d4e8558fb050bb66f)
2007-10-10r2916: longhorn client doesn't bother setting the directory bit in ntcreatexAndrew Tridgell1-1/+6
when opening directories. This change allows samba4 server to work with longhorn client. (This used to be commit 4a8b0302eff37ccfcb66b91259ee5da20879c652)
2007-10-10r2751: this is a new ntvfs design which tries to solve:Stefan Metzmacher1-13/+16
- the stacking of modules - finding the modules private data - hide the ntvfs details from the calling layer - I set NTVFS_INTERFACE_VERSION 0 till we are closer to release (because we need to solve some async problems with the module stacking) metze (This used to be commit 3ff03b5cb21bb79afdd3b1609be9635f6688a539)
2007-10-10r2660: - converted the libcli/raw/ library to use talloc_increase_ref_count()Andrew Tridgell1-2/+51
rather than manual reference counts - properly support SMBexit in the cifs and posix backends - added a logoff method to all backends With these changes the RAW-CONTEXT test now passes against the posix backend (This used to be commit c315d6ac1cc40546fde1474702a6d66d07ee13c8)
2007-10-10r2613: use a talloc destructor to ensure that file descriptors are not leakedAndrew Tridgell1-2/+26
on abnormal termination of a connection. As long as the top level connection structure is freed then that should cascade down to the file structure, and call this destructor which will close the open file descriptor. In general I'd like to use this technique in any place in Samba4 where we hold operating system resources that we need to make sure are released on abnormal termination. (This used to be commit ed87b7fcbd9fedc155528ce6dd8ab5d5fce637b2)
2007-10-10r2561: completely redid the ntvfs module chaining code, You can now do ↵Andrew Tridgell1-3/+3
something like: ntvfs handler = nbench posix and the nbench pass-thru module will be called before the posix module. The chaining logic is now much saner, and less racy, with each level in the chain getting its own private pointer rather than relying on save/restore logic in the pass-thru module. The only pass-thru module we have at the moment is the nbench one (which records all traffic in a nbench compatibe format), but I plan on soon writing a "unixuid" pass-thru module that will implement the setegid()/setgroups()/seteuid() logic for standard posix uid handling. This separation of the posix backend from the uid handling should simplify the code, and make development easier. I also modified the nbench module so it can do multiple chaining, so if you want to you can do: ntvfs module = nbench nbench posix and it will save 2 copies of the log file in /tmp. This is really only useful for testing at the moment until we have more than one pass-thru module. (This used to be commit f84c0af35cb54c8fdc4933afefc18fa4c062aae4)