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

118 Commits

Author SHA1 Message Date
Jeremy Allison
bed323cebc s3 : smbd : Protect all possible code paths from fsp->op == NULL.
In changes to come this will be possible for an INTERNAL_OPEN_ONLY.
The protection was already in place for some code paths, this
makes the coverage compete.

Bug 10564 - Lock order violation and file lost

https://bugzilla.samba.org/show_bug.cgi?id=10564

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-05-02 21:27:07 +02:00
Garming Sam
61d4af550a param: rename lp function and variable from "syncalways" to "sync_always"
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-02-07 16:19:16 -08:00
Christof Schmitt
dfef0701c3 s3-aio: Use correct locking context for SMB2
The synchronous SMB2 reads and writes use open_persistent_id. The AIO
codepathes have to use the same, otherwise a write will conflict with a
lock on the same open file.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-12-05 18:22:16 -08:00
Christian Ambach
c9924ebccd s3:smbd/aio mark file as modified in the SMB2 case
Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2013-06-25 12:53:46 +02:00
Jeremy Allison
9791c1a248 Ensure we don't do an SMB2 aio write if RECVFILE is active.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan (metze) Metzmacher <metze@samba.org>
2013-04-19 14:10:14 -07:00
Christian Ambach
d6983f4704 s3:smbd/aio do not mark file modified during reads
this causes each file that is potentially just opened for reading to be
marked as modified and lots of file change notifications will be send

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Christian Ambach <ambi@samba.org>
Autobuild-Date(master): Tue Nov 20 21:02:34 CET 2012 on sn-devel-104
2012-11-20 21:02:34 +01:00
Volker Lendecke
8ef968a23d s3-aio: Panic if we try to close a fsp with outstanding aio requests
The core smbd must have taken care of this. If we don't do this properly,
we have a race of the close(2) against a pwrite(2). We might end up
writing to the wrong file.

Signed-off-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jul 19 03:40:17 CEST 2012 on sn-devel-104
2012-07-19 03:40:17 +02:00
Volker Lendecke
3e9f58be7e s3-smb1: Postpone close_file until all aio is handled
Thanks to Jeremy for this simple idea

Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:57:53 -07:00
Volker Lendecke
ed31e20115 s3-aio: Make the strict sync after write async
This restores cb405947ca, which was
lost during the refactoring of aio.c and vfs_aio_pthread.c.

Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:51:11 -07:00
Volker Lendecke
fd351b6ebb s3: Make us survive base-delaywrite with aio enabled
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:46:54 -07:00
Volker Lendecke
9dc78c90f3 s3-aio: Remove unused VFS functions and more
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:45:58 -07:00
Volker Lendecke
f9df073a31 s3: Make smbd/aio.c not depend on aio.h anymore
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:40:35 -07:00
Volker Lendecke
66eb7bc6ec s3: Remove the unused completion handling from aio.c
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:38:15 -07:00
Volker Lendecke
f5dc8837d9 s3: Properly handle shutdown with the _send/_recv based aio
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:37:28 -07:00
Volker Lendecke
aff6956d35 s3: Use SMB_VFS_PWRITE_SEND in schedule_smb2_aio_write
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:35:32 -07:00
Volker Lendecke
6df7ba3af9 s3: Use SMB_VFS_PREAD_SEND in schedule_smb2_aio_read
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:34:27 -07:00
Volker Lendecke
2bad405a4e s3: Use SMB_VFS_PWRITE_SEND in schedule_aio_write_and_X
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:33:22 -07:00
Volker Lendecke
7c32017064 s3: Use SMB_VFS_PREAD_SEND in schedule_aio_read_and_X
Signed-off-by: Jeremy Allison <jra@samba.org>
2012-07-18 15:13:04 -07:00
Jeremy Allison
cb405947ca Add an optimization to pthread aio writes to also do fsync if requested.
Should help by ensuring complete writes done in sub-thread, not in
the main thread.
2012-07-12 22:46:07 +02:00
Volker Lendecke
622eb59eb4 s3: Make us survive base-delaywrite with aio enabled
Signed-off-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jul 12 21:28:19 CEST 2012 on sn-devel-104
2012-07-12 21:28:19 +02:00
Volker Lendecke
5df1fda0f5 s3: Restore async i/o with the "native" AIO interface
eff3609 moved the async signal handler initialization to later in the process
to enable aio_fork and aio_pthread on platforms without realtime signals. This
commit broke the use of the native aio interface. aio_pending_size is
initialized to 0, so aio.c will not allow async i/0 at all if modules do not
set that variable correctly. Initialize to 100 right from the start.

Signed-off-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Jun 26 14:08:22 CEST 2012 on sn-devel-104
2012-06-26 14:08:22 +02:00
Michael Adam
4d66d9f6dd s3:smbd: change aio.c to use fsp_fnum_dbg() for logging fsp->fnum.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-06-15 03:28:14 +02:00
Andrew Bartlett
d2f6d0ba1e build: Rationalise AIO support in configure, ensure on by default
With this change, the define to check for AIO is HAVE_AIO, consistant
with other subsystems.

It is now also on by default in the autoconf build, as it has been for waf.

Andrew Bartlett
2012-06-06 08:23:10 +02:00
Jeremy Allison
da786cddd6 We never cancel SMB1 aio, only SMB2 aio - and in this case we always return a value.
So pass_cancel is no longer needed.
2012-04-12 15:11:22 -07:00
Jeremy Allison
d399af30c1 Remove cancel_aio_by_fsp(). It can never work and could lead to memory corruption
as outstanding IO's complete. Also we never have any aio's on a call to close_normal_file()
with close_type ERROR_CLOSE.
2012-04-12 15:06:59 -07:00
Jeremy Allison
95839102ad Move the counting of outstanding_aio_calls into the lifecycle of the aio_extra struct.
This way we can't end up with a mismatch between outstanding events and the counter.

We may still have problems with canceling and not correctly freeing the aio
struct, but at least the counter won't get out of sync anymore.
2012-04-12 15:06:58 -07:00
Volker Lendecke
eff36099c1 s3: Move the aio signal init to the vfs module
On platforms that don't have an RT signal space, signal initialization
fails. aio_fork and aio_pthread don't need the signal, so this would
block them from running as well.
2012-04-09 18:04:55 +02:00
Andrew Bartlett
6aa12fcb30 build: Remove SMB_OFF_T, replace with off_t
Now that we always require a 64 bit off_t, we no longer need SMB_OFF_T.

Andrew Bartlett

Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Fri Apr  6 01:47:43 CEST 2012 on sn-devel-104
2012-04-06 01:47:43 +02:00
Jeremy Allison
ddc1f3df51 Ensure we always free aio_ex on all error paths by moving the TALLOC_FREE
call out of smbd_aio_complete_aio_ex() and into the caller.

Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Thu Jan 12 03:10:52 CET 2012 on sn-devel-104
2012-01-12 03:10:52 +01:00
Jeremy Allison
c4763385a8 Remove unneeded NULL check. 2011-11-15 22:44:25 +01:00
Stefan Metzmacher
31cd1fbd2b s3:smbd/aio: handle_aio_completed() should do nothing if aio_ex->fsp is NULL
metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Tue Nov 15 18:47:55 CET 2011 on sn-devel-104
2011-11-15 18:47:55 +01:00
Stefan Metzmacher
21eb1450cc s3:smbd/aio: pass ECANCELED to the smb2 aio handlers
metze
2011-11-15 17:14:13 +01:00
Stefan Metzmacher
2802be75e3 s3:smbd/aio: add cancel_smb2_aio()
metze
2011-11-15 17:14:13 +01:00
Volker Lendecke
5068a0d14d s3: Fix smb2 handling error returns from aio
Found when reading with aio_fork beyond the end of file.

Metze, Jeremy, please check!

Without this we get

[2011/08/02 21:02:54.082661,  0] lib/util.c:778(smb_panic_s3)
  PANIC (pid 2302): smbd/smb2_read.c:593: Type mismatch: name[NULL] expected[struct smbd_smb2_read_state]
[2011/08/02 21:02:54.094316,  0] lib/util.c:882(log_stack_trace)
  BACKTRACE: 23 stack frames:
   #0 bin/smbd(log_stack_trace+0x2d) [0xb72873d8]
   #1 bin/smbd(smb_panic_s3+0x7c) [0xb7287529]
   #2 bin/smbd(smb_panic+0x2f) [0xb7277e1f]
   #3 /root/git/s3-work/source3/bin/libtalloc.so.2 [0xb6c6bc48]
   #4 /root/git/s3-work/source3/bin/libtalloc.so.2 [0xb6c6ec79]
   #5 /root/git/s3-work/source3/bin/libtalloc.so.2(_talloc_get_type_abort+0x34) [0xb6c6ecb3]
   #6 bin/smbd [0xb6fbc405]
   #7 bin/smbd(_tevent_req_notify_callback+0x4a) [0xb729a85a]
   #8 bin/smbd [0xb729a888]
   #9 bin/smbd(_tevent_req_done+0x19) [0xb729aa73]
   #10 bin/smbd [0xb6fae517]
   #11 bin/smbd [0xb6fad258]
   #12 bin/smbd(smbd_aio_complete_aio_ex+0xf5) [0xb6fad6e8]
   #13 /root/git/inst/modules/vfs/aio_fork.so [0xb66d4992]
   #14 bin/smbd(run_events_poll+0x400) [0xb7297df2]
   #15 bin/smbd(smbd_process+0xd75) [0xb6f9d3a7]
   #16 bin/smbd [0xb756f07b]
   #17 bin/smbd(run_events_poll+0x400) [0xb7297df2]
   #18 bin/smbd [0xb7298254]
   #19 bin/smbd(_tevent_loop_once+0x9e) [0xb72986ac]
   #20 bin/smbd(main+0x185c) [0xb7570e59]
   #21 /lib/i686/cmov/libc.so.6(__libc_start_main+0xe5) [0xb6b08455]
   #22 bin/smbd [0xb6f14e01]

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Tue Aug  2 22:33:15 CEST 2011 on sn-devel-104
2011-08-02 22:33:15 +02:00
Andrew Bartlett
ad0a07c531 s3-talloc Change TALLOC_ZERO_P() to talloc_zero()
Using the standard macro makes it easier to move code into common, as
TALLOC_ZERO_P isn't standard talloc.
2011-06-09 12:40:08 +02:00
Andrew Bartlett
e5dd03d199 s3-globals Remove smbd_event_context() (use server_event_context())
This has been a wrapper around server_event_context() for some time
now, and removing this from dummmysmbd.c assists with library
dependencies.

Andrew Bartlett
2011-05-31 00:32:07 +02:00
Jeremy Allison
38492b16fe Fixup build without --with-aio.
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Thu May  5 21:38:23 CEST 2011 on sn-devel-104
2011-05-05 21:38:23 +02:00
Jeremy Allison
4f41be356a Fix many const compiler warnings. 2011-05-05 10:41:59 -07:00
Günther Deschner
50883cfeb4 s3-tevent: only include ../lib/util/tevent wrappers where needed.
Guenther

Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Fri Apr 29 14:00:30 CEST 2011 on sn-devel-104
2011-04-29 14:00:30 +02:00
Günther Deschner
8c24ebf371 s3: include smbd/smbd.h where needed.
Guenther
2011-03-30 01:13:08 +02:00
Jeremy Allison
14c70346fc Change interface of schedule_smb2_aio_read() to allocate the return DATA_BLOB.
Change smb2_read code to allocate return DATA_BLOB just before the read.

Preparing for SMB2 sendfile change which will not need to allocate
return buffer.

Jeremy
2010-12-15 01:38:16 +01:00
Björn Jacke
f69085e5ff s3: use monotonic clock for aio timeout 2010-09-07 20:29:13 +02:00
Volker Lendecke
1808dd0a85 s3: Make srv_send_smb take an sconn instead of a sock fd 2010-08-24 21:06:41 +02:00
Volker Lendecke
c9458a756c s3: Remove smbd_server_fd from handle_aio_read/write_complete 2010-08-16 22:39:16 +02:00
Volker Lendecke
bda7c70bc0 s3: Remove smbd_server_fd from schedule_aio_write_and_X 2010-08-16 22:39:16 +02:00
Volker Lendecke
ad871b73a2 s3: Fix some error messages 2010-08-13 22:53:06 +02:00
Jeremy Allison
f5def289d3 Fix warning - no return value for a non-void fn.
Jeremy.
2010-07-20 09:34:32 -07:00
Volker Lendecke
55512f4791 s3: Work better without the aio sighandler
Refuse async I/O if we can't set up the signal handler
2010-07-18 21:22:41 +02:00
Jeremy Allison
aeb25ad0b8 Fix the build in the non WITH_AIO case (sorry). 2010-06-10 14:28:55 -07:00
Jeremy Allison
321d7a6303 Implement AIO in SMB2. Doesn't allow cancel calls yet (to be added).
Jeremy.
2010-06-10 13:20:37 -07:00