[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-151-ge8484e0

Michael Adam obnox at samba.org
Wed Mar 4 10:53:41 GMT 2009


The branch, master has been updated
       via  e8484e01ed6c3893f89abeec5f7a2d214d77c576 (commit)
       via  fb70a8a255f7fd40c7e578d9d21977259f9aa86c (commit)
      from  27cf23958b02b05becce6e7c68347f6fea5b7845 (commit)

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


- Log -----------------------------------------------------------------
commit e8484e01ed6c3893f89abeec5f7a2d214d77c576
Author: Volker Lendecke <vl at samba.org>
Date:   Mon Mar 2 14:56:01 2009 +0100

    Make use of gpfs_get_real_filename optional

commit fb70a8a255f7fd40c7e578d9d21977259f9aa86c
Author: Michael Adam <obnox at samba.org>
Date:   Fri Feb 27 15:28:52 2009 +0100

    s3: Fix a memleak in dbwrap_rbt.
    
    The SMB_MALLOC'ed rbt node data was not free'd on talloc free of
    the db context. This is a quick fix using talloc instead of malloc
    for allocation of the node data.
    
    Since malloc was originally used for performance reasons, one
    might want to reverse to malloc and create a talloc destructor
    that walks the tree and frees all the node data if this talloc
    approach proves to be too slow..
    
    Michael

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

Summary of changes:
 source3/lib/dbwrap_rbt.c   |    8 ++++----
 source3/modules/gpfs.c     |    6 +++++-
 source3/modules/vfs_gpfs.c |    5 +++++
 3 files changed, 14 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/lib/dbwrap_rbt.c b/source3/lib/dbwrap_rbt.c
index 6e09627..cf4faa2 100644
--- a/source3/lib/dbwrap_rbt.c
+++ b/source3/lib/dbwrap_rbt.c
@@ -131,12 +131,12 @@ static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA data, int flag)
 		 */
 	}
 
-	node = (struct db_rbt_node *)SMB_MALLOC(
+	node = (struct db_rbt_node *)talloc_size(rec_priv->db_ctx,
 		offsetof(struct db_rbt_node, data) + rec->key.dsize
 		+ data.dsize);
 
 	if (node == NULL) {
-		SAFE_FREE(rec_priv->node);
+		TALLOC_FREE(rec_priv->node);
 		return NT_STATUS_NO_MEMORY;
 	}
 
@@ -148,7 +148,7 @@ static NTSTATUS db_rbt_store(struct db_record *rec, TDB_DATA data, int flag)
 	db_rbt_parse_node(node, &this_key, &this_val);
 
 	memcpy(this_key.dptr, rec->key.dptr, node->keysize);
-	SAFE_FREE(rec_priv->node);
+	TALLOC_FREE(rec_priv->node);
 
 	memcpy(this_val.dptr, data.dptr, node->valuesize);
 
@@ -194,7 +194,7 @@ static NTSTATUS db_rbt_delete(struct db_record *rec)
 	}
 
 	rb_erase(&rec_priv->node->rb_node, &rec_priv->db_ctx->tree);
-	SAFE_FREE(rec_priv->node);
+	TALLOC_FREE(rec_priv->node);
 
 	return NT_STATUS_OK;
 }
diff --git a/source3/modules/gpfs.c b/source3/modules/gpfs.c
index 1659900..9fc4524 100644
--- a/source3/modules/gpfs.c
+++ b/source3/modules/gpfs.c
@@ -26,6 +26,7 @@
 
 static bool gpfs_share_modes;
 static bool gpfs_leases;
+static bool gpfs_getrealfilename;
 
 static int (*gpfs_set_share_fn)(int fd, unsigned int allow, unsigned int deny);
 static int (*gpfs_set_lease_fn)(int fd, unsigned int leaseType);
@@ -139,7 +140,8 @@ int smbd_gpfs_putacl(char *pathname, int flags, void *acl)
 int smbd_gpfs_get_realfilename_path(char *pathname, char *filenamep,
 				    int *buflen)
 {
-	if (gpfs_get_realfilename_path_fn == NULL) {
+	if ((!gpfs_getrealfilename)
+	    || (gpfs_get_realfilename_path_fn == NULL)) {
 		errno = ENOSYS;
 		return -1;
 	}
@@ -208,6 +210,8 @@ void init_gpfs(void)
 
 	gpfs_share_modes = lp_parm_bool(-1, "gpfs", "sharemodes", True);
 	gpfs_leases      = lp_parm_bool(-1, "gpfs", "leases", True);
+	gpfs_getrealfilename = lp_parm_bool(-1, "gpfs", "getrealfilename",
+					    True);
 
 	return;
 }
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index 1d7cdba..3c061ec 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -96,6 +96,11 @@ static int vfs_gpfs_get_real_filename(struct vfs_handle_struct *handle,
 
 	TALLOC_FREE(full_path);
 
+	if ((result == -1) && (errno == ENOSYS)) {
+		return SMB_VFS_NEXT_GET_REAL_FILENAME(
+			handle, path, name, mem_ctx, found_name);
+	}
+
 	if (result == -1) {
 		DEBUG(10, ("smbd_gpfs_get_realfilename_path returned %s\n",
 			   strerror(errno)));


-- 
Samba Shared Repository


More information about the samba-cvs mailing list