[SCM] Samba Shared Repository - branch v3-6-test updated

Volker Lendecke vlendec at samba.org
Wed May 4 09:17:21 MDT 2011


The branch, v3-6-test has been updated
       via  ce095f4 RHEL-CTDB: Build vfs_gpfs_hsm_notify
       via  a250a9c vfs_gpfs: Properly notify the offline->online changes
       via  c2c2953 vfs_gpfs: Block sendfile for offline files (cherry picked from commit 41bde55821a6c18ace24330aede8d4928215e658)
       via  03a9d9d vfs_gpfs: Store the winattrs in st.vfs_private
      from  2f6e543 s3: Properly deal with exited winbind children

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


- Log -----------------------------------------------------------------
commit ce095f4eb7c9e8814bc4c3c8177a44a3eabd838c
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 4 16:02:15 2011 +0200

    RHEL-CTDB: Build vfs_gpfs_hsm_notify
    
    Autobuild-User: Volker Lendecke <vlendec at samba.org>
    Autobuild-Date: Wed May  4 17:12:14 CEST 2011 on sn-devel-104
    (cherry picked from commit 3e211510034dd3854017e1b35ef5e1964085df5d)

commit a250a9ca068b94267888aa406c14c43a6642eb14
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 4 15:48:27 2011 +0200

    vfs_gpfs: Properly notify the offline->online changes
    
    This needs to be a separate module that cooperates with vfs_gpfs. If aio_fork
    is used early in the module chain it (correctly) does not propagate the aio ops
    down, so vfs_gpfs does not see them. This slim module must come early in the
    chain for notifies to work properly.
    (cherry picked from commit 3f68b43dd56b8f338a18074741162bf6437ae78d)

commit c2c29533fc4a7467130dff0582249cccc49e001e
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 4 15:47:42 2011 +0200

    vfs_gpfs: Block sendfile for offline files
    (cherry picked from commit 41bde55821a6c18ace24330aede8d4928215e658)

commit 03a9d9dbce61ceb2506a0f193d6407c7d8f4c7e6
Author: Volker Lendecke <vl at samba.org>
Date:   Wed May 4 15:42:54 2011 +0200

    vfs_gpfs: Store the winattrs in st.vfs_private
    
    This avoids a considerable amount of gpfs_winattr calls
    (cherry picked from commit 2329fb56a701804585d866817586b4d567966b92)

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

Summary of changes:
 packaging/RHEL-CTDB/samba.spec.tmpl   |    3 +-
 source3/Makefile.in                   |    5 ++
 source3/configure.in                  |    2 +
 source3/modules/vfs_gpfs.c            |   29 +++++++--
 source3/modules/vfs_gpfs_hsm_notify.c |  110 +++++++++++++++++++++++++++++++++
 5 files changed, 143 insertions(+), 6 deletions(-)
 create mode 100644 source3/modules/vfs_gpfs_hsm_notify.c


Changeset truncated at 500 lines:

diff --git a/packaging/RHEL-CTDB/samba.spec.tmpl b/packaging/RHEL-CTDB/samba.spec.tmpl
index 5e80840..3a4ec77 100644
--- a/packaging/RHEL-CTDB/samba.spec.tmpl
+++ b/packaging/RHEL-CTDB/samba.spec.tmpl
@@ -246,7 +246,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 \
+	--with-shared-modules=idmap_rid,idmap_ad,idmap_tdb2,vfs_gpfs,vfs_tsmsm,vfs_gpfs_hsm_notify \
 	--with-syslog \
 	--with-utmp \
 	--with-cluster-support \
@@ -482,6 +482,7 @@ exit 0
 %{_libarchdir}/samba/vfs/fileid.so
 %{_libarchdir}/samba/vfs/full_audit.so
 %{_libarchdir}/samba/vfs/gpfs.so
+%{_libarchdir}/samba/vfs/gpfs_prefetch_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 53886e1..db29a83 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -820,6 +820,7 @@ 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
@@ -2967,6 +2968,10 @@ 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 05a4ae1..d8c59b6 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -1117,6 +1117,7 @@ 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
 
 #############################################
@@ -6870,6 +6871,7 @@ 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 b8bc1b2..7d5d199 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -1088,6 +1088,7 @@ static int vfs_gpfs_stat(struct vfs_handle_struct *handle,
 	if (ret == 0) {
 		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;
 }
@@ -1135,6 +1136,7 @@ static int vfs_gpfs_lstat(struct vfs_handle_struct *handle,
 	if (ret == 0) {
 		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;
 }
@@ -1199,18 +1201,23 @@ static bool vfs_gpfs_is_offline(struct vfs_handle_struct *handle,
 	struct gpfs_winattr attrs;
 	char *path = NULL;
 	NTSTATUS status;
-	int ret;
 
 	status = get_full_smb_filename(talloc_tos(), fname, &path);
 	if (!NT_STATUS_IS_OK(status)) {
 		errno = map_errno_from_nt_status(status);
 		return -1;
 	}
-	ret = get_gpfs_winattrs(path, &attrs);
 
-	if (ret == -1) {
-		TALLOC_FREE(path);
-		return false;
+	if (VALID_STAT(*sbuf)) {
+		attrs.winAttrs = sbuf->vfs_private;
+	} else {
+		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));
@@ -1228,6 +1235,17 @@ static bool vfs_gpfs_aio_force(struct vfs_handle_struct *handle,
 	return vfs_gpfs_is_offline(handle, fsp->fsp_name, &fsp->fsp_name->st);
 }
 
+static ssize_t vfs_gpfs_sendfile(vfs_handle_struct *handle, int tofd,
+				 files_struct *fsp, const DATA_BLOB *hdr,
+				 SMB_OFF_T offset, size_t n)
+{
+	if ((fsp->fsp_name->st.vfs_private & GPFS_WINATTR_OFFLINE) != 0) {
+		errno = ENOSYS;
+		return -1;
+	}
+	return SMB_VFS_NEXT_SENDFILE(handle, tofd, fsp, hdr, offset, n);
+}
+
 int vfs_gpfs_connect(struct vfs_handle_struct *handle, const char *service,
 			const char *user)
 {
@@ -1307,6 +1325,7 @@ static struct vfs_fn_pointers vfs_gpfs_fns = {
 	.ntimes = vfs_gpfs_ntimes,
 	.is_offline = vfs_gpfs_is_offline,
 	.aio_force = vfs_gpfs_aio_force,
+	.sendfile = vfs_gpfs_sendfile,
 	.ftruncate = vfs_gpfs_ftruncate
 };
 
diff --git a/source3/modules/vfs_gpfs_hsm_notify.c b/source3/modules/vfs_gpfs_hsm_notify.c
new file mode 100644
index 0000000..fa24db9
--- /dev/null
+++ b/source3/modules/vfs_gpfs_hsm_notify.c
@@ -0,0 +1,110 @@
+/*
+   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, SMB_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, SMB_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 = vfs_gpfs_hsm_notify_pread,
+	.pwrite = 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);
+}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list