[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Thu Feb 27 14:43:03 MST 2014


The branch, master has been updated
       via  ca3998d vfs: propagate snapshot enumeration errors
       via  abf08ed s3: smbd: Ensure brl_get_locks_readonly() always returns a valid struct byte_range_lock even if there are no locks.
      from  f0030c6 pidl: Make perl(Parse:Yapp:Driver) installation optional.

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


- Log -----------------------------------------------------------------
commit ca3998d0436747f637b04eb32eb6c17fce3e2159
Author: David Disseldorp <ddiss at samba.org>
Date:   Thu Feb 27 19:46:14 2014 +0100

    vfs: propagate snapshot enumeration errors
    
    The current FSCTL_GET_SHADOW_COPY_DATA/FSCTL_SRV_ENUMERATE_SNAPSHOTS
    handler squashes all non-ENOSYS errors into an NT_STATUS_UNSUCCESSFUL
    response.
    This commit ensures that all errors are propagated up to the client, to
    aid debugging.
    The Windows Explorer "Previous Versions" dialogue doesn't appear to
    distinguish between error codes. It displays "There are no previous
    versions available".
    
    Signed-off-by: David Disseldorp <ddiss at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Thu Feb 27 22:42:50 CET 2014 on sn-devel-104

commit abf08ed544ce05ea5a6e6ea2e531b6a2d97e15cc
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Feb 26 16:30:25 2014 -0800

    s3: smbd: Ensure brl_get_locks_readonly() always returns a valid struct byte_range_lock even if there are no locks.
    
    brl_get_locks_readonly() currently returns NULL when it can't
    find any byte range locks on the file. This is an error - it
    should return a valid struct byte_range_lock containing num_locks == 0
    so it can be cached.
    
    Returning NULL when there are no locks causes POSIX lock
    tests to fail returning NT_STATUS_NO_MEMORY (as it thinks
    it can't allocate the struct) instead of NT_STATUS_OK.
    
    Fixes bug:
    
    Bug 10431 - STATUS_NO_MEMORY response from Query File Posix Lock request
    
    https://bugzilla.samba.org/show_bug.cgi?id=10431
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Volker Lendecke <Volker.Lendecke at SerNet.DE>

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

Summary of changes:
 source3/locking/brlock.c      |   16 +++++++++++++++-
 source3/modules/vfs_default.c |   26 ++++++++++++++++----------
 2 files changed, 31 insertions(+), 11 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index a516b60..e6c8949 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -2154,7 +2154,21 @@ struct byte_range_lock *brl_get_locks_readonly(files_struct *fsp)
 			make_tdb_data((uint8_t *)&fsp->file_id,
 				      sizeof(fsp->file_id)),
 			brl_get_locks_readonly_parser, &state);
-		if (!NT_STATUS_IS_OK(status)) {
+
+		if (NT_STATUS_EQUAL(status,NT_STATUS_NOT_FOUND)) {
+			/*
+			 * No locks on this file. Return an empty br_lock.
+			 */
+			br_lock = talloc(fsp, struct byte_range_lock);
+			if (br_lock == NULL) {
+				goto fail;
+			}
+
+			br_lock->have_read_oplocks = false;
+			br_lock->num_locks = 0;
+			br_lock->lock_data = NULL;
+
+		} else if (!NT_STATUS_IS_OK(status)) {
 			DEBUG(3, ("Could not parse byte range lock record: "
 				  "%s\n", nt_errstr(status)));
 			goto fail;
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 81a0b1b..7dd9c0c 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -1021,12 +1021,12 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct *handle,
 {
 	const char *in_data = (const char *)_in_data;
 	char **out_data = (char **)_out_data;
+	NTSTATUS status;
 
 	switch (function) {
 	case FSCTL_SET_SPARSE:
 	{
 		bool set_sparse = true;
-		NTSTATUS status;
 
 		if (in_len >= 1 && in_data[0] == 0) {
 			set_sparse = false;
@@ -1125,16 +1125,23 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct *handle,
 		 * Call the VFS routine to actually do the work.
 		 */
 		if (SMB_VFS_GET_SHADOW_COPY_DATA(fsp, shadow_data, labels)!=0) {
-			TALLOC_FREE(shadow_data);
-			if (errno == ENOSYS) {
-				DEBUG(5,("FSCTL_GET_SHADOW_COPY_DATA: connectpath %s, not supported.\n",
-					fsp->conn->connectpath));
-				return NT_STATUS_NOT_SUPPORTED;
+			int log_lev = 0;
+			if (errno == 0) {
+				/* broken module didn't set errno on error */
+				status = NT_STATUS_UNSUCCESSFUL;
 			} else {
-				DEBUG(0,("FSCTL_GET_SHADOW_COPY_DATA: connectpath %s, failed.\n",
-					fsp->conn->connectpath));
-				return NT_STATUS_UNSUCCESSFUL;
+				status = map_nt_error_from_unix(errno);
+				if (NT_STATUS_EQUAL(status,
+						    NT_STATUS_NOT_SUPPORTED)) {
+					log_lev = 5;
+				}
 			}
+			DEBUG(log_lev, ("FSCTL_GET_SHADOW_COPY_DATA: "
+					"connectpath %s, failed - %s.\n",
+					fsp->conn->connectpath,
+					nt_errstr(status)));
+			TALLOC_FREE(shadow_data);
+			return status;
 		}
 
 		labels_data_count = (shadow_data->num_volumes * 2 *
@@ -1262,7 +1269,6 @@ static NTSTATUS vfswrap_fsctl(struct vfs_handle_struct *handle,
 		 * and SEEK_DATA/SEEK_HOLE on Solaris is needed to make
 		 * this FSCTL correct for sparse files.
 		 */
-		NTSTATUS status;
 		uint64_t offset, length;
 		char *out_data_tmp = NULL;
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list