[SCM] Samba Shared Repository - branch master updated

Christian Ambach ambi at samba.org
Fri Aug 17 12:06:03 MDT 2012


The branch, master has been updated
       via  f46c4df s3:vfs_tsmsm only send notifications when file was offline before
       via  dda4c5d s3: Adapt the tsmsm module to the new aio routines
       via  d1e1f82 s3-vfs: Fix calls of lp_parm_talloc_string
       via  3755a41 s3: Remove the gpfs_hsm_notify module
       via  2c3a58d s3: Merge vfs_gpfs_hsm_notify into vfs_gpfs.c
      from  2e1ab13 s4-dsdb: Use tmp_ctx in kccsrv_check_deleted to avoid leaking memory onto part->dn

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


- Log -----------------------------------------------------------------
commit f46c4dfe28831a6e8d610589c0d45193070c4864
Author: Christian Ambach <ambi at samba.org>
Date:   Fri Aug 17 17:40:24 2012 +0200

    s3:vfs_tsmsm only send notifications when file was offline before
    
    Autobuild-User(master): Christian Ambach <ambi at samba.org>
    Autobuild-Date(master): Fri Aug 17 20:05:30 CEST 2012 on sn-devel-104

commit dda4c5d7945e5538588b9a59a456a4e5eb63daf6
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Aug 10 11:33:54 2012 +0200

    s3: Adapt the tsmsm module to the new aio routines
    
    Signed-off-by: Christian Ambach <ambi at samba.org>

commit d1e1f8224f578c9b92e81db6b93f4fb7af135138
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Aug 8 11:23:12 2012 +0200

    s3-vfs: Fix calls of lp_parm_talloc_string
    
    Signed-off-by: Christian Ambach <ambi at samba.org>

commit 3755a418ccee85d633aaac5047c007893ce63c73
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Aug 8 10:38:36 2012 +0200

    s3: Remove the gpfs_hsm_notify module
    
    The functionality has been merged into vfs_gpfs
    
    Signed-off-by: Christian Ambach <ambi at samba.org>

commit 2c3a58db9e2149785486e6b6398615f2d226dc23
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Aug 8 00:32:35 2012 +0200

    s3: Merge vfs_gpfs_hsm_notify into vfs_gpfs.c
    
    It was separated out because formerly our async I/O was not properly
    stackable. aio_fork could for example catch aio and not get aio_return
    get through to vfs_gpfs
    
    Signed-off-by: Christian Ambach <ambi at samba.org>

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

Summary of changes:
 packaging/RHEL-CTDB/configure.rpm     |    2 +-
 packaging/RHEL-CTDB/samba.spec.tmpl   |    3 +-
 source3/Makefile.in                   |    5 -
 source3/configure.in                  |    2 -
 source3/modules/vfs_gpfs.c            |  190 +++++++++++++++++++++++++++++++++
 source3/modules/vfs_gpfs_hsm_notify.c |  110 -------------------
 source3/modules/vfs_tsmsm.c           |  147 +++++++++++++++++++++++---
 source3/modules/wscript_build         |    8 --
 source3/wscript                       |    2 +-
 9 files changed, 326 insertions(+), 143 deletions(-)
 delete mode 100644 source3/modules/vfs_gpfs_hsm_notify.c


Changeset truncated at 500 lines:

diff --git a/packaging/RHEL-CTDB/configure.rpm b/packaging/RHEL-CTDB/configure.rpm
index c2a0302..5e2b88e 100755
--- a/packaging/RHEL-CTDB/configure.rpm
+++ b/packaging/RHEL-CTDB/configure.rpm
@@ -51,7 +51,7 @@ CC="$CC" CFLAGS="-Wall -g -D_GNU_SOURCE -O3" ./configure -C \
 	--without-smbwrapper \
 	--with-pam \
 	--with-quotas \
-	--with-shared-modules=idmap_rid,idmap_ad,idmap_tdb2,vfs_gpfs,vfs_tsmsm,vfs_gpfs_hsm_notify \
+	--with-shared-modules=idmap_rid,idmap_ad,idmap_tdb2,vfs_gpfs,vfs_tsmsm \
 	--with-syslog \
 	--with-utmp \
 	--with-cluster-support \
diff --git a/packaging/RHEL-CTDB/samba.spec.tmpl b/packaging/RHEL-CTDB/samba.spec.tmpl
index a9111d2..80237e7 100644
--- a/packaging/RHEL-CTDB/samba.spec.tmpl
+++ b/packaging/RHEL-CTDB/samba.spec.tmpl
@@ -186,7 +186,7 @@ CFLAGS="$RPM_OPT_FLAGS $EXTRA -D_GNU_SOURCE" ./configure \
         --without-smbwrapper \
 	--with-pam \
 	--with-quotas \
-	--with-shared-modules=idmap_rid,idmap_ad,idmap_tdb2,vfs_gpfs,vfs_tsmsm,vfs_gpfs_hsm_notify \
+	--with-shared-modules=idmap_rid,idmap_ad,idmap_tdb2,vfs_gpfs,vfs_tsmsm \
 	--with-syslog \
 	--with-utmp \
 	--with-cluster-support \
@@ -416,7 +416,6 @@ exit 0
 %{_libarchdir}/samba/vfs/fileid.so
 %{_libarchdir}/samba/vfs/full_audit.so
 %{_libarchdir}/samba/vfs/gpfs.so
-%{_libarchdir}/samba/vfs/gpfs_hsm_notify.so
 %{_libarchdir}/samba/vfs/linux_xfs_sgid.so
 %{_libarchdir}/samba/vfs/netatalk.so
 %{_libarchdir}/samba/vfs/preopen.so
diff --git a/source3/Makefile.in b/source3/Makefile.in
index b8b055a..57c6c1d 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -882,7 +882,6 @@ VFS_CACHEPRIME_OBJ = modules/vfs_cacheprime.o
 VFS_PREALLOC_OBJ = modules/vfs_prealloc.o
 VFS_COMMIT_OBJ = modules/vfs_commit.o
 VFS_GPFS_OBJ = modules/vfs_gpfs.o modules/gpfs.o modules/nfs4_acls.o
-VFS_GPFS_HSM_NOTIFY_OBJ = modules/vfs_gpfs_hsm_notify.o
 VFS_NOTIFY_FAM_OBJ = modules/vfs_notify_fam.o
 VFS_READAHEAD_OBJ = modules/vfs_readahead.o
 VFS_TSMSM_OBJ = modules/vfs_tsmsm.o
@@ -2849,10 +2848,6 @@ bin/gpfs. at SHLIBEXT@: $(BINARY_PREREQS) $(VFS_GPFS_OBJ)
 	@echo "Building plugin $@"
 	@$(SHLD_MODULE) $(VFS_GPFS_OBJ)
 
-bin/gpfs_hsm_notify. at SHLIBEXT@: $(BINARY_PREREQS) $(VFS_GPFS_HSM_NOTIFY_OBJ)
-	@echo "Building plugin $@"
-	@$(SHLD_MODULE) $(VFS_GPFS_HSM_NOTIFY_OBJ)
-
 bin/notify_fam. at SHLIBEXT@: $(BINARY_PREREQS) $(VFS_NOTIFY_FAM_OBJ)
 	@echo "Building plugin $@"
 	@$(SHLD_MODULE) $(VFS_NOTIFY_FAM_OBJ) @SMB_FAM_LIBS@
diff --git a/source3/configure.in b/source3/configure.in
index 44fd38d..28894f1 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -1000,7 +1000,6 @@ AC_CHECK_HEADERS(gpfs_gpl.h)
 if test x"$ac_cv_header_gpfs_gpl_h" = x"yes"; then
     AC_DEFINE(HAVE_GPFS,1,[Whether GPFS GPL headers are available])
     default_shared_modules="$default_shared_modules vfs_gpfs"
-    default_shared_modules="$default_shared_modules vfs_gpfs_hsm_notify"
 fi
 
 # Note that all the libunwind symbols in the API are defined to internal
@@ -6556,7 +6555,6 @@ SMB_MODULE(vfs_cacheprime, \$(VFS_CACHEPRIME_OBJ), "bin/cacheprime.$SHLIBEXT", V
 SMB_MODULE(vfs_prealloc, \$(VFS_PREALLOC_OBJ), "bin/prealloc.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_commit, \$(VFS_COMMIT_OBJ), "bin/commit.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_gpfs, \$(VFS_GPFS_OBJ), "bin/gpfs.$SHLIBEXT", VFS)
-SMB_MODULE(vfs_gpfs_hsm_notify, \$(VFS_GPFS_PREFETCH_OBJ), "bin/gpfs_hsm_notify.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_readahead, \$(VFS_READAHEAD_OBJ), "bin/readahead.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_tsmsm, \$(VFS_TSMSM_OBJ), "bin/tsmsm.$SHLIBEXT", VFS)
 SMB_MODULE(vfs_fileid, \$(VFS_FILEID_OBJ), "bin/fileid.$SHLIBEXT", VFS)
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index a988c09..7a01257 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -34,6 +34,7 @@
 #include "vfs_gpfs.h"
 #include "system/filesys.h"
 #include "auth.h"
+#include "lib/util/tevent_unix.h"
 
 struct gpfs_config_data {
 	bool sharemodes;
@@ -1691,6 +1692,189 @@ static int vfs_gpfs_open(struct vfs_handle_struct *handle,
 	return SMB_VFS_NEXT_OPEN(handle, smb_fname, fsp, flags, mode);
 }
 
+static ssize_t vfs_gpfs_pread(vfs_handle_struct *handle, files_struct *fsp,
+			      void *data, size_t n, off_t offset)
+{
+	ssize_t ret;
+
+	ret = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
+
+	DEBUG(10, ("vfs_private = %x\n",
+		   (unsigned int)fsp->fsp_name->st.vfs_private));
+
+	if ((ret != -1) &&
+	    ((fsp->fsp_name->st.vfs_private & GPFS_WINATTR_OFFLINE) != 0)) {
+		fsp->fsp_name->st.vfs_private &= ~GPFS_WINATTR_OFFLINE;
+		notify_fname(handle->conn, NOTIFY_ACTION_MODIFIED,
+			     FILE_NOTIFY_CHANGE_ATTRIBUTES,
+			     fsp->fsp_name->base_name);
+	}
+
+	return ret;
+}
+
+struct vfs_gpfs_pread_state {
+	struct files_struct *fsp;
+	ssize_t ret;
+	int err;
+};
+
+static void vfs_gpfs_pread_done(struct tevent_req *subreq);
+
+static struct tevent_req *vfs_gpfs_pread_send(struct vfs_handle_struct *handle,
+					      TALLOC_CTX *mem_ctx,
+					      struct tevent_context *ev,
+					      struct files_struct *fsp,
+					      void *data, size_t n,
+					      off_t offset)
+{
+	struct tevent_req *req, *subreq;
+	struct vfs_gpfs_pread_state *state;
+
+	req = tevent_req_create(mem_ctx, &state, struct vfs_gpfs_pread_state);
+	if (req == NULL) {
+		return NULL;
+	}
+	state->fsp = fsp;
+	subreq = SMB_VFS_NEXT_PREAD_SEND(state, ev, handle, fsp, data,
+					 n, offset);
+	if (tevent_req_nomem(subreq, req)) {
+		return tevent_req_post(req, ev);
+	}
+	tevent_req_set_callback(subreq, vfs_gpfs_pread_done, req);
+	return req;
+}
+
+static void vfs_gpfs_pread_done(struct tevent_req *subreq)
+{
+	struct tevent_req *req = tevent_req_callback_data(
+		subreq, struct tevent_req);
+	struct vfs_gpfs_pread_state *state = tevent_req_data(
+		req, struct vfs_gpfs_pread_state);
+
+	state->ret = SMB_VFS_PREAD_RECV(subreq, &state->err);
+	TALLOC_FREE(subreq);
+	tevent_req_done(req);
+}
+
+static ssize_t vfs_gpfs_pread_recv(struct tevent_req *req, int *err)
+{
+	struct vfs_gpfs_pread_state *state = tevent_req_data(
+		req, struct vfs_gpfs_pread_state);
+	struct files_struct *fsp = state->fsp;
+
+	if (tevent_req_is_unix_error(req, err)) {
+		return -1;
+	}
+	*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;
+		DEBUG(10, ("sending notify\n"));
+		notify_fname(fsp->conn, NOTIFY_ACTION_MODIFIED,
+			     FILE_NOTIFY_CHANGE_ATTRIBUTES,
+			     fsp->fsp_name->base_name);
+	}
+
+	return state->ret;
+}
+
+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;
+
+	ret = SMB_VFS_NEXT_PWRITE(handle, fsp, data, n, offset);
+
+	DEBUG(10, ("vfs_private = %x\n",
+		   (unsigned int)fsp->fsp_name->st.vfs_private));
+
+	if ((ret != -1) &&
+	    ((fsp->fsp_name->st.vfs_private & GPFS_WINATTR_OFFLINE) != 0)) {
+		fsp->fsp_name->st.vfs_private &= ~GPFS_WINATTR_OFFLINE;
+		notify_fname(handle->conn, NOTIFY_ACTION_MODIFIED,
+			     FILE_NOTIFY_CHANGE_ATTRIBUTES,
+			     fsp->fsp_name->base_name);
+	}
+
+	return ret;
+}
+
+struct vfs_gpfs_pwrite_state {
+	struct files_struct *fsp;
+	ssize_t ret;
+	int err;
+};
+
+static void vfs_gpfs_pwrite_done(struct tevent_req *subreq);
+
+static struct tevent_req *vfs_gpfs_pwrite_send(
+	struct vfs_handle_struct *handle,
+	TALLOC_CTX *mem_ctx,
+	struct tevent_context *ev,
+	struct files_struct *fsp,
+	const void *data, size_t n,
+	off_t offset)
+{
+	struct tevent_req *req, *subreq;
+	struct vfs_gpfs_pwrite_state *state;
+
+	req = tevent_req_create(mem_ctx, &state, struct vfs_gpfs_pwrite_state);
+	if (req == NULL) {
+		return NULL;
+	}
+	state->fsp = fsp;
+	subreq = SMB_VFS_NEXT_PWRITE_SEND(state, ev, handle, fsp, data,
+					 n, offset);
+	if (tevent_req_nomem(subreq, req)) {
+		return tevent_req_post(req, ev);
+	}
+	tevent_req_set_callback(subreq, vfs_gpfs_pwrite_done, req);
+	return req;
+}
+
+static void vfs_gpfs_pwrite_done(struct tevent_req *subreq)
+{
+	struct tevent_req *req = tevent_req_callback_data(
+		subreq, struct tevent_req);
+	struct vfs_gpfs_pwrite_state *state = tevent_req_data(
+		req, struct vfs_gpfs_pwrite_state);
+
+	state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->err);
+	TALLOC_FREE(subreq);
+	tevent_req_done(req);
+}
+
+static ssize_t vfs_gpfs_pwrite_recv(struct tevent_req *req, int *err)
+{
+	struct vfs_gpfs_pwrite_state *state = tevent_req_data(
+		req, struct vfs_gpfs_pwrite_state);
+	struct files_struct *fsp = state->fsp;
+
+	if (tevent_req_is_unix_error(req, err)) {
+		return -1;
+	}
+	*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;
+		DEBUG(10, ("sending notify\n"));
+		notify_fname(fsp->conn, NOTIFY_ACTION_MODIFIED,
+			     FILE_NOTIFY_CHANGE_ATTRIBUTES,
+			     fsp->fsp_name->base_name);
+	}
+
+	return state->ret;
+}
+
 
 static struct vfs_fn_pointers vfs_gpfs_fns = {
 	.connect_fn = vfs_gpfs_connect,
@@ -1721,6 +1905,12 @@ static struct vfs_fn_pointers vfs_gpfs_fns = {
 	.sendfile_fn = vfs_gpfs_sendfile,
 	.fallocate_fn = vfs_gpfs_fallocate,
 	.open_fn = vfs_gpfs_open,
+	.pread_fn = vfs_gpfs_pread,
+	.pread_send_fn = vfs_gpfs_pread_send,
+	.pread_recv_fn = vfs_gpfs_pread_recv,
+	.pwrite_fn = vfs_gpfs_pwrite,
+	.pwrite_send_fn = vfs_gpfs_pwrite_send,
+	.pwrite_recv_fn = vfs_gpfs_pwrite_recv,
 	.ftruncate_fn = vfs_gpfs_ftruncate
 };
 
diff --git a/source3/modules/vfs_gpfs_hsm_notify.c b/source3/modules/vfs_gpfs_hsm_notify.c
deleted file mode 100644
index d53363c..0000000
--- a/source3/modules/vfs_gpfs_hsm_notify.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
-   Unix SMB/CIFS implementation.
-   Make sure offline->online changes are propagated by notifies
-
-   This module must come before aio_fork in the chain, because
-   aio_fork (correcly!) does not propagate the aio calls further
-
-   Copyright (C) Volker Lendecke 2011
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "includes.h"
-#include "smbd/smbd.h"
-#include "librpc/gen_ndr/ndr_xattr.h"
-#include "include/smbprofile.h"
-
-#undef DBGC_CLASS
-#define DBGC_CLASS DBGC_VFS
-
-#include <gpfs_gpl.h>
-#include "nfs4_acls.h"
-#include "vfs_gpfs.h"
-
-static ssize_t vfs_gpfs_hsm_notify_pread(vfs_handle_struct *handle, files_struct *fsp,
-			      void *data, size_t n, off_t offset)
-{
-	ssize_t ret;
-
-	ret = SMB_VFS_NEXT_PREAD(handle, fsp, data, n, offset);
-
-	DEBUG(10, ("vfs_private = %x\n",
-		   (unsigned int)fsp->fsp_name->st.vfs_private));
-
-	if ((ret != -1) &&
-	    ((fsp->fsp_name->st.vfs_private & GPFS_WINATTR_OFFLINE) != 0)) {
-		fsp->fsp_name->st.vfs_private &= ~GPFS_WINATTR_OFFLINE;
-		notify_fname(handle->conn, NOTIFY_ACTION_MODIFIED,
-			     FILE_NOTIFY_CHANGE_ATTRIBUTES,
-			     fsp->fsp_name->base_name);
-	}
-
-	return ret;
-}
-
-static ssize_t vfs_gpfs_hsm_notify_pwrite(struct vfs_handle_struct *handle,
-			       struct files_struct *fsp,
-			       const void *data, size_t n, off_t offset)
-{
-	ssize_t ret;
-
-	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;
-		notify_fname(handle->conn, NOTIFY_ACTION_MODIFIED,
-			     FILE_NOTIFY_CHANGE_ATTRIBUTES,
-			     fsp->fsp_name->base_name);
-	}
-
-	return ret;
-}
-
-static ssize_t vfs_gpfs_hsm_notify_aio_return(struct vfs_handle_struct *handle,
-				   struct files_struct *fsp,
-				   SMB_STRUCT_AIOCB *aiocb)
-{
-	ssize_t ret;
-
-	ret = SMB_VFS_NEXT_AIO_RETURN(handle, fsp, aiocb);
-
-	DEBUG(10, ("vfs_gpfs_hsm_notify_aio_return: vfs_private = %x\n",
-		   (unsigned int)fsp->fsp_name->st.vfs_private));
-
-	if ((ret != -1) &&
-	    ((fsp->fsp_name->st.vfs_private & GPFS_WINATTR_OFFLINE) != 0)) {
-		fsp->fsp_name->st.vfs_private &= ~GPFS_WINATTR_OFFLINE;
-		DEBUG(10, ("sending notify\n"));
-		notify_fname(handle->conn, NOTIFY_ACTION_MODIFIED,
-			     FILE_NOTIFY_CHANGE_ATTRIBUTES,
-			     fsp->fsp_name->base_name);
-	}
-
-	return ret;
-}
-
-static struct vfs_fn_pointers vfs_gpfs_hsm_notify_fns = {
-	.pread_fn = vfs_gpfs_hsm_notify_pread,
-	.pwrite_fn = vfs_gpfs_hsm_notify_pwrite,
-	.aio_return_fn = vfs_gpfs_hsm_notify_aio_return
-};
-
-NTSTATUS vfs_gpfs_hsm_notify_init(void);
-NTSTATUS vfs_gpfs_hsm_notify_init(void)
-{
-	return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "gpfs_hsm_notify",
-				&vfs_gpfs_hsm_notify_fns);
-}
diff --git a/source3/modules/vfs_tsmsm.c b/source3/modules/vfs_tsmsm.c
index 8b138d3..e4bc7eb 100644
--- a/source3/modules/vfs_tsmsm.c
+++ b/source3/modules/vfs_tsmsm.c
@@ -40,6 +40,7 @@
 
 #include "includes.h"
 #include "smbd/smbd.h"
+#include "lib/util/tevent_unix.h"
 
 #ifndef USE_DMAPI
 #error "This module requires DMAPI support!"
@@ -114,16 +115,19 @@ static int tsmsm_connect(struct vfs_handle_struct *handle,
 	tsmname = (handle->param ? handle->param : "tsmsm");
 	
 	/* Get 'hsm script' and 'dmapi attribute' parameters to tsmd context */
-	tsmd->hsmscript = lp_parm_talloc_string(SNUM(handle->conn), tsmname,
-						"hsm script", NULL);
+	tsmd->hsmscript = lp_parm_talloc_string(
+		tsmd, SNUM(handle->conn), tsmname,
+		"hsm script", NULL);
 	talloc_steal(tsmd, tsmd->hsmscript);
 	
-	tsmd->attrib_name = lp_parm_talloc_string(SNUM(handle->conn), tsmname, 
-						  "dmapi attribute", DM_ATTRIB_OBJECT);
+	tsmd->attrib_name = lp_parm_talloc_string(
+		tsmd, SNUM(handle->conn), tsmname,
+		"dmapi attribute", DM_ATTRIB_OBJECT);
 	talloc_steal(tsmd, tsmd->attrib_name);
 	
-	tsmd->attrib_value = lp_parm_talloc_string(SNUM(handle->conn), "tsmsm", 
-						   "dmapi value", NULL);
+	tsmd->attrib_value = lp_parm_talloc_string(
+		tsmd, SNUM(handle->conn), tsmname,
+		"dmapi value", NULL);
 	talloc_steal(tsmd, tsmd->attrib_value);
 	
 	/* retrieve 'online ratio'. In case of error default to FILE_IS_ONLINE_RATIO */
@@ -282,19 +286,131 @@ static bool tsmsm_aio_force(struct vfs_handle_struct *handle, struct files_struc
 	return false;
 }
 
-static ssize_t tsmsm_aio_return(struct vfs_handle_struct *handle, struct files_struct *fsp, 
-				SMB_STRUCT_AIOCB *aiocb)
+struct tsmsm_pread_state {
+	struct files_struct *fsp;
+	ssize_t ret;
+	int err;
+	bool was_offline;
+};
+
+static void tsmsm_pread_done(struct tevent_req *subreq);
+
+static struct tevent_req *tsmsm_pread_send(struct vfs_handle_struct *handle,
+					   TALLOC_CTX *mem_ctx,
+					   struct tevent_context *ev,
+					   struct files_struct *fsp,
+					   void *data, size_t n, off_t offset)
 {
-	ssize_t result;
+	struct tevent_req *req, *subreq;
+	struct tsmsm_pread_state *state;
 
-	result = SMB_VFS_NEXT_AIO_RETURN(handle, fsp, aiocb);
-	if(result >= 0) {
-		notify_fname(handle->conn, NOTIFY_ACTION_MODIFIED,
+	req = tevent_req_create(mem_ctx, &state, struct tsmsm_pread_state);
+	if (req == NULL) {
+		return NULL;
+	}
+	state->fsp = fsp;
+	state->was_offline = tsmsm_aio_force(handle, fsp);
+	subreq = SMB_VFS_NEXT_PREAD_SEND(state, ev, handle, fsp, data,
+					 n, offset);
+	if (tevent_req_nomem(subreq, req)) {
+		return tevent_req_post(req, ev);
+	}
+	tevent_req_set_callback(subreq, tsmsm_pread_done, req);
+	return req;
+}
+
+static void tsmsm_pread_done(struct tevent_req *subreq)
+{
+	struct tevent_req *req = tevent_req_callback_data(
+		subreq, struct tevent_req);
+	struct tsmsm_pread_state *state = tevent_req_data(
+		req, struct tsmsm_pread_state);
+
+	state->ret = SMB_VFS_PREAD_RECV(subreq, &state->err);
+	TALLOC_FREE(subreq);
+	tevent_req_done(req);
+}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list