The Samba-Bugzilla – Attachment 10754 Details for
Bug 11102
Leases cause stat open with oplock type
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
git-am fix for 4.2.0
bug-11102-4.2-fix (text/plain), 6.87 KB, created by
Jeremy Allison
on 2015-02-19 22:29:01 UTC
(
hide
)
Description:
git-am fix for 4.2.0
Filename:
MIME Type:
Creator:
Jeremy Allison
Created:
2015-02-19 22:29:01 UTC
Size:
6.87 KB
patch
obsolete
>From 2c3c07f62abfa7fdc0871d7ce19b1d9a11fff02a Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Wed, 18 Feb 2015 11:48:31 -0800 >Subject: [PATCH 1/3] s3: smbd: leases - new torture test shows stat opens can > get leases. >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Can also issue breaks on these leases. > >https://bugzilla.samba.org/show_bug.cgi?id=11102 > >Signed-off-by: Jeremy Allison <jra@samba.org> >Reviewed-by: Ralph Böhme <slow@samba.org> >(cherry picked from commit 2d3db5e7930af9dd2a70727b2f2828bd73a1ec3b) >--- > source3/smbd/open.c | 11 ++++------- > 1 file changed, 4 insertions(+), 7 deletions(-) > >diff --git a/source3/smbd/open.c b/source3/smbd/open.c >index 06770e0..773b146 100644 >--- a/source3/smbd/open.c >+++ b/source3/smbd/open.c >@@ -3099,7 +3099,8 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn, > > if (file_existed) { > /* >- * stat opens on existing files don't get oplocks or leases. >+ * stat opens on existing files don't get oplocks. >+ * They can get leases. > * > * Note that we check for stat open on the *open_access_mask*, > * i.e. the access mask we actually used to do the open, >@@ -3108,12 +3109,8 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn, > * FILE_OVERWRITE and FILE_OVERWRITE_IF add in O_TRUNC, > * which adds FILE_WRITE_DATA to open_access_mask. > */ >- if (is_stat_open(open_access_mask)) { >- if (lease) { >- lease->lease_state = SMB2_LEASE_NONE; >- } else { >- oplock_request = NO_OPLOCK; >- } >+ if (is_stat_open(open_access_mask) && lease == NULL) { >+ oplock_request = NO_OPLOCK; > } > } > >-- >1.9.1 > > >From c99686d93b531dc07df5200f0628407e7681db1f Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Wed, 18 Feb 2015 11:49:27 -0800 >Subject: [PATCH 2/3] s3: smbd: leases - losen paranoia check. Stat opens can > grant leases. >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >https://bugzilla.samba.org/show_bug.cgi?id=11102 > >Signed-off-by: Jeremy Allison <jra@samba.org> >Reviewed-by: Ralph Böhme <slow@samba.org> >(cherry picked from commit cec2a38e971ac83260f3a9a5c4ac7095f8d23d65) >--- > source3/smbd/files.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > >diff --git a/source3/smbd/files.c b/source3/smbd/files.c >index 1ad601a..f8a5a8f 100644 >--- a/source3/smbd/files.c >+++ b/source3/smbd/files.c >@@ -322,7 +322,8 @@ files_struct *file_find_dif(struct smbd_server_connection *sconn, > } > /* Paranoia check. */ > if ((fsp->fh->fd == -1) && >- (fsp->oplock_type != NO_OPLOCK)) { >+ (fsp->oplock_type != NO_OPLOCK && >+ fsp->oplock_type != LEASE_OPLOCK)) { > DEBUG(0,("file_find_dif: file %s file_id = " > "%s, gen = %u oplock_type = %u is a " > "stat open with oplock type !\n", >-- >1.9.1 > > >From 89b60cd3aa272d78f5d34a1a17e16e5a34cf9622 Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Wed, 18 Feb 2015 11:51:53 -0800 >Subject: [PATCH 3/3] s4: smbtorture: leases - show stat opens grant leases and > can be broken. >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >https://bugzilla.samba.org/show_bug.cgi?id=11102 > >Signed-off-by: Jeremy Allison <jra@samba.org> >Reviewed-by: Ralph Böhme <slow@samba.org> > >Autobuild-User(master): Jeremy Allison <jra@samba.org> >Autobuild-Date(master): Thu Feb 19 23:10:43 CET 2015 on sn-devel-104 > >(cherry picked from commit 75dff778c5f13c008419cf292d2ea73cf3a33d7b) >--- > source4/torture/smb2/lease.c | 79 ++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 79 insertions(+) > >diff --git a/source4/torture/smb2/lease.c b/source4/torture/smb2/lease.c >index c1b6420..4b435a1 100644 >--- a/source4/torture/smb2/lease.c >+++ b/source4/torture/smb2/lease.c >@@ -27,6 +27,7 @@ > #include "torture/smb2/proto.h" > #include "torture/util.h" > #include "libcli/smb/smbXcli_base.h" >+#include "libcli/security/security.h" > #include "lib/param/param.h" > > #define CHECK_VAL(v, correct) do { \ >@@ -912,6 +913,83 @@ done: > return ret; > } > >+static bool test_lease_statopen(struct torture_context *tctx, >+ struct smb2_tree *tree) >+{ >+ TALLOC_CTX *mem_ctx = talloc_new(tctx); >+ struct smb2_create io; >+ struct smb2_lease ls; >+ struct smb2_handle h1, h2; >+ NTSTATUS status; >+ const char *fname = "lease_statopen.dat"; >+ bool ret = true; >+ uint32_t caps; >+ >+ caps = smb2cli_conn_server_capabilities( >+ tree->session->transport->conn); >+ if (!(caps & SMB2_CAP_LEASING)) { >+ torture_skip(tctx, "leases are not supported"); >+ } >+ >+ smb2_util_unlink(tree, fname); >+ >+ /* Create file. */ >+ smb2_lease_create(&io, &ls, false, fname, LEASE1, >+ smb2_util_lease_state("RWH")); >+ status = smb2_create(tree, mem_ctx, &io); >+ CHECK_STATUS(status, NT_STATUS_OK); >+ h1 = io.out.file.handle; >+ CHECK_CREATED(&io, CREATED, FILE_ATTRIBUTE_ARCHIVE); >+ CHECK_LEASE(&io, "RWH", true, LEASE1, 0); >+ smb2_util_close(tree, h1); >+ >+ /* Stat open file with RWH lease. */ >+ smb2_lease_create_share(&io, &ls, false, fname, 0, LEASE1, >+ smb2_util_lease_state("RWH")); >+ io.in.desired_access = FILE_READ_ATTRIBUTES; >+ status = smb2_create(tree, mem_ctx, &io); >+ CHECK_STATUS(status, NT_STATUS_OK); >+ h2 = io.out.file.handle; >+ CHECK_LEASE(&io, "RWH", true, LEASE1, 0); >+ >+ ZERO_STRUCT(break_info); >+ >+ tree->session->transport->lease.handler = torture_lease_handler; >+ tree->session->transport->lease.private_data = tree; >+ >+ /* Ensure non-stat open doesn't break and gets same lease >+ state as existing stat open. */ >+ smb2_lease_create(&io, &ls, false, fname, LEASE1, >+ smb2_util_lease_state("")); >+ status = smb2_create(tree, mem_ctx, &io); >+ CHECK_STATUS(status, NT_STATUS_OK); >+ h1 = io.out.file.handle; >+ CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE); >+ CHECK_LEASE(&io, "RWH", true, LEASE1, 0); >+ >+ CHECK_NO_BREAK(tctx); >+ smb2_util_close(tree, h1); >+ >+ /* Open with conflicting lease. stat open should break down to RH */ >+ smb2_lease_create(&io, &ls, false, fname, LEASE2, >+ smb2_util_lease_state("RWH")); >+ status = smb2_create(tree, mem_ctx, &io); >+ CHECK_STATUS(status, NT_STATUS_OK); >+ h1 = io.out.file.handle; >+ CHECK_CREATED(&io, EXISTED, FILE_ATTRIBUTE_ARCHIVE); >+ CHECK_LEASE(&io, "RH", true, LEASE2, 0); >+ >+ CHECK_BREAK_INFO("RWH", "RH", LEASE1); >+ >+done: >+ smb2_util_close(tree, h2); >+ smb2_util_close(tree, h1); >+ smb2_util_unlink(tree, fname); >+ talloc_free(mem_ctx); >+ return ret; >+} >+ >+ > static void torture_oplock_break_callback(struct smb2_request *req) > { > NTSTATUS status; >@@ -3814,6 +3892,7 @@ struct torture_suite *torture_smb2_lease_init(void) > test_lease_break_twice); > torture_suite_add_1smb2_test(suite, "nobreakself", > test_lease_nobreakself); >+ torture_suite_add_1smb2_test(suite, "statopen", test_lease_statopen); > torture_suite_add_1smb2_test(suite, "upgrade", test_lease_upgrade); > torture_suite_add_1smb2_test(suite, "upgrade2", test_lease_upgrade2); > torture_suite_add_1smb2_test(suite, "upgrade3", test_lease_upgrade3); >-- >1.9.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 11102
:
10742
|
10743
| 10754