[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-3190-g4c82a8d

Jeremy Allison jra at samba.org
Sat Nov 22 06:45:22 GMT 2008


The branch, v3-2-test has been updated
       via  4c82a8dd2f6fae1ea1722108c7f64e6a1286df15 (commit)
      from  1172260b397e22adddff94f4b364261e8058ebdd (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 4c82a8dd2f6fae1ea1722108c7f64e6a1286df15
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Nov 21 22:44:23 2008 -0800

    Revert c76e4791d3ae4f180fba209c29bd3774c00858cf - "Fix the logic bug that caused us to run into kernel oplocks on an open for a stream inside a file with stream_xattr module. On opening the base_fsp we must break existing oplocks." as it broke make test.
    Jeremy.

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

Summary of changes:
 source/modules/vfs_streams_depot.c |    3 +-
 source/modules/vfs_streams_xattr.c |   68 ++++++++++++++++++------------------
 source/smbd/open.c                 |    5 +--
 3 files changed, 37 insertions(+), 39 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/modules/vfs_streams_depot.c b/source/modules/vfs_streams_depot.c
index e7eceda..c530d2a 100644
--- a/source/modules/vfs_streams_depot.c
+++ b/source/modules/vfs_streams_depot.c
@@ -116,6 +116,7 @@ static char *stream_dir(vfs_handle_struct *handle, const char *base_path,
 	char *id_hex;
 	struct file_id id;
 	uint8 id_buf[16];
+	const char *rootdir;
 
 	tmp = talloc_asprintf(talloc_tos(), "%s/.streams", handle->conn->connectpath);
 
@@ -124,7 +125,7 @@ static char *stream_dir(vfs_handle_struct *handle, const char *base_path,
 		goto fail;
 	}
 
-	const char *rootdir = lp_parm_const_string(
+	rootdir = lp_parm_const_string(
 		SNUM(handle->conn), "streams_depot", "directory",
 		tmp);
 	TALLOC_FREE(tmp);
diff --git a/source/modules/vfs_streams_xattr.c b/source/modules/vfs_streams_xattr.c
index 3555654..2ea5336 100644
--- a/source/modules/vfs_streams_xattr.c
+++ b/source/modules/vfs_streams_xattr.c
@@ -102,7 +102,7 @@ static int streams_xattr_fstat(vfs_handle_struct *handle, files_struct *fsp,
 		return -1;
 	}
 
-	sbuf->st_size = get_xattr_size(handle->conn, fsp,
+	sbuf->st_size = get_xattr_size(handle->conn, fsp->base_fsp,
 					io->base, io->xattr_name);
 	if (sbuf->st_size == -1) {
 		return -1;
@@ -249,29 +249,29 @@ static int streams_xattr_open(vfs_handle_struct *handle,  const char *fname,
 	/*
 	 * We use baseflags to turn off nasty side-effects when opening the
 	 * underlying file.
-	 */
-	baseflags = flags;
-	baseflags &= ~O_TRUNC;
-	baseflags &= ~O_EXCL;
-	baseflags &= ~O_CREAT;
-
-	hostfd = SMB_VFS_OPEN(handle->conn, base, fsp, baseflags, mode);
-
-	/* It is legit to open a stream on a directory, but the base
-	 * fd has to be read-only.
-	 */
-	if ((hostfd == -1) && (errno == EISDIR)) {
-		baseflags &= ~O_ACCMODE;
-		baseflags |= O_RDONLY;
-		hostfd = SMB_VFS_OPEN(handle->conn, fname, fsp, baseflags,
-				mode);
-	}
+         */
+        baseflags = flags;
+        baseflags &= ~O_TRUNC;
+        baseflags &= ~O_EXCL;
+        baseflags &= ~O_CREAT;
+
+        hostfd = SMB_VFS_OPEN(handle->conn, base, fsp, baseflags, mode);
+
+        /* It is legit to open a stream on a directory, but the base
+         * fd has to be read-only.
+         */
+        if ((hostfd == -1) && (errno == EISDIR)) {
+                baseflags &= ~O_ACCMODE;
+                baseflags |= O_RDONLY;
+                hostfd = SMB_VFS_OPEN(handle->conn, fname, fsp, baseflags,
+				      mode);
+        }
 
-	if (hostfd == -1) {
+        if (hostfd == -1) {
 		goto fail;
-	}
+        }
 
-	status = get_ea_value(talloc_tos(), handle->conn, fsp, base,
+	status = get_ea_value(talloc_tos(), handle->conn, NULL, base,
 			      xattr_name, &ea);
 
 	DEBUG(10, ("get_ea_value returned %s\n", nt_errstr(status)));
@@ -303,9 +303,9 @@ static int streams_xattr_open(vfs_handle_struct *handle,  const char *fname,
 			DEBUG(10, ("creating attribute %s on file %s\n",
 				   xattr_name, base));
 
-			if (fsp->fh->fd != -1) {
+			if (fsp->base_fsp->fh->fd != -1) {
                         	if (SMB_VFS_FSETXATTR(
-					fsp, xattr_name,
+					fsp->base_fsp, xattr_name,
 					&null, sizeof(null),
 					flags & O_EXCL ? XATTR_CREATE : 0) == -1) {
 					goto fail;
@@ -323,9 +323,9 @@ static int streams_xattr_open(vfs_handle_struct *handle,  const char *fname,
 
 	if (flags & O_TRUNC) {
 		char null = '\0';
-		if (fsp->fh->fd != -1) {
+		if (fsp->base_fsp->fh->fd != -1) {
 			if (SMB_VFS_FSETXATTR(
-					fsp, xattr_name,
+					fsp->base_fsp, xattr_name,
 					&null, sizeof(null),
 					flags & O_EXCL ? XATTR_CREATE : 0) == -1) {
 				goto fail;
@@ -600,7 +600,7 @@ static ssize_t streams_xattr_pwrite(vfs_handle_struct *handle,
 		return SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
 	}
 
-	status = get_ea_value(talloc_tos(), handle->conn, fsp,
+	status = get_ea_value(talloc_tos(), handle->conn, fsp->base_fsp,
 			      sio->base, sio->xattr_name, &ea);
 	if (!NT_STATUS_IS_OK(status)) {
 		return -1;
@@ -624,12 +624,12 @@ static ssize_t streams_xattr_pwrite(vfs_handle_struct *handle,
 
         memcpy(ea.value.data + offset, data, n);
 
-	if (fsp->fh->fd != -1) {
-		ret = SMB_VFS_FSETXATTR(fsp,
+	if (fsp->base_fsp->fh->fd != -1) {
+		ret = SMB_VFS_FSETXATTR(fsp->base_fsp,
 				sio->xattr_name,
 				ea.value.data, ea.value.length, 0);
 	} else {
-		ret = SMB_VFS_SETXATTR(fsp->conn, sio->base,
+		ret = SMB_VFS_SETXATTR(fsp->conn, fsp->base_fsp->fsp_name,
 				sio->xattr_name,
 				ea.value.data, ea.value.length, 0);
 	}
@@ -656,7 +656,7 @@ static ssize_t streams_xattr_pread(vfs_handle_struct *handle,
 		return SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
 	}
 
-	status = get_ea_value(talloc_tos(), handle->conn, fsp,
+	status = get_ea_value(talloc_tos(), handle->conn, fsp->base_fsp,
 			      sio->base, sio->xattr_name, &ea);
 	if (!NT_STATUS_IS_OK(status)) {
 		return -1;
@@ -696,7 +696,7 @@ static int streams_xattr_ftruncate(struct vfs_handle_struct *handle,
 		return SMB_VFS_NEXT_FTRUNCATE(handle, fsp, offset);
 	}
 
-	status = get_ea_value(talloc_tos(), handle->conn, fsp,
+	status = get_ea_value(talloc_tos(), handle->conn, fsp->base_fsp,
 			      sio->base, sio->xattr_name, &ea);
 	if (!NT_STATUS_IS_OK(status)) {
 		return -1;
@@ -721,12 +721,12 @@ static int streams_xattr_ftruncate(struct vfs_handle_struct *handle,
 	ea.value.length = offset + 1;
 	ea.value.data[offset] = 0;
 
-	if (fsp->fh->fd != -1) {
-		ret = SMB_VFS_FSETXATTR(fsp,
+	if (fsp->base_fsp->fh->fd != -1) {
+		ret = SMB_VFS_FSETXATTR(fsp->base_fsp,
 				sio->xattr_name,
 				ea.value.data, ea.value.length, 0);
 	} else {
-		ret = SMB_VFS_SETXATTR(fsp->conn, sio->base,
+		ret = SMB_VFS_SETXATTR(fsp->conn, fsp->base_fsp->fsp_name,
 				sio->xattr_name,
 				ea.value.data, ea.value.length, 0);
 	}
diff --git a/source/smbd/open.c b/source/smbd/open.c
index cdd55bd..5c9fcf8 100644
--- a/source/smbd/open.c
+++ b/source/smbd/open.c
@@ -2729,10 +2729,7 @@ NTSTATUS create_file_unixpath(connection_struct *conn,
 		DEBUG(10, ("Recursing into create_file_unixpath for "
 			"base %s\n", base));
 
-		/* This call will break any oplock on the base file,
-		 * but will not actually open an underlying fd. */
-
-		status = create_file_unixpath(conn, req, base, 0,
+		status = create_file_unixpath(conn, NULL, base, 0,
 					      FILE_SHARE_READ
 					      | FILE_SHARE_WRITE
 					      | FILE_SHARE_DELETE,


-- 
Samba Shared Repository


More information about the samba-cvs mailing list