[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Thu Nov 19 21:25:03 UTC 2020


The branch, master has been updated
       via  c4d82a6b1f3 smbd: avoid a smb_fname copy in call_trans2setfilepathinfo()
       via  458c24fccd8 smbd: avoid a smb_fname copy in call_trans2qfilepathinfo()
       via  7f0008a992b smbd: replace calls to check_access() with smbd_check_access_rights()
       via  ed88f59189c smbd: use SMB2_INFO_SPECIAL in call_trans2qfilepathinfo()
       via  5604afefb05 torture: avoid OPLOCK-CANCEL flapping on busy gitlab CI
       via  4dbb8fda4ee docs-xml: add "smbd force process locks"
       via  3b694328e43 selftest: remove selftest/knownfail.d/samba3.smbtorture_s3
      from  8bc77a0f86f pylibsmb: Multi-threaded use is now possible with SMB2

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit c4d82a6b1f31d0601ad4670665cd3105b92f8524
Author: Ralph Boehme <slow at samba.org>
Date:   Tue Nov 17 11:02:31 2020 +0100

    smbd: avoid a smb_fname copy in call_trans2setfilepathinfo()
    
    There's no point in doing a copy here, we can just point smb_fname at
    fsp->fsp_name.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Thu Nov 19 21:24:23 UTC 2020 on sn-devel-184

commit 458c24fccd86a26710db54589ab67ae60b345576
Author: Ralph Boehme <slow at samba.org>
Date:   Tue Oct 20 17:07:35 2020 +0200

    smbd: avoid a smb_fname copy in call_trans2qfilepathinfo()
    
    No point in making a copy here.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 7f0008a992b60fda8f2eb04553b547029bb421fc
Author: Ralph Boehme <slow at samba.org>
Date:   Tue Oct 27 12:23:00 2020 +0100

    smbd: replace calls to check_access() with smbd_check_access_rights()
    
    check_access() is a 1:1 wrapper arounf smbd_check_access_rights().
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit ed88f59189cfc3cd4f0492b0812fffc04cfa6a7c
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Oct 26 17:57:00 2020 +0100

    smbd: use SMB2_INFO_SPECIAL in call_trans2qfilepathinfo()
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 5604afefb05b376fcc61db99441fd57367881e69
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Nov 16 10:44:48 2020 +0100

    torture: avoid OPLOCK-CANCEL flapping on busy gitlab CI
    
    I saw this test fail a few times on gitlab CI with
    NT_STATUS_SHARING_VIOLATION:
    
      Running OPLOCK-CANCEL
      cli_unlink failed: NT_STATUS_SHARING_VIOLATION
      TEST OPLOCK-CANCEL FAILED!
    
    The only possible explanation I could come up for
    this flapping test is that the fnum1 filehandle in cli1 is still not closed when
    cli2 tries to open the file deletion 5 seconds after cli1 is thrown away. As
    fnum1 doesn't have FILE_SHARE_DELELE the open-for-delete fails with a
    SHARING_VIOLATION.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 4dbb8fda4ee9a816759e8677ad930cde16413d33
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Nov 16 11:06:08 2020 +0100

    docs-xml: add "smbd force process locks"
    
    Avoid a parametric option in a hot codepath.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 3b694328e43f8c50d2967224db4c424477831468
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Oct 26 10:03:24 2020 +0100

    selftest: remove selftest/knownfail.d/samba3.smbtorture_s3
    
    This hunk was inadvertently included in 5161edbdb28.
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 .../smbdotconf/locking/force_process_locks.xml     | 19 ++++++++++
 selftest/knownfail.d/samba3.smbtorture_s3          |  2 --
 source3/smbd/files.c                               | 12 +++----
 source3/smbd/trans2.c                              | 40 +++++-----------------
 source3/torture/test_oplock_cancel.c               |  2 ++
 5 files changed, 34 insertions(+), 41 deletions(-)
 create mode 100644 docs-xml/smbdotconf/locking/force_process_locks.xml
 delete mode 100644 selftest/knownfail.d/samba3.smbtorture_s3


Changeset truncated at 500 lines:

diff --git a/docs-xml/smbdotconf/locking/force_process_locks.xml b/docs-xml/smbdotconf/locking/force_process_locks.xml
new file mode 100644
index 00000000000..f701c0a5df9
--- /dev/null
+++ b/docs-xml/smbdotconf/locking/force_process_locks.xml
@@ -0,0 +1,19 @@
+<samba:parameter name="smbd force process locks"
+                 context="S"
+                 type="boolean"
+                 xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
+<description>
+	<para>
+	This boolean option tells <command moreinfo="none">smbd</command> whether
+	to forcefully disable the use of Open File Description locks on Linux.
+	</para>
+	<para>
+	This option should not be changed from the default unless you know what
+	you're doing.
+	</para>
+
+</description>
+
+<related>locking</related>
+<value type="default">no</value>
+</samba:parameter>
diff --git a/selftest/knownfail.d/samba3.smbtorture_s3 b/selftest/knownfail.d/samba3.smbtorture_s3
deleted file mode 100644
index f56cf2327e9..00000000000
--- a/selftest/knownfail.d/samba3.smbtorture_s3
+++ /dev/null
@@ -1,2 +0,0 @@
-^samba3.smbtorture_s3.plain.POSIX-LS-WILDCARD.smbtorture\(nt4_dc_smb1\)
-^samba3.smbtorture_s3.crypt.POSIX-LS-WILDCARD.smbtorture\(nt4_dc_smb1\)
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index d7def972d0e..ada9a5fd473 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -51,15 +51,11 @@ NTSTATUS fsp_new(struct connection_struct *conn, TALLOC_CTX *mem_ctx,
 		goto fail;
 	}
 
-#if defined(HAVE_OFD_LOCKS)
-	fsp->fsp_flags.use_ofd_locks = true;
-	if (lp_parm_bool(SNUM(conn),
-			 "smbd",
-			 "force process locks",
-			 false)) {
-		fsp->fsp_flags.use_ofd_locks = false;
-	}
+	fsp->fsp_flags.use_ofd_locks = !lp_smbd_force_process_locks(SNUM(conn));
+#ifndef HAVE_OFD_LOCKS
+	fsp->fsp_flags.use_ofd_locks = false;
 #endif
+
 	fsp->fh->ref_count = 1;
 	fsp->fh->fd = -1;
 
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index bf06175227b..f6e261ed658 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -191,23 +191,6 @@ done:
 }
 #endif
 
-/********************************************************************
- The canonical "check access" based on path.
-********************************************************************/
-
-static NTSTATUS check_access(connection_struct *conn,
-			struct files_struct *dirfsp,
-			const struct smb_filename *smb_fname,
-			uint32_t access_mask)
-{
-	SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp);
-	return smbd_check_access_rights(conn,
-			dirfsp,
-			smb_fname,
-			false,
-			access_mask);
-}
-
 /********************************************************************
  Roundup a value to the nearest allocation roundup size boundary.
  Only do this for Windows clients.
@@ -819,9 +802,10 @@ NTSTATUS set_ea(connection_struct *conn, files_struct *fsp,
 	if (fsp != NULL) {
 		status = check_access_fsp(fsp, FILE_WRITE_EA);
 	} else {
-		status = check_access(conn,
+		status = smbd_check_access_rights(conn,
 				conn->cwd_fsp,
 				smb_fname,
+				false,
 				FILE_WRITE_EA);
 	}
 	if (!NT_STATUS_IS_OK(status)) {
@@ -6053,11 +6037,7 @@ static void call_trans2qfilepathinfo(connection_struct *conn,
 			return;
 		}
 
-		smb_fname = cp_smb_filename(talloc_tos(), fsp->fsp_name);
-		if (smb_fname == NULL) {
-			reply_nterror(req, NT_STATUS_NO_MEMORY);
-			return;
-		}
+		smb_fname = fsp->fsp_name;
 
 		if(fsp->fake_file_handle) {
 			/*
@@ -6387,7 +6367,7 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
 		break;
 	}
 
-	if ((info_level & 0xFF00) == 0xFF00) {
+	if ((info_level & SMB2_INFO_SPECIAL) == SMB2_INFO_SPECIAL) {
 		/*
 		 * We use levels that start with 0xFF00
 		 * internally to represent SMB2 specific levels
@@ -7836,9 +7816,10 @@ static NTSTATUS smb_set_file_basic_info(connection_struct *conn,
 	if (fsp != NULL) {
 		status = check_access_fsp(fsp, FILE_WRITE_ATTRIBUTES);
 	} else {
-		status = check_access(conn,
+		status = smbd_check_access_rights(conn,
 				conn->cwd_fsp,
 				smb_fname,
+				false,
 				FILE_WRITE_ATTRIBUTES);
 	}
 	if (!NT_STATUS_IS_OK(status)) {
@@ -7910,9 +7891,10 @@ static NTSTATUS smb_set_info_standard(connection_struct *conn,
 	if (fsp != NULL) {
 		status = check_access_fsp(fsp, FILE_WRITE_ATTRIBUTES);
 	} else {
-		status = check_access(conn,
+		status = smbd_check_access_rights(conn,
 				conn->cwd_fsp,
 				smb_fname,
+				false,
 				FILE_WRITE_ATTRIBUTES);
 	}
 	if (!NT_STATUS_IS_OK(status)) {
@@ -9327,11 +9309,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
 		}
 		info_level = SVAL(params,2);
 
-		smb_fname = cp_smb_filename(talloc_tos(), fsp->fsp_name);
-		if (smb_fname == NULL) {
-			reply_nterror(req, NT_STATUS_NO_MEMORY);
-			return;
-		}
+		smb_fname = fsp->fsp_name;
 
 		if(fsp->fh->fd == -1) {
 			/*
diff --git a/source3/torture/test_oplock_cancel.c b/source3/torture/test_oplock_cancel.c
index b003876f592..86ce5b76d77 100644
--- a/source3/torture/test_oplock_cancel.c
+++ b/source3/torture/test_oplock_cancel.c
@@ -148,6 +148,8 @@ bool run_oplock_cancel(int dummy)
 		return false;
 	}
 
+	cli_close(cli1, fnum1);
+
 	TALLOC_FREE(cli1);
 
 	/*


-- 
Samba Shared Repository



More information about the samba-cvs mailing list