[SCM] Samba Shared Repository - branch master updated

Michael Adam obnox at samba.org
Thu Jul 24 06:24:04 MDT 2014


The branch, master has been updated
       via  cd95937 s3: remove stat_ex.vfs_private completely
       via  eb0577d s3:vfs:gpfs: remove a block and reduce indentation in gpfs_is_offline()
       via  d87d13f s3:vfs:gpfs: remove all writing uses of stat_ex.vfs_private from vfs_gpfs.
       via  16a040f s3:vfs:gpfs: Remove all reading uses of stat_ex.vfs_private from vfs_gfs.
       via  44e9ab2 Revert "s3:vfs:gpfs: log when winAttr-garbage is detected (by heuristics) in is_offline"
      from  11fa417 selftest: check for fs specific options of the share dir only after creating it

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


- Log -----------------------------------------------------------------
commit cd95937369b1729e2417d78f3c903bce5d32da93
Author: Michael Adam <obnox at samba.org>
Date:   Thu Jul 17 17:27:17 2014 +0200

    s3: remove stat_ex.vfs_private completely
    
    It is not used any more.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    
    Autobuild-User(master): Michael Adam <obnox at samba.org>
    Autobuild-Date(master): Thu Jul 24 14:23:11 CEST 2014 on sn-devel-104

commit eb0577dca04a2fde4691094a006954d417d1cf22
Author: Michael Adam <obnox at samba.org>
Date:   Thu Jul 17 17:06:32 2014 +0200

    s3:vfs:gpfs: remove a block and reduce indentation in gpfs_is_offline()
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>

commit d87d13f4c2a77c03bbffcd0fe4fc9464d9024cae
Author: Michael Adam <obnox at samba.org>
Date:   Thu Jul 17 23:35:58 2014 +0200

    s3:vfs:gpfs: remove all writing uses of stat_ex.vfs_private from vfs_gpfs.
    
    Now that the vfs_private cache is never read in vfs_gpfs, there is
    no need any more to write it.
    
    With this change, vfs_gpfs does not use vfs_private any more.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>

commit 16a040f8ef7f2f594505ef07e6f9b77df8f1d725
Author: Michael Adam <obnox at samba.org>
Date:   Thu Jul 17 17:22:09 2014 +0200

    s3:vfs:gpfs: Remove all reading uses of stat_ex.vfs_private from vfs_gfs.
    
    This was used as a cache for offline-info in the stat buffer.
    But as the implementation of gpfs_is_offline() showed, this cache
    does not always carry valid information when the stat itself is valid
    (since at least one call goes to fstatat() directly, circumventing
     the vfs).
    
    So the correct thing is to always call SMB_VFS_IS_OFFLINE()
    when checking whether a file is offline. For the pread and pwrite
    calls, we need to call IS_OFFLINE before the actual read
    and check afterwards if the file was offline before (as a basis
    whether to send notifications).
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>

commit 44e9ab21ddfdf0e82a0ed9a884d411af66408962
Author: Michael Adam <obnox at samba.org>
Date:   Thu Jul 10 13:30:51 2014 +0200

    Revert "s3:vfs:gpfs: log when winAttr-garbage is detected (by heuristics) in is_offline"
    
    This reverts commit 8f44883db94314c007c197927a9dd0809076754d.
    
    The next commits will be removing all access to stat_ex.vfs_private from
    vfs_gpfs. This revert of the last addition is a preparation.
    
    Signed-off-by: Michael Adam <obnox at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Christof Schmitt <cs at samba.org>

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

Summary of changes:
 source3/include/includes.h        |    8 ----
 source3/librpc/idl/open_files.idl |    1 -
 source3/modules/vfs_gpfs.c        |   69 ++++++++++++++----------------------
 source3/smbd/durable.c            |   14 -------
 4 files changed, 27 insertions(+), 65 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/includes.h b/source3/include/includes.h
index de44fd2..0715608 100644
--- a/source3/include/includes.h
+++ b/source3/include/includes.h
@@ -322,14 +322,6 @@ struct stat_ex {
 
 	uint32_t	st_ex_flags;
 	uint32_t	st_ex_mask;
-
-	/*
-	 * Add space for VFS internal extensions. The initial user of this
-	 * would be the onefs modules, passing the snapid from the stat calls
-	 * to the file_id_create call. Maybe we'll have to expand this later,
-	 * but the core of Samba should never look at this field.
-	 */
-	uint64_t vfs_private;
 };
 
 typedef struct stat_ex SMB_STRUCT_STAT;
diff --git a/source3/librpc/idl/open_files.idl b/source3/librpc/idl/open_files.idl
index 0ebc819..4278301 100644
--- a/source3/librpc/idl/open_files.idl
+++ b/source3/librpc/idl/open_files.idl
@@ -76,7 +76,6 @@ interface open_files
 		hyper		st_ex_blocks;
 		uint32		st_ex_flags;
 		uint32		st_ex_mask;
-		hyper		vfs_private;
 	} vfs_default_durable_stat;
 
 	typedef [public] struct {
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index c94e4e8..e722a86 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -1590,7 +1590,6 @@ static int vfs_gpfs_stat(struct vfs_handle_struct *handle,
 		smb_fname->st.st_ex_calculated_birthtime = false;
 		smb_fname->st.st_ex_btime.tv_sec = attrs.creationTime.tv_sec;
 		smb_fname->st.st_ex_btime.tv_nsec = attrs.creationTime.tv_nsec;
-		smb_fname->st.vfs_private = attrs.winAttrs;
 	}
 	return 0;
 }
@@ -1622,7 +1621,6 @@ static int vfs_gpfs_fstat(struct vfs_handle_struct *handle,
 		sbuf->st_ex_calculated_birthtime = false;
 		sbuf->st_ex_btime.tv_sec = attrs.creationTime.tv_sec;
 		sbuf->st_ex_btime.tv_nsec = attrs.creationTime.tv_nsec;
-		sbuf->vfs_private = attrs.winAttrs;
 	}
 	return 0;
 }
@@ -1668,7 +1666,6 @@ static int vfs_gpfs_lstat(struct vfs_handle_struct *handle,
 		smb_fname->st.st_ex_calculated_birthtime = false;
 		smb_fname->st.st_ex_btime.tv_sec = attrs.creationTime.tv_sec;
 		smb_fname->st.st_ex_btime.tv_nsec = attrs.creationTime.tv_nsec;
-		smb_fname->st.vfs_private = attrs.winAttrs;
 	}
 	return 0;
 }
@@ -1804,6 +1801,7 @@ static bool vfs_gpfs_is_offline(struct vfs_handle_struct *handle,
 	char *path = NULL;
 	NTSTATUS status;
 	struct gpfs_config_data *config;
+	int ret;
 
 	SMB_VFS_HANDLE_GET_DATA(handle, config,
 				struct gpfs_config_data,
@@ -1819,20 +1817,12 @@ static bool vfs_gpfs_is_offline(struct vfs_handle_struct *handle,
 		return -1;
 	}
 
-	if (VALID_STAT(*sbuf) && (sbuf->vfs_private & ~0x0FFFF) != 0) {
-		DEBUG(0, ("vfs_gpfs_is_offline: valid stat but "
-			  "uninitialized winAttrs (0x%08x)?\n",
-			  (uint32_t)sbuf->vfs_private));
+	ret = get_gpfs_winattrs(path, &attrs);
+	if (ret == -1) {
+		TALLOC_FREE(path);
+		return false;
 	}
-	{
-		int ret;
-		ret = get_gpfs_winattrs(path, &attrs);
 
-		if (ret == -1) {
-			TALLOC_FREE(path);
-			return false;
-		}
-	}
 	if ((attrs.winAttrs & GPFS_WINATTR_OFFLINE) != 0) {
 		DEBUG(10, ("%s is offline\n", path));
 		TALLOC_FREE(path);
@@ -1853,7 +1843,8 @@ static ssize_t vfs_gpfs_sendfile(vfs_handle_struct *handle, int tofd,
 				 files_struct *fsp, const DATA_BLOB *hdr,
 				 off_t offset, size_t n)
 {
-	if ((fsp->fsp_name->st.vfs_private & GPFS_WINATTR_OFFLINE) != 0) {
+	if (SMB_VFS_IS_OFFLINE(handle->conn, fsp->fsp_name, &fsp->fsp_name->st))
+	{
 		errno = ENOSYS;
 		return -1;
 	}
@@ -2120,8 +2111,8 @@ static int vfs_gpfs_open(struct vfs_handle_struct *handle,
 				return -1);
 
 	if (config->hsm && !config->recalls) {
-		if (VALID_STAT(smb_fname->st) &&
-		    (smb_fname->st.vfs_private & GPFS_WINATTR_OFFLINE)) {
+		if (SMB_VFS_IS_OFFLINE(handle->conn, smb_fname, &smb_fname->st))
+		{
 			DEBUG(10, ("Refusing access to offline file %s\n",
 				  fsp_str_dbg(fsp)));
 			errno = EACCES;
@@ -2139,15 +2130,14 @@ static ssize_t vfs_gpfs_pread(vfs_handle_struct *handle, files_struct *fsp,
 			      void *data, size_t n, off_t offset)
 {
 	ssize_t ret;
+	bool was_offline;
 
-	ret = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
+	was_offline = SMB_VFS_IS_OFFLINE(handle->conn, fsp->fsp_name,
+					 &fsp->fsp_name->st);
 
-	DEBUG(10, ("vfs_private = %x\n",
-		   (unsigned int)fsp->fsp_name->st.vfs_private));
+	ret = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
 
-	if ((ret != -1) &&
-	    ((fsp->fsp_name->st.vfs_private & GPFS_WINATTR_OFFLINE) != 0)) {
-		fsp->fsp_name->st.vfs_private &= ~GPFS_WINATTR_OFFLINE;
+	if ((ret != -1) && was_offline) {
 		notify_fname(handle->conn, NOTIFY_ACTION_MODIFIED,
 			     FILE_NOTIFY_CHANGE_ATTRIBUTES,
 			     fsp->fsp_name->base_name);
@@ -2160,6 +2150,7 @@ struct vfs_gpfs_pread_state {
 	struct files_struct *fsp;
 	ssize_t ret;
 	int err;
+	bool was_offline;
 };
 
 static void vfs_gpfs_pread_done(struct tevent_req *subreq);
@@ -2178,6 +2169,8 @@ static struct tevent_req *vfs_gpfs_pread_send(struct vfs_handle_struct *handle,
 	if (req == NULL) {
 		return NULL;
 	}
+	state->was_offline = SMB_VFS_IS_OFFLINE(handle->conn, fsp->fsp_name,
+						&fsp->fsp_name->st);
 	state->fsp = fsp;
 	subreq = SMB_VFS_NEXT_PREAD_SEND(state, ev, handle, fsp, data,
 					 n, offset);
@@ -2211,12 +2204,7 @@ static ssize_t vfs_gpfs_pread_recv(struct tevent_req *req, int *err)
 	}
 	*err = state->err;
 
-	DEBUG(10, ("vfs_private = %x\n",
-		   (unsigned int)fsp->fsp_name->st.vfs_private));
-
-	if ((state->ret != -1) &&
-	    ((fsp->fsp_name->st.vfs_private & GPFS_WINATTR_OFFLINE) != 0)) {
-		fsp->fsp_name->st.vfs_private &= ~GPFS_WINATTR_OFFLINE;
+	if ((state->ret != -1) && state->was_offline) {
 		DEBUG(10, ("sending notify\n"));
 		notify_fname(fsp->conn, NOTIFY_ACTION_MODIFIED,
 			     FILE_NOTIFY_CHANGE_ATTRIBUTES,
@@ -2230,15 +2218,14 @@ static ssize_t vfs_gpfs_pwrite(vfs_handle_struct *handle, files_struct *fsp,
 			       const void *data, size_t n, off_t offset)
 {
 	ssize_t ret;
+	bool was_offline;
 
-	ret = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
+	was_offline = SMB_VFS_IS_OFFLINE(handle->conn, fsp->fsp_name,
+					 &fsp->fsp_name->st);
 
-	DEBUG(10, ("vfs_private = %x\n",
-		   (unsigned int)fsp->fsp_name->st.vfs_private));
+	ret = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
 
-	if ((ret != -1) &&
-	    ((fsp->fsp_name->st.vfs_private & GPFS_WINATTR_OFFLINE) != 0)) {
-		fsp->fsp_name->st.vfs_private &= ~GPFS_WINATTR_OFFLINE;
+	if ((ret != -1) && was_offline) {
 		notify_fname(handle->conn, NOTIFY_ACTION_MODIFIED,
 			     FILE_NOTIFY_CHANGE_ATTRIBUTES,
 			     fsp->fsp_name->base_name);
@@ -2251,6 +2238,7 @@ struct vfs_gpfs_pwrite_state {
 	struct files_struct *fsp;
 	ssize_t ret;
 	int err;
+	bool was_offline;
 };
 
 static void vfs_gpfs_pwrite_done(struct tevent_req *subreq);
@@ -2270,6 +2258,8 @@ static struct tevent_req *vfs_gpfs_pwrite_send(
 	if (req == NULL) {
 		return NULL;
 	}
+	state->was_offline = SMB_VFS_IS_OFFLINE(handle->conn, fsp->fsp_name,
+						&fsp->fsp_name->st);
 	state->fsp = fsp;
 	subreq = SMB_VFS_NEXT_PWRITE_SEND(state, ev, handle, fsp, data,
 					 n, offset);
@@ -2303,12 +2293,7 @@ static ssize_t vfs_gpfs_pwrite_recv(struct tevent_req *req, int *err)
 	}
 	*err = state->err;
 
-	DEBUG(10, ("vfs_private = %x\n",
-		   (unsigned int)fsp->fsp_name->st.vfs_private));
-
-	if ((state->ret != -1) &&
-	    ((fsp->fsp_name->st.vfs_private & GPFS_WINATTR_OFFLINE) != 0)) {
-		fsp->fsp_name->st.vfs_private &= ~GPFS_WINATTR_OFFLINE;
+	if ((state->ret != -1) && state->was_offline) {
 		DEBUG(10, ("sending notify\n"));
 		notify_fname(fsp->conn, NOTIFY_ACTION_MODIFIED,
 			     FILE_NOTIFY_CHANGE_ATTRIBUTES,
diff --git a/source3/smbd/durable.c b/source3/smbd/durable.c
index 0da734e..9489cf1 100644
--- a/source3/smbd/durable.c
+++ b/source3/smbd/durable.c
@@ -121,7 +121,6 @@ NTSTATUS vfs_default_durable_cookie(struct files_struct *fsp,
 	cookie.stat_info.st_ex_blocks = fsp->fsp_name->st.st_ex_blocks;
 	cookie.stat_info.st_ex_flags = fsp->fsp_name->st.st_ex_flags;
 	cookie.stat_info.st_ex_mask = fsp->fsp_name->st.st_ex_mask;
-	cookie.stat_info.vfs_private = fsp->fsp_name->st.vfs_private;
 
 	ndr_err = ndr_push_struct_blob(cookie_blob, mem_ctx, &cookie,
 			(ndr_push_flags_fn_t)ndr_push_vfs_default_durable_cookie);
@@ -275,7 +274,6 @@ NTSTATUS vfs_default_durable_disconnect(struct files_struct *fsp,
 	cookie.stat_info.st_ex_blocks = fsp->fsp_name->st.st_ex_blocks;
 	cookie.stat_info.st_ex_flags = fsp->fsp_name->st.st_ex_flags;
 	cookie.stat_info.st_ex_mask = fsp->fsp_name->st.st_ex_mask;
-	cookie.stat_info.vfs_private = fsp->fsp_name->st.vfs_private;
 
 	ndr_err = ndr_push_struct_blob(&new_cookie_blob, mem_ctx, &cookie,
 			(ndr_push_flags_fn_t)ndr_push_vfs_default_durable_cookie);
@@ -536,18 +534,6 @@ static bool vfs_default_durable_reconnect_check_stat(
 		return false;
 	}
 
-	if (cookie_st->vfs_private != fsp_st->vfs_private) {
-		DEBUG(1, ("vfs_default_durable_reconnect (%s): "
-			  "stat_ex.%s differs: "
-			  "cookie:%llu != stat:%llu, "
-			  "denying durable reconnect\n",
-			  name,
-			  "vfs_private",
-			  (unsigned long long)cookie_st->vfs_private,
-			  (unsigned long long)fsp_st->vfs_private));
-		return false;
-	}
-
 	return true;
 }
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list