summaryrefslogtreecommitdiff
path: root/source3/smbd/fileio.c
AgeCommit message (Collapse)AuthorFilesLines
2009-03-01Only copy sharename up from rap_to_pjobidVolker Lendecke1-2/+1
Why?? :-) Another one of the little micro-optimizations that I just came across: If you allocate a variable in a sub-block like the "fstring sharename" in write_file(), gcc even with -O3 will allocate this variable unconditionally on the stack at the beginning of the routine. So with eliminating this fstring we cut 256 bytes of stack in a very hot code path writing to a file. It might make us a bit more cache-friendly. This would probably not be worth a second look if it involved larger code changes, but this one was just too simple to let it pass :-)
2009-02-09s3 oplocks: Make the level2 oplock contention API more granularTim Prouty1-1/+3
This replaces release_level2_oplocks_on_change with contend_level2_oplock_begin/end in order to contend level2 oplocks throughout an operation rather than just at the begining. This is necessary for some kernel oplock implementations, and also lays the groundwork for better correctness in Samba's standard level2 oplock handling. The next step for non-kernel oplocks is to add additional state to the share mode lock struct that prevents any new opens from granting oplocks while a contending operation is in progress. All operations that contend level 2 oplocks are now correctly spanned except for aio and synchronous writes. The two write paths both have non-trivial error paths that need extra care to get right. RAW-OPLOCK and the rest of 'make test' are still passing with this change.
2009-01-08s3:smbd: move all globals and static variables in globals.[ch]Stefan Metzmacher1-3/+1
The goal is to move all this variables into a big context structure. metze
2009-01-05s3:events: change event_add_timed() prototype to match samba4Stefan Metzmacher1-2/+1
metze
2008-12-23Fix more asprintf warnings and some error path errors.Jeremy Allison1-3/+6
Jeremy.
2008-09-12Modify a comment to make things clearer.Jeremy Allison1-1/+3
Jeremy. (This used to be commit 9d55ca85ffc73e3fa5fb9895fbcb1ee22f4e320d)
2008-09-08smbd: some write time fixesStefan Metzmacher1-8/+7
- only the first non truncating write causes the write time update with 2 seconds delay. It's not enough to check for an existing update event as it will be NULL after the event was triggered. - SMBwrite truncates always update the write time unless the sticky write time is set. - SMBwrite truncates don't trigger a write time update on close. metze (This used to be commit 3d17089b6dc773303c8c553f3f6140e60e348fb7)
2008-09-05Write times code update.Jeremy Allison1-8/+39
Ok, here's the fix for the write times breakage with the new tests in S4 smbtorture. The key is keeping in the share mode struct the "old_file_time" as the real write time, set by all the write and allocation calls, and the "changed_write_time" as the "sticky" write time - set by the SET_FILE_TIME calls. We can set them independently (although I kept the optimization of not setting the "old_file_time" is a "changed_write_time" was already set, as we'll never see it. This allows us to update the write time immediately on the SMBwrite truncate case, SET_END_OF_FILE and SET_ALLOCATION_SIZE calls, whilst still have the 2 second delay on the "normal" SMBwrite, SMBwriteX calls. I think in a subsequent patch I'd like to change the name of these from "old_file_time" to "write_time" and "changed_write_time" to "sticky_write_time" to make this clearer. I think I also fixed a bug in Metze's original code in that once a write timestamp had been set from a "normal" SMBwriteX call the fsp->update_write_time_triggered variable was set and then never reset - thus meaning the write timestamp would never get updated again on subsequent SMBwriteX's. The new code checks the update_write_time_event event instead, and doesn't update is there's an event already scheduled. Metze especially, please check this over for your understanding. Jeremy. (This used to be commit 6f20585419046c4aca1f7d6c863cf79eb6ae53b0)
2008-04-07smbd: make it possible to change the write time delay for testingStefan Metzmacher1-1/+7
metze (This used to be commit df8c100c2b53575a0d425a2daf52e2d59904746a)
2008-04-07smbd: implement the strange write time update logicStefan Metzmacher1-22/+38
We now never call file_ntimes() directly, every update is done via smb_set_file_time(). This let samba3 pass the BASE-DELAYWRITE test. The write time is only updated 2 seconds after the first write() on any open handle to the current time (not the time of the first write). Each handle which had write requests updates the write time to the current time on close(). If the write time is set explicit via setfileinfo or setpathinfo the write time is visible directly and a following close on the same handle doesn't update the write time. metze (This used to be commit 2eab212ea2e1bfd8fa716c2c89b2c042f7ba12ea)
2008-01-07Remove redundant parameter fd from SMB_VFS_FTRUNCATE().Michael Adam1-1/+1
Michael (This used to be commit 2ad66050a0452b8e7e08b1e7a01efa00c72fd451)
2008-01-07Remove redundant parameter fd from SMB_VFS_FSTAT().Michael Adam1-2/+2
Michael (This used to be commit 0b86c420be94d295f6917a220b5d699f65b46711)
2008-01-07Remove redundant parameter fd from SMB_VFS_FSYNC().Michael Adam1-1/+1
Michael (This used to be commit 8f83c9a7b245dbfef28195f9a7f33047a8ba95a0)
2008-01-07Remove unneeded parameter fd from SMB_VFS_PREAD().Michael Adam1-2/+2
Michael (This used to be commit 73e28806ce87d829ea7c38ed3440020845bb13bf)
2007-10-31Note when we're setting change time, not write time, and sendJeremy Allison1-1/+2
message accordingly. Apart from not supporting create time we now pass the S4 RAW-NOTIFY torture. Jeremy. (This used to be commit 8a77f520fa03afa60eac2aaeab4babe7dd8db4f0)
2007-10-31Fix some cases where file_set_dosmode was being passedJeremy Allison1-2/+7
False instead of NULL. Fix more of the notifications to be correct for Samba4 RAW-NOTIFY torture (we had missed one when calling set_ea_dos_attribute(). Jeremy. (This used to be commit 39d265375cf55eedddef2c4faa65398df73d5ed2)
2007-10-30Add new parameter, "min receivefile size" (by default setJeremy Allison1-12/+29
to zero). If non-zero, writeX calls greater than this value will be left in the socket buffer for later handling with recvfile (or userspace equivalent). Definition of recvfile for your system is left as an exercise for the reader (I'm working on getting splice working :-). Jeremy. (This used to be commit 11c03b75ddbcb6e36b231bb40a1773d1c550621c)
2007-10-18RIP BOOL. Convert BOOL -> bool. I found a few interestingJeremy Allison1-5/+5
bugs in various places whilst doing this (places that assumed BOOL == int). I also need to fix the Samba4 pidl generation (next checkin). Jeremy. (This used to be commit f35a266b3cbb3e5fa6a86be60f34fe340a3ca71f)
2007-10-10r24164: Fix for write cache corruption bug reported by Jean-Francois ↵Jeremy Allison1-10/+20
Panisset <panisset@A52.com>. Awaiting confirmation from reporter. Jeremy. (This used to be commit 7bd65060bd965bd17a5d79639cf561b8b578cb36)
2007-10-10r23784: use the GPLv3 boilerplate as recommended by the FSF and the license textAndrew Tridgell1-2/+1
(This used to be commit b0132e94fc5fef936aa766fb99a306b3628e9f07)
2007-10-10r23779: Change from v2 or later to v3 or later.Jeremy Allison1-1/+1
Jeremy. (This used to be commit 407e6e695b8366369b7c76af1ff76869b45347b3)
2007-10-10r23773: One pstring a day...Volker Lendecke1-3/+5
(This used to be commit 0c3016d32b5277b901788b13aa7d3f4b647728f2)
2007-10-10r23508: Fix sync_file() to return NTSTATUS and return thisJeremy Allison1-4/+11
on failure in the write path. Jeremy. (This used to be commit cd3f7dbee809fb40194af0e7509142166e02b252)
2007-10-10r21714: Change the VFS interface to use struct timespecJeremy Allison1-2/+2
for utimes - change the call to ntimes. This preserves nsec timestamps we get from stat (if the system supports it) and only maps back down to usec or sec resolution on time set. Looks bigger than it is as I had to move lots of internal code from using time_t and struct utimebuf to struct timespec. Jeremy. (This used to be commit 8f3d530c5a748ea90f42ed8fbe68ae92178d4875)
2007-10-10r17220: If we're going to fail a write with an errno, makeJeremy Allison1-1/+1
sure we return -1. Jeremy. (This used to be commit 89b83237b03066785ca4bf3b9d120519bddeffad)
2007-10-10r9985: Move the all the strict sync logic into file_sync().James Peach1-3/+6
(This used to be commit cc680bbe22b8bfc5a1900f11c2cbaeca3a9f9922)
2007-10-10r8219: Merge the new open code from HEAD to 3.0. Haven't yet run the tortureJeremy Allison1-21/+21
tests on this as it's very late NY time (just wanted to get this work into the tree). I'll test this over the weekend.... Jerry - in looking at the difference between the two trees there seem to be some printing/ntprinting.c and registry changes we might want to examine to try keep in sync. Jeremy. (This used to be commit c7fe18761e2c753afbffd3a78abff46472a9b8eb)
2007-10-10r7882: Looks like a large patch - but what it actually does is make SambaJeremy Allison1-1/+1
safe for using our headers and linking with C++ modules. Stops us from using C++ reserved keywords in our code. Jeremy (This used to be commit 9506b8e145982b1160a2f0aee5c9b7a54980940a)
2007-10-10r6949: Back-port Volker's cache fix, plus my change.Jeremy Allison1-0/+38
Jeremy. (This used to be commit 27d43f6d36b3f6abc368ec6a00ef9803cb27c324)
2007-10-10r6890: Refactor printing interface to take offset into job. Fixes bugJeremy Allison1-3/+3
where large print jobs can have out-of-order offsets. Bug found by Arcady Chernyak <Arcady.Chernyak@efi.com> Jeremy. (This used to be commit 482f7e0e3706098b71aa0b31a134994acb1e9fcf)
2007-10-10r6841: Attempt to fix buf #2681. With "strict allocate = yes" we now zeroJeremy Allison1-0/+5
fill when a file is extended. Should catch disk full errors on write from MS-Office. Jeremy. (This used to be commit 858824f37be443320487a8e28ec8fa172cdf5a18)
2007-10-10r6673: Fix the write cache based on some VERY good detective workJeremy Allison1-59/+80
from Ingo Kilian <ikilian@web.de>. You must do a make clean after updating this. Jeremy. (This used to be commit 3b2cd19fcb8ce38578b122fd6ae722b73081dcda)
2007-10-10r5731: Get delayed write semantics closer to W2K3. We need to store 2 times.Jeremy Allison1-0/+6
This may fix bug #2382. Jeremy. (This used to be commit a27c351e6beafc6609790a9bb9a3d0a1331e8f35)
2007-10-10r4088: Get medieval on our ass about malloc.... :-). Take control of all our ↵Jeremy Allison1-2/+2
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 620f2e608f70ba92f032720c031283d295c5c06a)
2007-10-10r4007: Fix bug #2088 - ensure inherit permissions is only applied on a new file,Jeremy Allison1-1/+1
not an existing one. Jeremy. (This used to be commit fbbdb72cf1adfe567112556626f26b031747f440)
2007-10-10r3895: Fix for bug #2045. May also fix other timestamp bugs with ExcelJeremy Allison1-0/+14
(Volker please test). Setting a last write timestamp from Windows overrides any subsequent write timestamp changes and must be immediately seen by and findfirst/findnexts. This is a racy solution, but should work most of the time. This may also fix #1061, not sure. Jeremy. (This used to be commit 47bab92c0b062f3fefbb4fd4a09852e1c829a7f9)
2007-10-10r3067: patch based on volker's initial work in trunk that fixes the queu ↵Gerald Carter1-2/+2
update problem when using the background daemon (This used to be commit de7af09e727e744aa27af85ef7c0f73ed5c1550a)
2004-04-02Added per-share parameter "store dos attributes". When set, will storeJeremy Allison1-2/+3
dos attributes in an EA. Based on an original patch from tridge, but modified somewhat to cover all cases. Jeremy. (This used to be commit ed653cd468213e0be901bc654aa3748ce5837947)
2004-01-06remove unused seek_file(); don't hardcode '\' when printing the auth-userGerald Carter1-25/+0
(This used to be commit fac5e05ca1b56cb6e3ab6537d0848fa373c00831)
2004-01-06Patch based on work from James Peach <jpeach@sgi.com> to convert over toJeremy Allison1-11/+12
using pread/pwrite. Modified a little to ensure fsp->pos is correct. Fix for #889. Jeremy. (This used to be commit 019aaaf0df091c3f67048f591e70d4353a02bb9b)
2003-11-02Printf fixes for 64-bit size_t.Tim Potter1-3/+3
(This used to be commit 8e2c543ebf65e24e73433f69b1c281e1558e9080)
2003-08-14Fix SMBseek and get/set position information SMBs. Works againstJeremy Allison1-2/+20
Samba4 tester. You will need a make clean; make all after this ! Jeremy. (This used to be commit 10d90171ed58bee3e5ab6476341059b585034134)
2003-05-14Prefix VFS API macros with SMB_ for consistency and to avoid problems with ↵Alexander Bokovoy1-7/+7
VFS_ macros at system side. We currently have one clash with AIX and its VFS_LOCK. Compiled and tested -- no new functionality or code, just plain rename of macros for yet-unreleased VFS API version. Needs to be done before a24 is out (This used to be commit c2689ed118b490e49497a76ed6a2251262018769)
2003-05-11Fix VFS layer:Alexander Bokovoy1-7/+7
1. Finally work with cascaded modules with private data storage per module 2. Convert VFS API to macro calls to simplify cascading 3. Add quota support to VFS layer (prepare to NT quota support) Patch by Stefan (metze) Metzemacher, with review of Jelmer and me Tested in past few weeks. Documentation to new VFS API for third-party developers to follow (This used to be commit 91984ef5caa2d13c5d52e1f535bd3bbbae1ec978)
2002-12-05The element in fsp->print_job should be a RAP jobid, not a uint32 RPCJeremy Allison1-2/+13
jobid. This was causing Win9x client "set name" calls to fail. Still need one cleanup fix to finish. Jeremy. (This used to be commit 6c23d2030ab8dddff4c849903c529f0012b94027)
2002-12-04Fix for 64 bit issues with oplocks and allocation size.Jeremy Allison1-20/+36
Jeremy. (This used to be commit 379e719e983fb71f94cd2b691f8b194c109496c3)
2002-10-21removed the following parametersGerald Carter1-7/+3
* postscript * printer driver * printer driver location * printer driver file also removed the get_a_printer_driver_9x_compatible() function (This used to be commit 743f2b8025effe57d8f075ff14a9357123c507a8)
2002-10-03Added ASCII art to make this clearer.Jeremy Allison1-1/+73
Jeremy. (This used to be commit 31c0dd7e213509c3bed1061f140f2ea9c6e95a9d)
2002-10-03Write cache bugfix from Rasmus Borup Hansen, system adm. Email: ↵Jeremy Allison1-0/+13
rbh@math.ku.dk Jeremy. (This used to be commit d40a14dbb0ec233f7a2190df1845b039072c4b84)
2002-08-17Sync 3.0 branch with headJelmer Vernooij1-1/+1
(This used to be commit 42615b945e2e48e53a21ea47f2e45407913a6a1e)