summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/Makefile.in5
-rw-r--r--source3/configure.in2
-rw-r--r--source3/modules/vfs_gpfs_hsm_notify.c110
3 files changed, 117 insertions, 0 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 9b4518089f..c7d263670a 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -830,6 +830,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
@@ -2971,6 +2972,10 @@ bin/gpfs.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_GPFS_OBJ)
@echo "Building plugin $@"
@$(SHLD_MODULE) $(VFS_GPFS_OBJ)
+bin/gpfs_hsm_notify.@SHLIBEXT@: $(BINARY_PREREQS) $(VFS_GPFS_HSM_NOTIFY_OBJ)
+ @echo "Building plugin $@"
+ @$(SHLD_MODULE) $(VFS_GPFS_HSM_NOTIFY_OBJ)
+
bin/notify_fam.@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 67c440d118..f9263f6e82 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
#############################################
@@ -6882,6 +6883,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_hsm_notify.c b/source3/modules/vfs_gpfs_hsm_notify.c
new file mode 100644
index 0000000000..fa24db9983
--- /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);
+}