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

23 Commits

Author SHA1 Message Date
Volker Lendecke
5e4f34e707 smbd: Add some structure protection for durable reconnect
We should consume all data, and the ndr_pull function fills in all
fields. Thus the ZERO_STRUCT(cookie) is not required.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-09-14 07:49:13 +02:00
Ralph Boehme
0a91ade527 s3: smbd/durable: remove dev and inode check from vfs_default_durable_reconnect_check_stat()
On a cluster filesystem the device numbers may differ on the cluster
nodes. We already verify the file_id in vfs_default_durable_reconnect(),
so we can safely remove the dev/inode checks.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-07-07 13:41:09 +02:00
Stefan Metzmacher
51407b90d9 smbd: split out a fsp_flush_write_time_update() function from update_write_time_handler()
It's confusing to call update_write_time_handler() from anywhere,
it should only be called from within the event loop when the
timer expires.

This makes it more obvious that fsp_flush_write_time_update()
doesn't really need an tevent context argument.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-06-14 20:52:23 +02:00
Volker Lendecke
9af73f62ce lib: Add lib/util/server_id.h
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2017-01-22 18:30:11 +01:00
Jeremy Allison
dc5dad4813 s3: Filenames: Add uint32_t flags parameter to synthetic_smb_fname().
Get it from parent/deriving smb_filename if present.
Use 0 (as usually this a Windows-style lookup) if
not.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2016-03-24 22:57:16 +01:00
Volker Lendecke
02f2684dd8 s3:smbd: Implementation of SMB2.1 and SMB3.0 leases.
Pair-Programmed-With: Jeremy Allison <jra@samba.org>
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2014-12-04 05:45:10 +01:00
Volker Lendecke
81a5a9e897 s3:smb2_create: allow durable handles with SMB2_LEASE_HANDLE
We don't support real lease yet, but this makes use of fsp_lease_type()
which converts a batch oplock into and RWH lease.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-12-04 05:45:10 +01:00
Michael Adam
cd95937369 s3: remove stat_ex.vfs_private completely
It is not used any more.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Thu Jul 24 14:23:11 CEST 2014 on sn-devel-104
2014-07-24 14:23:11 +02:00
Michael Adam
6b2d67a345 smbd:smb2: fix durable reconnect: set fsp->fnum from the smbXsrv_open->local_id
Originally, fsp->fnum was left at the INVALID fnum value.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-01-30 16:57:06 +01:00
Volker Lendecke
184cc138b6 smbd: Remove separate oplock_type parameter from set_file_oplock
This avoids the question where it could happen that something else but
fsp->oplock_type might be useful as an argument here.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2013-10-24 14:22:03 +02:00
Volker Lendecke
bd542281bc smbd: Unify parameters to set_oplock_type
Some lines above we set fsp->oplock_type = e->op_type. I don't see
how this might have changed. This change will unify both callers of
set_file_oplock. In the next step the second parameter to set_file_oplock
will be removed.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
2013-10-24 14:21:59 +02:00
Michael Adam
e6beae4471 s3:smbd: remove old comment about scavenger timer from vfs_default_durable_reconnect()
scavenger functionality belongs to the smb layer (and is meanwhile
implemented there).

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-06-04 11:07:11 -07:00
Volker Lendecke
f52a3c3cd1 smbd: Remove the unused fsp->pending_break_messages array
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-04-26 15:17:22 -07:00
Volker Lendecke
75911f94b8 smbd: Convert vfs_default_durable_reconnect to synthetic_smb_fname
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-04-17 14:49:59 -07:00
Michael Adam
382849ad99 s3:smbd:durable: remove a TODO comment about write time updates
This has been done.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>

Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Mon Oct 29 20:12:18 CET 2012 on sn-devel-104
2012-10-29 20:12:18 +01:00
Michael Adam
52ace6767f s3:smbd:durable: factor stat checks out into vfs_default_durable_reconnect_check_stat()
This makes vfs_default_durable_reconnect() simpler to read
and it reduces code duplication in the failure case handling.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Oct 25 23:03:13 CEST 2012 on sn-devel-104
2012-10-25 23:03:13 +02:00
Michael Adam
7d05ff7726 s3:smbd:durable: store stat info for disconnected durables and check at reconnect.
At durable reconnect, we check the stat info stored in the cookie against the
current stat data from the file we just opened.  If any detail differs, we deny
the durable reconnect, because in that case it is very likely that someone
opened the file while the handle was disconnected, which has to be interpreted
as an oplock break.

Pair-programmed-with: Stefan Metzmacher <metze@samba.org>

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

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Oct 19 18:56:19 CEST 2012 on sn-devel-104
2012-10-19 18:56:19 +02:00
Michael Adam
660e90d391 s3:smbd/durable: remove an extra blank line from vfs_default_durable_reconnect()
Pair-programmed-with: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2012-10-19 17:13:35 +02:00
Stefan Metzmacher
24d225f44e s3:smbd/durable: add write_time specific stuff to vfs_default_durable_cookie
metze

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Fri Oct 19 17:12:29 CEST 2012 on sn-devel-104
2012-10-19 17:12:29 +02:00
Stefan Metzmacher
137376391d s3:smbd/durable: update the low level write_time before disconnecting the file.
If we close the low level FD, we should better update the write_time
if needed.

It's not unlikely that the client doesn't reclaim the durable handle,
in that case we may not close the after the durable timeout.

In such a case we should make sure that we at least update the write time
on disconnect, this makes sure backup applications notice that
the file was changed.

metze

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2012-10-19 15:21:10 +02:00
Stefan Metzmacher
9e7bce5370 s3:smbd/durable: trigger pending write_time updates before disconnecting the file
We need to call the pending write time update handler immediately.
Which means we don't wait exactly 2 seconds before updating the write time
after the first write.

metze

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2012-10-19 15:09:58 +02:00
Michael Adam
93bee9b3e3 s3:smbd:smb2: initialize variable in vfs_default_durable_reconnect()
Found by Ambi's state-of-the-art compiler!
2012-09-22 10:19:02 +02:00
Michael Adam
eabe4c8fc4 s3:vfs_default: add basic support for durable handle request and reconnect
We only grant durable handles for CIFS/SMB2 only access,
that means "kernel oplocks", "kernel share modes" and "posix locking"
need to be set to "no".

For now we also don't grant durable handles if delete on close
is active on the handle.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Pair-Programmed-With: Volker Lendecke <vl@samba.org>
2012-09-08 19:48:20 +02:00