diff options
74 files changed, 2269 insertions, 2857 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 39c042b9c..57f7deb59 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -50,7 +50,7 @@ Descriptions of section entries: General Project Architects -------------------------- -M: Amar Tumballi <amarts@redhat.com> +M: Amar Tumballi <amarts@gmail.com> M: Anand Avati <avati@redhat.com> M: Jeff Darcy <jdarcy@redhat.com> M: Kaleb S. Keithley <kkeithle@redhat.com> @@ -131,7 +131,7 @@ F: cli/ F: xlators/mgmt/ Remote Procedure Call subsystem -M: Amar Tumballi <amarts@redhat.com> +M: Amar Tumballi <amarts@gmail.com> M: Anand Avati <avati@redhat.com> S: Maintained F: rpc/ diff --git a/api/src/glfs-mgmt.c b/api/src/glfs-mgmt.c index 6843e9cb3..afb351da0 100644 --- a/api/src/glfs-mgmt.c +++ b/api/src/glfs-mgmt.c @@ -236,11 +236,19 @@ mgmt_getspec_cbk (struct rpc_req *req, struct iovec *iov, int count, int ret = 0; ssize_t size = 0; FILE *tmpfp = NULL; - int need_retry = 0; + int need_retry = 0; struct glfs *fs = NULL; frame = myframe; ctx = frame->this->ctx; + + if (!ctx) { + gf_log (frame->this->name, GF_LOG_ERROR, "NULL context"); + errno = EINVAL; + ret = -1; + goto out; + } + fs = ((xlator_t *)ctx->master)->private; if (-1 == req->rpc_status) { @@ -260,7 +268,7 @@ mgmt_getspec_cbk (struct rpc_req *req, struct iovec *iov, int count, gf_log (frame->this->name, GF_LOG_ERROR, "failed to get the 'volume file' from server"); ret = -1; - errno = rsp.op_errno; + errno = rsp.op_errno; goto out; } @@ -296,7 +304,7 @@ mgmt_getspec_cbk (struct rpc_req *req, struct iovec *iov, int count, */ ret = glusterfs_volfile_reconfigure (fs->oldvollen, tmpfp, fs->ctx, - fs->oldvolfile); + fs->oldvolfile); if (ret == 0) { gf_log ("glusterfsd-mgmt", GF_LOG_DEBUG, "No need to re-load volfile, reconfigure done"); @@ -323,13 +331,13 @@ out: if (rsp.spec) free (rsp.spec); - // Stop if server is running at an unsupported op-version - if (ENOTSUP == ret) { - gf_log ("mgmt", GF_LOG_ERROR, "Server is operating at an " - "op-version which is not supported"); - errno = ENOTSUP; - glfs_init_done (fs, -1); - } + // Stop if server is running at an unsupported op-version + if (ENOTSUP == ret) { + gf_log ("mgmt", GF_LOG_ERROR, "Server is operating at an " + "op-version which is not supported"); + errno = ENOTSUP; + glfs_init_done (fs, -1); + } if (ret && ctx && !ctx->active) { /* Do it only for the first time */ @@ -339,10 +347,10 @@ out: "failed to fetch volume file (key:%s)", ctx->cmd_args.volfile_id); if (!need_retry) { - if (!errno) - errno = EINVAL; + if (!errno) + errno = EINVAL; glfs_init_done (fs, -1); - } + } } if (tmpfp) @@ -420,6 +428,10 @@ mgmt_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event, this = mydata; ctx = this->ctx; + + if (!ctx) + goto out; + fs = ((xlator_t *)ctx->master)->private; cmd_args = &ctx->cmd_args; @@ -434,22 +446,22 @@ mgmt_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event, "%d connect attempts left", cmd_args->max_connect_attempts); if (0 >= cmd_args->max_connect_attempts) { - errno = ENOTCONN; + errno = ENOTCONN; glfs_init_done (fs, -1); - } + } } break; case RPC_CLNT_CONNECT: rpc_clnt_set_connected (&((struct rpc_clnt*)ctx->mgmt)->conn); ret = glfs_volfile_fetch (fs); - if (ret && ctx && (ctx->active == NULL)) { + if (ret && (ctx->active == NULL)) { /* Do it only for the first time */ /* Exit the process.. there are some wrong options */ gf_log ("glfs-mgmt", GF_LOG_ERROR, "failed to fetch volume file (key:%s)", ctx->cmd_args.volfile_id); - errno = EINVAL; + errno = EINVAL; glfs_init_done (fs, -1); } @@ -457,7 +469,7 @@ mgmt_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event, default: break; } - +out: return 0; } diff --git a/api/src/glfs-resolve.c b/api/src/glfs-resolve.c index 0ad9ce723..7cd1e47bc 100644 --- a/api/src/glfs-resolve.c +++ b/api/src/glfs-resolve.c @@ -450,7 +450,9 @@ glfs_resolve_at (struct glfs *fs, xlator_t *subvol, inode_t *at, ret = 0; } - ret = glfs_loc_touchup (loc); + if (glfs_loc_touchup (loc) < 0) { + ret = -1; + } out: GF_FREE (path); diff --git a/api/src/glfs.c b/api/src/glfs.c index 174076e39..ea10fb55c 100644 --- a/api/src/glfs.c +++ b/api/src/glfs.c @@ -589,6 +589,13 @@ glfs_init_async (struct glfs *fs, glfs_init_cbk cbk) { int ret = -1; + if (!fs || !fs->ctx) { + gf_log ("glfs", GF_LOG_ERROR, + "fs is not properly initialized."); + errno = EINVAL; + return ret; + } + fs->init_cbk = cbk; ret = glfs_init_common (fs); @@ -602,6 +609,13 @@ glfs_init (struct glfs *fs) { int ret = -1; + if (!fs || !fs->ctx) { + gf_log ("glfs", GF_LOG_ERROR, + "fs is not properly initialized."); + errno = EINVAL; + return ret; + } + ret = glfs_init_common (fs); if (ret) return ret; diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index 98e384f2f..fc3b7229a 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -2296,7 +2296,7 @@ struct cli_cmd volume_cmds[] = { cli_cmd_volume_remove_brick_cbk, "remove brick from volume <VOLNAME>"}, - { "volume rebalance <VOLNAME> [fix-layout] {start|stop|status} [force]", + { "volume rebalance <VOLNAME> {{fix-layout start} | {start [force]|stop|status}}", cli_cmd_volume_defrag_cbk, "rebalance operations"}, diff --git a/configure.ac b/configure.ac index 604b53539..226648dcb 100644 --- a/configure.ac +++ b/configure.ac @@ -190,6 +190,18 @@ AC_PROG_CC AC_DISABLE_STATIC AC_PROG_LIBTOOL +# Initialize CFLAGS before usage +AC_ARG_ENABLE([debug], + AC_HELP_STRING([--enable-debug], + [Enable debug build options.])) +if test "x$enable_debug" = "xyes"; then + BUILD_DEBUG=yes + CFLAGS="${CFLAGS} -g -O0 -DDEBUG" +else + BUILD_DEBUG=no + CFLAGS="${CFLAGS} -g -O2" +fi + AC_ARG_WITH(pkgconfigdir, [ --with-pkgconfigdir=DIR pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@], [pkgconfigdir=$withval], @@ -571,10 +583,18 @@ if test "x$enable_xml_output" != "xno"; then if test "x${no_xml}" = "x"; then AC_DEFINE([HAVE_LIB_XML], [1], [Define to 1 if using libxml2.]) else - AC_MSG_WARN([libxml2 devel libraries not found disabling XML support]) - BUILD_XML_OUTPUT="no" + if test "x$enable_georeplication" != "xno"; then + AC_MSG_ERROR([libxml2 devel libraries not found]) + else + AC_MSG_WARN([libxml2 devel libraries not found disabling XML support]) + BUILD_XML_OUTPUT="no" + fi + fi else + if test "x$enable_georeplication" != "xno"; then + AC_MSG_ERROR([geo-replication requires xml output]) + fi BUILD_XML_OUTPUT="no" fi # end of xml-output @@ -702,14 +722,14 @@ fi case $host_os in linux*) GF_HOST_OS="GF_LINUX_HOST_OS" - GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -O0" + GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS}" GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}" GF_LDADD="${ARGP_STANDALONE_LDADD}" GF_FUSE_CFLAGS="-DFUSERMOUNT_DIR=\\\"\$(bindir)\\\"" ;; solaris*) GF_HOST_OS="GF_SOLARIS_HOST_OS" - GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -O0 -m64" + GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -m64" GF_LDFLAGS="" GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}" GF_LDADD="${ARGP_STANDALONE_LDADD}" @@ -733,7 +753,7 @@ case $host_os in ;; *bsd*) GF_HOST_OS="GF_BSD_HOST_OS" - GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -O0" + GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS}" GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_BASENAME" GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_DIRNAME" GF_GLUSTERFS_CFLAGS="${GF_CFLAGS}" @@ -746,10 +766,10 @@ case $host_os in darwin*) GF_HOST_OS="GF_DARWIN_HOST_OS" LIBTOOL=glibtool - GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D__DARWIN_64_BIT_INO_T -bundle -undefined suppress -flat_namespace -D_XOPEN_SOURCE -O0" + GF_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D__DARWIN_64_BIT_INO_T -bundle -undefined suppress -flat_namespace -D_XOPEN_SOURCE" GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_BASENAME" GF_CFLAGS="${GF_CFLAGS} -DTHREAD_UNSAFE_DIRNAME" - GF_GLUSTERFS_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D__DARWIN_64_BIT_INO_T -undefined suppress -flat_namespace -O0" + GF_GLUSTERFS_CFLAGS="${ARGP_STANDALONE_CPPFLAGS} -D__DARWIN_64_BIT_INO_T -undefined suppress -flat_namespace" GF_LDADD="${ARGP_STANDALONE_LDADD}" GF_FUSE_CFLAGS="-I\$(CONTRIBDIR)/macfuse" ;; @@ -814,6 +834,8 @@ AM_PATH_PYTHON() if echo $PYTHON_VERSION | grep ^2; then have_python2=yes fi + +# Save flags before testing python saved_CFLAGS=$CFLAGS saved_CPPFLAGS=$CPPFLAGS saved_LDFLAGS=$LDFLAGS @@ -828,9 +850,12 @@ case x$enable_glupy in xyes) if test "x$have_python2" = "xyes" -a "x$have_Python_h" = "xyes"; then BUILD_GLUPY=yes - saved_CFLAGS="$saved_CFLAGS $CFLAGS" - saved_CPPFLAGS="$saved_CPPFLAGS $CPPFLAGS" - saved_LDFLAGS="$saved_LDFLAGS $LDFLAGS" + PYTHONDEV_CFLAGS="$CFLAGS" + PYTHONDEV_CPPFLAGS="$CPPFLAGS" + PYTHONDEV_LDFLAGS="$LDFLAGS" + AC_SUBST(PYTHONDEV_CFLAGS) + AC_SUBST(PYTHONDEV_CPPFLAGS) + AC_SUBST(PYTHONDEV_LDFLAGS) else AC_MSG_ERROR([glupy requires python-devel/python-dev package and python2.x]) fi @@ -840,9 +865,12 @@ case x$enable_glupy in *) if test "x$have_python2" = "xyes" -a "x$have_Python_h" = "xyes"; then BUILD_GLUPY=yes - saved_CFLAGS="$saved_CFLAGS $CFLAGS" - saved_CPPFLAGS="$saved_CPPFLAGS $CPPFLAGS" - saved_LDFLAGS="$saved_LDFLAGS $LDFLAGS" + PYTHONDEV_CFLAGS="$CFLAGS" + PYTHONDEV_CPPFLAGS="$CPPFLAGS" + PYTHONDEV_LDFLAGS="$LDFLAGS" + AC_SUBST(PYTHONDEV_CFLAGS) + AC_SUBST(PYTHONDEV_CPPFLAGS) + AC_SUBST(PYTHONDEV_LDFLAGS) else AC_MSG_WARN([ --------------------------------------------------------------------------------- @@ -851,6 +879,7 @@ case x$enable_glupy in fi ;; esac +# Restore flags CFLAGS=$saved_CFLAGS CPPFLAGS=$saved_CPPFLAGS LDFLAGS=$saved_LDFLAGS @@ -870,15 +899,6 @@ if test "x$BUILD_GLUPY" = "xyes"; then fi # end glupy section -# Other stuff (most notably the glupy section) might have injected another -O2 -# into CFLAGS, so *do this last*. -BUILD_DEBUG=no -if test "x$enable_debug" = "xyes"; then - BUILD_DEBUG=yes - CFLAGS=`echo $CFLAGS | sed -e s/O2/O0/g` -else - BUILD_DEBUG=no -fi AC_SUBST(CFLAGS) # end enable debug section diff --git a/doc/admin-guide/en-US/markdown/admin_settingup_clients.md b/doc/admin-guide/en-US/markdown/admin_settingup_clients.md index bb45c8b89..c271eac67 100644 --- a/doc/admin-guide/en-US/markdown/admin_settingup_clients.md +++ b/doc/admin-guide/en-US/markdown/admin_settingup_clients.md @@ -70,7 +70,7 @@ To install Gluster Native Client on RPM distribution-based systems glusterfs-rdma packages contain OpenFabrics verbs RDMA module for Infiniband. - You can download the software at [][]. + You can download the software at [GlusterFS download page][1]. 4. Install Gluster Native Client on the client. @@ -92,7 +92,7 @@ To install Gluster Native Client on Debian-based distributions 2. Download the latest GlusterFS .deb file and checksum to each client. - You can download the software at [][1]. + You can download the software at [GlusterFS download page][1]. 3. For each .deb file, get the checksum (using the following command) and compare it against the checksum for that file in the md5sum @@ -100,7 +100,7 @@ To install Gluster Native Client on Debian-based distributions `$ md5sum GlusterFS_DEB_file.deb ` - The md5sum of the packages is available at: [][2] + The md5sum of the packages is available at: [GlusterFS download page][2] 4. Uninstall GlusterFS v3.1 (or an earlier version) from the client using the following command: diff --git a/extras/LinuxRPM/Makefile.am b/extras/LinuxRPM/Makefile.am index 593f850ac..b82c65f02 100644 --- a/extras/LinuxRPM/Makefile.am +++ b/extras/LinuxRPM/Makefile.am @@ -15,6 +15,7 @@ prep: if [ ! -e $(GFS_TAR) ]; then \ $(MAKE) -C ../.. dist; \ fi + -mkdir -p rpmbuild/BUILD -mkdir -p rpmbuild/SPECS -mkdir -p rpmbuild/RPMS -mkdir -p rpmbuild/SRPMS diff --git a/extras/geo-rep/gsync-sync-gfid.c b/extras/geo-rep/gsync-sync-gfid.c index 601f4720e..953eb5351 100644 --- a/extras/geo-rep/gsync-sync-gfid.c +++ b/extras/geo-rep/gsync-sync-gfid.c @@ -4,10 +4,11 @@ #include <string.h> #include <limits.h> #include <sys/types.h> -#include <attr/xattr.h> #include <libgen.h> #include <ctype.h> #include <stdlib.h> +#include "glusterfs.h" +#include "syscall.h" #ifndef UUID_CANONICAL_FORM_LEN #define UUID_CANONICAL_FORM_LEN 36 @@ -86,8 +87,8 @@ main (int argc, char *argv[]) memcpy (tmp_blob, bname, strlen (bname)); - ret = setxattr (parent_dir, GF_FUSE_AUX_GFID_HEAL, blob, len, - 0); + ret = sys_lsetxattr (parent_dir, GF_FUSE_AUX_GFID_HEAL, + blob, len, 0); if (ret < 0) { fprintf (stderr, "setxattr on %s/%s failed (%s)\n", parent_dir, bname, strerror (errno)); diff --git a/extras/hook-scripts/S30samba-set.sh b/extras/hook-scripts/S30samba-set.sh index 6b11f5a4f..2fc65c278 100755 --- a/extras/hook-scripts/S30samba-set.sh +++ b/extras/hook-scripts/S30samba-set.sh @@ -65,7 +65,7 @@ function add_samba_share () { STRING+="glusterfs:volume = $volname\n" STRING+="glusterfs:logfile = /var/log/samba/glusterfs-$volname.%%M.log\n" STRING+="glusterfs:loglevel = 7\n" - STRING+="path = /\n" + STRING+="path = %%P/\n" STRING+="read only = no\n" STRING+="guest ok = yes\n" printf "$STRING" >> /etc/samba/smb.conf diff --git a/glusterfs.spec.in b/glusterfs.spec.in index b34c8648d..c801198c3 100644 --- a/glusterfs.spec.in +++ b/glusterfs.spec.in @@ -328,7 +328,6 @@ This package provides the glusterfs server daemon. Summary: Clustered file-system api library Group: System Environment/Daemons Requires: %{name} = %{version}-%{release} -Requires: %{name}-devel = %{version}-%{release} # we provide the Python package/namespace 'gluster' Provides: python-gluster = %{version}-%{release} @@ -894,6 +893,9 @@ if [ $1 -ge 1 ]; then fi %changelog +* Wed Feb 26 2014 Niels de Vos <ndevos@redhat.com> +- Drop glusterfs-devel dependency from glusterfs-api (#1065750) + * Thu Feb 06 2014 Aravinda VK <avishwan@redhat.com> - Include geo-replication upgrade scripts and hook scripts. diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c index 69c049d67..d4201b38e 100644 --- a/glusterfsd/src/glusterfsd-mgmt.c +++ b/glusterfsd/src/glusterfsd-mgmt.c @@ -1380,7 +1380,8 @@ out: free (rsp.spec); - emancipate (ctx, ret); + if (ctx) + emancipate (ctx, ret); // Stop if server is running at an unsupported op-version if (ENOTSUP == ret) { diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index c47d2ca3f..fb8afc6a4 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -1443,7 +1443,7 @@ parse_cmdline (int argc, char *argv[], glusterfs_ctx_t *ctx) if (ENABLE_DEBUG_MODE == cmd_args->debug_mode) { cmd_args->log_level = GF_LOG_DEBUG; - cmd_args->log_file = "/dev/stderr"; + cmd_args->log_file = gf_strdup ("/dev/stderr"); cmd_args->no_daemon_mode = ENABLE_NO_DAEMON_MODE; } diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h index e3b019b9e..f877590f4 100644 --- a/libglusterfs/src/common-utils.h +++ b/libglusterfs/src/common-utils.h @@ -115,7 +115,8 @@ typedef int (*gf_cmp) (void *, void *); void gf_global_variable_init(void); -in_addr_t gf_resolve_ip (const char *hostname, void **dnscache); +int32_t gf_resolve_ip6 (const char *hostname, uint16_t port, int family, + void **dnscache, struct addrinfo **addr_info); void gf_log_dump_graph (FILE *specfp, glusterfs_graph_t *graph); void gf_print_trace (int32_t signal, glusterfs_ctx_t *ctx); diff --git a/libglusterfs/src/defaults.c b/libglusterfs/src/defaults.c index e6b1287f9..f5fb2aa9d 100644 --- a/libglusterfs/src/defaults.c +++ b/libglusterfs/src/defaults.c @@ -27,6 +27,352 @@ #include "xlator.h" +/* FAILURE_CBK function section */ + +int32_t +default_lookup_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (lookup, frame, -1, op_errno, NULL, NULL, + NULL, NULL); + return 0; +} + +int32_t +default_stat_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (stat, frame, -1, op_errno, NULL, NULL); + return 0; +} + + +int32_t +default_truncate_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (truncate, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + +int32_t +default_ftruncate_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (ftruncate, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + +int32_t +default_access_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (access, frame, -1, op_errno, NULL); + return 0; +} + +int32_t +default_readlink_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (readlink, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + + +int32_t +default_mknod_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (mknod, frame, -1, op_errno, NULL, NULL, NULL, + NULL, NULL); + return 0; +} + +int32_t +default_mkdir_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (mkdir, frame, -1, op_errno, NULL, NULL, NULL, + NULL, NULL); + return 0; +} + +int32_t +default_unlink_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (unlink, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + +int32_t +default_rmdir_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (rmdir, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + + +int32_t +default_symlink_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (symlink, frame, -1, op_errno, NULL, NULL, NULL, + NULL, NULL); + return 0; +} + + +int32_t +default_rename_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (rename, frame, -1, op_errno, NULL, NULL, NULL, + NULL, NULL, NULL); + return 0; +} + + +int32_t +default_link_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (link, frame, -1, op_errno, NULL, NULL, NULL, + NULL, NULL); + return 0; +} + + +int32_t +default_create_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (create, frame, -1, op_errno, NULL, NULL, NULL, + NULL, NULL, NULL); + return 0; +} + +int32_t +default_open_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (open, frame, -1, op_errno, NULL, NULL); + return 0; +} + +int32_t +default_readv_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (readv, frame, -1, op_errno, NULL, -1, NULL, + NULL, NULL); + return 0; +} + +int32_t +default_writev_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (writev, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + + +int32_t +default_flush_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (flush, frame, -1, op_errno, NULL); + return 0; +} + + + +int32_t +default_fsync_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (fsync, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + +int32_t +default_fstat_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (fstat, frame, -1, op_errno, NULL, NULL); + return 0; +} + +int32_t +default_opendir_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (opendir, frame, -1, op_errno, NULL, NULL); + return 0; +} + +int32_t +default_fsyncdir_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (fsyncdir, frame, -1, op_errno, NULL); + return 0; +} + +int32_t +default_statfs_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (statfs, frame, -1, op_errno, NULL, NULL); + return 0; +} + + +int32_t +default_setxattr_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (setxattr, frame, -1, op_errno, NULL); + return 0; +} + + +int32_t +default_fsetxattr_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (fsetxattr, frame, -1, op_errno, NULL); + return 0; +} + + + +int32_t +default_fgetxattr_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (fgetxattr, frame, -1, op_errno, NULL, NULL); + return 0; +} + + +int32_t +default_getxattr_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (getxattr, frame, -1, op_errno, NULL, NULL); + return 0; +} + +int32_t +default_xattrop_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (xattrop, frame, -1, op_errno, NULL, NULL); + return 0; +} + +int32_t +default_fxattrop_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (fxattrop, frame, -1, op_errno, NULL, NULL); + return 0; +} + + +int32_t +default_removexattr_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (removexattr, frame, -1, op_errno, NULL); + return 0; +} + + +int32_t +default_fremovexattr_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (fremovexattr, frame, -1, op_errno, NULL); + return 0; +} + +int32_t +default_lk_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (lk, frame, -1, op_errno, NULL, NULL); + return 0; +} + +int32_t +default_inodelk_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (inodelk, frame, -1, op_errno, NULL); + return 0; +} + + +int32_t +default_finodelk_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (finodelk, frame, -1, op_errno, NULL); + return 0; +} + +int32_t +default_entrylk_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (entrylk, frame, -1, op_errno, NULL); + return 0; +} + +int32_t +default_fentrylk_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (fentrylk, frame, -1, op_errno, NULL); + return 0; +} + + +int32_t +default_rchecksum_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (rchecksum, frame, -1, op_errno, -1, NULL, NULL); + return 0; +} + + +int32_t +default_readdir_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (readdir, frame, -1, op_errno, NULL, NULL); + return 0; +} + + +int32_t +default_readdirp_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (readdirp, frame, -1, op_errno, NULL, NULL); + return 0; +} + +int32_t +default_setattr_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (setattr, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + +int32_t +default_fsetattr_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (fsetattr, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + +int32_t +default_fallocate_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT(fallocate, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + +int32_t +default_discard_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT(discard, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + +int32_t +default_zerofill_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT(zerofill, frame, -1, op_errno, NULL, NULL, NULL); + return 0; +} + + +int32_t +default_getspec_failure_cbk (call_frame_t *frame, int32_t op_errno) +{ + STACK_UNWIND_STRICT (getspec, frame, -1, op_errno, NULL); + return 0; +} + /* _CBK function section */ int32_t diff --git a/libglusterfs/src/defaults.h b/libglusterfs/src/defaults.h index 0fb5572ac..f0b786ddf 100644 --- a/libglusterfs/src/defaults.h +++ b/libglusterfs/src/defaults.h @@ -718,6 +718,143 @@ default_getspec_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, char *spec_data); int32_t +default_lookup_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_stat_failure_cbk (call_frame_t *frame, int32_t op_errno); + + +int32_t +default_truncate_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_ftruncate_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_access_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_readlink_failure_cbk (call_frame_t *frame, int32_t op_errno); + + +int32_t +default_mknod_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_mkdir_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_unlink_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_rmdir_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_symlink_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_rename_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_link_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_create_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_open_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_readv_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_writev_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_flush_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fsync_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fstat_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_opendir_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fsyncdir_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_statfs_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_setxattr_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fsetxattr_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fgetxattr_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_getxattr_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_xattrop_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fxattrop_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_removexattr_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fremovexattr_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_lk_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_inodelk_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_finodelk_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_entrylk_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fentrylk_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_rchecksum_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_readdir_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_readdirp_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_setattr_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fsetattr_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_fallocate_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_discard_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_zerofill_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t +default_getspec_failure_cbk (call_frame_t *frame, int32_t op_errno); + +int32_t default_mem_acct_init (xlator_t *this); #endif /* _DEFAULTS_H */ diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c index 15e0ccf78..d4eade8ba 100644 --- a/libglusterfs/src/inode.c +++ b/libglusterfs/src/inode.c @@ -1599,7 +1599,7 @@ __inode_ctx_get0 (inode_t *inode, xlator_t *xlator, uint64_t *value1) int ret = 0; ret = __inode_ctx_get2 (inode, xlator, &tmp_value, NULL); - if (!ret) + if (!ret && value1) *value1 = tmp_value; return ret; @@ -1612,7 +1612,7 @@ __inode_ctx_get1 (inode_t *inode, xlator_t *xlator, uint64_t *value2) int ret = 0; ret = __inode_ctx_get2 (inode, xlator, NULL, &tmp_value); - if (!ret) + if (!ret && value2) *value2 = tmp_value; return ret; diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c index 0058233a7..2bd40b2c2 100644 --- a/libglusterfs/src/logging.c +++ b/libglusterfs/src/logging.c @@ -138,6 +138,7 @@ gf_log_fini (void *data) call to gf_log after calling gf_log_fini, will log the message to stderr. */ + ctx->log.loglevel = GF_LOG_NONE; ctx->log.logfile = NULL; } } @@ -556,7 +557,7 @@ _gf_log_nomem (const char *domain, const char *file, { if (ctx->log.logfile) { fprintf (ctx->log.logfile, "%s\n", msg); - } else { + } else if (ctx->log.loglevel >= level) { fprintf (stderr, "%s\n", msg); } @@ -711,7 +712,7 @@ _gf_log_callingfn (const char *domain, const char *file, const char *function, { if (ctx->log.logfile) { fprintf (ctx->log.logfile, "%s\n", msg); - } else { + } else if (ctx->log.loglevel >= level) { fprintf (stderr, "%s\n", msg); } @@ -880,7 +881,7 @@ log: if (ctx->log.logfile) { fprintf (ctx->log.logfile, "%s\n", msg); fflush (ctx->log.logfile); - } else { + } else if (ctx->log.loglevel >= level) { fprintf (stderr, "%s\n", msg); fflush (stderr); } diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c index 219fbc842..552a26355 100644 --- a/libglusterfs/src/syncop.c +++ b/libglusterfs/src/syncop.c @@ -169,6 +169,46 @@ out: return ret; } +int +syncopctx_setfspid (void *pid) +{ + struct syncopctx *opctx = NULL; + int ret = 0; + + /* In args check */ + if (!pid) { + ret = -1; + errno = EINVAL; + goto out; + } + + opctx = syncopctx_getctx (); + + /* alloc for this thread the first time */ + if (!opctx) { + opctx = GF_CALLOC (1, sizeof (*opctx), gf_common_mt_syncopctx); + if (!opctx) { + ret = -1; + goto out; + } + + ret = syncopctx_setctx (opctx); + if (ret != 0) { + GF_FREE (opctx); + opctx = NULL; + goto out; + } + } + +out: + if (opctx && pid) { + opctx->pid = *(pid_t *)pid; + opctx->valid |= SYNCOPCTX_PID; + } + + return ret; +} + static void __run (struct synctask *task) { @@ -1224,7 +1264,7 @@ syncop_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } int -syncop_removexattr (xlator_t *subvol, loc_t *loc, const char *name) +syncop_removexattr (xlator_t *subvol, loc_t *loc, const char *name, dict_t *xdata) { return(syncop_removexattr_with_xdata(subvol, loc, name, NULL)); } @@ -1259,12 +1299,12 @@ syncop_fremovexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } int -syncop_fremovexattr (xlator_t *subvol, fd_t *fd, const char *name) +syncop_fremovexattr (xlator_t *subvol, fd_t *fd, const char *name, dict_t *xdata) { struct syncargs args = {0, }; SYNCOP (subvol, (&args), syncop_fremovexattr_cbk, - subvol->fops->fremovexattr, fd, name, NULL); + subvol->fops->fremovexattr, fd, name, xdata); if (args.op_ret < 0) return -args.op_errno; diff --git a/libglusterfs/src/syncop.h b/libglusterfs/src/syncop.h index 87985588f..fb867a108 100644 --- a/libglusterfs/src/syncop.h +++ b/libglusterfs/src/syncop.h @@ -31,6 +31,7 @@ #define SYNCOPCTX_UID 0x00000001 #define SYNCOPCTX_GID 0x00000002 #define SYNCOPCTX_GROUPS 0x00000004 +#define SYNCOPCTX_PID 0x00000008 struct synctask; struct syncproc; @@ -164,6 +165,7 @@ struct syncopctx { int grpsize; int ngrps; gid_t *groups; + pid_t pid; }; #define __yawn(args) do { \ @@ -260,6 +262,7 @@ int synctask_setid (struct synctask *task, uid_t uid, gid_t gid); int syncopctx_setfsuid (void *uid); int syncopctx_setfsgid (void *gid); int syncopctx_setfsgroups (int count, const void *groups); +int syncopctx_setfspid (void *pid); static inline call_frame_t * syncop_create_frame (xlator_t *this) @@ -272,9 +275,13 @@ syncop_create_frame (xlator_t *this) if (!frame) return NULL; - frame->root->pid = getpid (); - opctx = syncopctx_getctx (); + + if (opctx && (opctx->valid & SYNCOPCTX_PID)) + frame->root->pid = opctx->pid; + else + frame->root->pid = getpid (); + if (opctx && (opctx->valid & SYNCOPCTX_UID)) frame->root->uid = opctx->uid; else @@ -372,9 +379,11 @@ int syncop_listxattr (xlator_t *subvol, loc_t *loc, dict_t **dict); int syncop_getxattr (xlator_t *xl, loc_t *loc, dict_t **dict, const char *key); int syncop_fgetxattr (xlator_t *xl, fd_t *fd, dict_t **dict, const char *key); int syncop_fgetxattr_with_xdata (xlator_t *xl, fd_t *fd, dict_t **dict, const char *key, dict_t *extra); -int syncop_removexattr (xlator_t *subvol, loc_t *loc, const char *name); +int syncop_removexattr (xlator_t *subvol, loc_t *loc, const char *name, + dict_t *xdata); int syncop_removexattr_with_xdata (xlator_t *subvol, loc_t *loc, const char *name, dict_t *dict); -int syncop_fremovexattr (xlator_t *subvol, fd_t *fd, const char *name); +int syncop_fremovexattr (xlator_t *subvol, fd_t *fd, const char *name, + dict_t *xdata); int syncop_fremovexattr_with_xdata (xlator_t *subvol, fd_t *fd, const char *name, dict_t *dict); int syncop_create (xlator_t *subvol, loc_t *loc, int32_t flags, mode_t mode, diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c index 96242dff7..8be64c18a 100644 --- a/rpc/rpc-lib/src/rpcsvc.c +++ b/rpc/rpc-lib/src/rpcsvc.c @@ -1197,14 +1197,14 @@ rpcsvc_submit_generic (rpcsvc_request_t *req, struct iovec *proghdr, "rpc-transport (%s)", req->xid, req->prog ? req->prog->progname : "(not matched)", req->prog ? req->prog->progver : 0, - req->procnum, trans->name); + req->procnum, trans ? trans->name : ""); } else { gf_log (GF_RPCSVC, GF_LOG_TRACE, "submitted reply for rpc-message (XID: 0x%x, " "Program: %s, ProgVers: %d, Proc: %d) to rpc-transport " "(%s)", req->xid, req->prog ? req->prog->progname: "-", req->prog ? req->prog->progver : 0, - req->procnum, trans->name); + req->procnum, trans ? trans->name : ""); } disconnect_exit: diff --git a/rpc/rpc-transport/socket/src/name.c b/rpc/rpc-transport/socket/src/name.c index c6eae9739..f731bab4b 100644 --- a/rpc/rpc-transport/socket/src/name.c +++ b/rpc/rpc-transport/socket/src/name.c @@ -23,13 +23,6 @@ #include "socket.h" #include "common-utils.h" -int32_t -gf_resolve_ip6 (const char *hostname, - uint16_t port, - int family, - void **dnscache, - struct addrinfo **addr_info); - static int32_t af_inet_bind_to_port_lt_ceiling (int fd, struct sockaddr *sockaddr, socklen_t sockaddr_len, int ceiling) diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c index 490fe8a7e..c5e8b889f 100644 --- a/rpc/rpc-transport/socket/src/socket.c +++ b/rpc/rpc-transport/socket/src/socket.c @@ -1098,7 +1098,8 @@ socket_event_poll_out (rpc_transport_t *this) } pthread_mutex_unlock (&priv->lock); - ret = rpc_transport_notify (this, RPC_TRANSPORT_MSG_SENT, NULL); + if (ret == 0) + ret = rpc_transport_notify (this, RPC_TRANSPORT_MSG_SENT, NULL); out: return ret; @@ -2491,8 +2492,10 @@ socket_server_event_handler (int fd, int idx, void *data, new_trans = GF_CALLOC (1, sizeof (*new_trans), gf_common_mt_rpc_trans_t); - if (!new_trans) + if (!new_trans) { + close (new_sock); goto unlock; + } ret = pthread_mutex_init(&new_trans->lock, NULL); if (ret == -1) { @@ -2500,6 +2503,7 @@ socket_server_event_handler (int fd, int idx, void *data, "pthread_mutex_init() failed: %s", strerror (errno)); close (new_sock); + GF_FREE (new_trans); goto unlock; } @@ -2520,6 +2524,8 @@ socket_server_event_handler (int fd, int idx, void *data, "getsockname on %d failed (%s)", new_sock, strerror (errno)); close (new_sock); + GF_FREE (new_trans->name); + GF_FREE (new_trans); goto unlock; } @@ -2527,6 +2533,8 @@ socket_server_event_handler (int fd, int idx, void *data, ret = socket_init(new_trans); if (ret != 0) { close(new_sock); + GF_FREE (new_trans->name); + GF_FREE (new_trans); goto unlock; } new_trans->ops = this->ops; @@ -2549,6 +2557,8 @@ socket_server_event_handler (int fd, int idx, void *data, gf_log(this->name,GF_LOG_ERROR, "server setup failed"); close(new_sock); + GF_FREE (new_trans->name); + GF_FREE (new_trans); goto unlock; } } @@ -2562,6 +2572,8 @@ socket_server_event_handler (int fd, int idx, void *data, new_sock, strerror (errno)); close (new_sock); + GF_FREE (new_trans->name); + GF_FREE (new_trans); goto unlock; } } @@ -2600,6 +2612,8 @@ socket_server_event_handler (int fd, int idx, void *data, if (ret == -1) { gf_log (this->name, GF_LOG_WARNING, "failed to register the socket with event"); + close (new_sock); + rpc_transport_unref (new_trans); goto unlock; } @@ -3557,7 +3571,8 @@ socket_init (rpc_transport_t *this) } priv->ssl_ca_list = gf_strdup(priv->ssl_ca_list); - gf_log(this->name,GF_LOG_INFO,"SSL support is %s", + gf_log(this->name, priv->ssl_enabled ? GF_LOG_INFO: GF_LOG_DEBUG, + "SSL support is %s", priv->ssl_enabled ? "ENABLED" : "NOT enabled"); /* * This might get overridden temporarily in socket_connect (q.v.) @@ -3572,7 +3587,8 @@ socket_init (rpc_transport_t *this) "invalid value given for own-thread boolean"); } } - gf_log(this->name,GF_LOG_INFO,"using %s polling thread", + gf_log(this->name, priv->own_thread ? GF_LOG_INFO: GF_LOG_DEBUG, + "using %s polling thread", priv->own_thread ? "private" : "system"); if (priv->use_ssl) { diff --git a/tests/basic/cdc.t b/tests/basic/cdc.t index 69f39f7d1..70d2171a8 100755 --- a/tests/basic/cdc.t +++ b/tests/basic/cdc.t @@ -21,18 +21,16 @@ EXPECT 'off' volinfo_field $V0 'performance.io-cache' TEST $CLI volume set $V0 performance.quick-read off EXPECT 'off' volinfo_field $V0 'performance.quick-read' -TEST $CLI volume set $V0 strict-write-ordering on +TEST $CLI volume set $V0 performance.strict-write-ordering on EXPECT 'on' volinfo_field $V0 'performance.strict-write-ordering' ## Turn on cdc xlator by setting network.compression to on TEST $CLI volume set $V0 network.compression on EXPECT 'on' volinfo_field $V0 'network.compression' -EXPECT 'server' volinfo_field $V0 'network.compression.mode' ## Make sure that user cannot change network.compression.mode ## This would break the cdc xlator if allowed! -TEST $CLI volume set $V0 network.compression.mode client -EXPECT 'server' volinfo_field $V0 'network.compression.mode' +TEST ! $CLI volume set $V0 network.compression.mode client ## Turn on network.compression.debug option ## This will dump compressed data onto disk as gzip file @@ -44,6 +42,7 @@ EXPECT 'on' volinfo_field $V0 'network.compression.debug' TEST $CLI volume start $V0; EXPECT 'Started' volinfo_field $V0 'Status'; +sleep 2 ## Mount FUSE with caching disabled TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 $M0; @@ -121,7 +120,6 @@ TEST umount $M0 ## Reset the network.compression options TEST $CLI volume reset $V0 network.compression.debug TEST $CLI volume reset $V0 network.compression.min-size -TEST $CLI volume reset $V0 network.compression.mode TEST $CLI volume reset $V0 network.compression ## Stop the volume diff --git a/tests/basic/pgfid-feat.t b/tests/basic/pgfid-feat.t new file mode 100644 index 000000000..8784cc7bf --- /dev/null +++ b/tests/basic/pgfid-feat.t @@ -0,0 +1,36 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc + +cleanup; + +function get_ancestry_path() { + local path=$1 + local ancestry=$(getfattr --absolute-names -e text -n glusterfs.ancestry.path "$M0/$path" | grep "^glusterfs.ancestry.path" | cut -d"=" -f2 | tr -d \"); + echo $ancestry; +} + +TEST glusterd +TEST pidof glusterd +TEST $CLI volume info; + +TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{1,2,3,4}; +TEST $CLI volume start $V0; +TEST glusterfs -s $H0 --volfile-id $V0 $M0; + +TEST $CLI volume set $V0 build-pgfid on; + +TEST mkdir $M0/a; +TEST touch $M0/a/b; + +getfattr -e text -n glusterfs.ancestry.path "$M0/a/b" | grep "^glusterfs.ancestry.path" | cut -d"=" -f2 | tr -d \"; +EXPECT "/a/b" get_ancestry_path "/a/b"; + +TEST $CLI volume set $V0 build-pgfid off; +TEST ! getfattr -e text -n "glusterfs.ancestry.path" $M0/a/b; + +TEST $CLI volume stop $V0; +TEST $CLI volume delete $V0; + +cleanup; diff --git a/tests/bugs/bug-1058663.c b/tests/bugs/bug-1058663.c new file mode 100644 index 000000000..631afecce --- /dev/null +++ b/tests/bugs/bug-1058663.c @@ -0,0 +1,111 @@ +#include <stdlib.h> +#include <stdio.h> +#include <stdint.h> +#include <fcntl.h> +#include <sys/stat.h> +#include <sys/mman.h> +#include <signal.h> + +#define FILE_SIZE 1048576 + +/* number of tests to run */ +#define RUN_LOOP 1000 + +/* number of SIGBUS before exiting */ +#define MAX_SIGBUS 1 +static int expect_sigbus = 0; +static int sigbus_received = 0; + +/* test for truncate()/seek()/write()/mmap() + * There should ne no SIGBUS triggered. + */ +void seek_write(char *filename) +{ + int fd; + uint8_t* map; + int i; + + fd = open(filename, O_RDWR|O_CREAT|O_TRUNC, 0600); + lseek(fd, FILE_SIZE - 1, SEEK_SET); + write(fd, "\xff", 1); + + map = mmap(NULL, FILE_SIZE, PROT_READ, MAP_PRIVATE, fd, 0); + for (i = 0; i < (FILE_SIZE - 1); i++) { + if (map[i] != 0) /* should never be true */ + abort(); + } + munmap(map, FILE_SIZE); + + close(fd); +} + +int read_after_eof(char *filename) +{ + int ret = 0; + int fd; + char* data; + uint8_t* map; + + fd = open(filename, O_RDWR|O_CREAT|O_TRUNC, 0600); + lseek(fd, FILE_SIZE - 1, SEEK_SET); + write(fd, "\xff", 1); + + /* trigger verify that reading after EOF fails */ + ret = read(fd, data, FILE_SIZE / 2); + if (ret != 0) + return 1; + + /* map an area of 1 byte after FILE_SIZE */ + map = mmap(NULL, 1, PROT_READ, MAP_PRIVATE, fd, FILE_SIZE); + /* map[0] is an access after EOF, it should trigger SIGBUS */ + if (map[0] != 0) + /* it is expected that we exit before we get here */ + if (!sigbus_received) + return 1; + munmap(map, FILE_SIZE); + + close(fd); + + return ret; +} + +/* signal handler for SIGBUS */ +void catch_sigbus(int signum) +{ + switch (signum) { + case SIGBUS: + sigbus_received++; + if (!expect_sigbus) + exit(EXIT_FAILURE); + if (sigbus_received >= MAX_SIGBUS) + exit(EXIT_SUCCESS); + break; + default: + printf("Unexpected signal received: %d\n", signum); + } +} + +int main(int argc, char** argv) +{ + int i = 0; + + if (argc == 1) { + printf("Usage: %s <filename>\n", argv[0]); + return EXIT_FAILURE; + } + + signal(SIGBUS, catch_sigbus); + + /* the next test should not trigger SIGBUS */ + expect_sigbus = 0; + for (i = 0; i < RUN_LOOP; i++) { + seek_write(argv[1]); + } + + /* the next test should trigger SIGBUS */ + expect_sigbus = 1; + if (read_after_eof(argv[1])) + return EXIT_FAILURE; + + return EXIT_SUCCESS; +} diff --git a/tests/bugs/bug-1058663.t b/tests/bugs/bug-1058663.t new file mode 100644 index 000000000..5ca348e77 --- /dev/null +++ b/tests/bugs/bug-1058663.t @@ -0,0 +1,29 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc + +cleanup; + +## Start and create a volume +TEST glusterd; +TEST pidof glusterd; +TEST $CLI volume info; + +TEST $CLI volume create $V0 $H0:$B0/$V0; +TEST $CLI volume start $V0; + +TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 $M0 + +# compile the test program and run it +gcc $(dirname $0)/bug-1058663.c -o $(dirname $0)/bug-1058663; +TEST $(dirname $0)/bug-1058663 $M0/bug-1058663.bin; +rm -f $(dirname $0)/M0/bug-1058663.bin; + +TEST umount $M0; + +TEST $CLI volume stop $V0; +TEST $CLI volume delete $V0; + +cleanup; + diff --git a/tests/bugs/bug-1058797.t b/tests/bugs/bug-1058797.t new file mode 100644 index 000000000..2b80794cf --- /dev/null +++ b/tests/bugs/bug-1058797.t @@ -0,0 +1,45 @@ +#!/bin/bash +#Test that the setuid bit is healed correctly. + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc + +cleanup; +#Basic checks +TEST glusterd + +#Create a 1x2 replica volume +TEST $CLI volume create $V0 replica 2 $H0:$B0/brick{0,1}; +TEST $CLI volume start $V0 +TEST $CLI volume set $V0 cluster.self-heal-daemon off + +# FUSE mount;create a file +TEST glusterfs -s $H0 --volfile-id $V0 $M0 +TEST touch $M0/file + +#Kill brick1 and set S_ISUID and S_ISGID bits from mount point +kill_brick $V0 $H0 $B0/brick1 +TEST chmod +x,+s $M0/file + +#Get file permissions from backend brick0 and verify that S_ISUID is indeed set +file_permissions1=`ls -l $B0/brick0/file | awk '{print $1}'| cut -d. -f1 | cut -d- -f2,3,4,5,6` +setuid_bit1=`echo $file_permissions1 | cut -b3` +EXPECT "s" echo $setuid_bit1 + +#Restart volume and do lookup from mount to trigger heal +TEST $CLI volume start $V0 force +EXPECT_WITHIN 20 "1" afr_child_up_status $V0 1 +TEST ls -l $M0/file + +#Get file permissions from healed brick1 and verify that S_ISUID is indeed set +file_permissions2=`ls -l $B0/brick1/file | awk '{print $1}' | cut -d. -f1 | cut -d- -f2,3,4,5,6` +setuid_bit2=`echo $file_permissions2 | cut -b3` +EXPECT "s" echo $setuid_bit2 + +#Also compare the entire permission string,just to be sure +EXPECT $file_permissions1 echo $file_permissions2 +TEST umount $M0 +TEST $CLI volume stop $V0 +TEST $CLI volume delete $V0; + +cleanup; diff --git a/tests/encryption/crypt.t b/tests/encryption/crypt.t new file mode 100755 index 000000000..aa46bd429 --- /dev/null +++ b/tests/encryption/crypt.t @@ -0,0 +1,87 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc +. $(dirname $0)/../volume.rc + +cleanup; + +TEST glusterd +TEST pidof glusterd + +## Create a volume with one brick +TEST $CLI volume create $V0 $H0:$B0/${V0}1; +EXPECT "$V0" volinfo_field $V0 'Volume Name'; +EXPECT 'Created' volinfo_field $V0 'Status'; +EXPECT '1' brick_count $V0 + +## Turn off performance translators + +TEST $CLI volume set $V0 performance.quick-read off +EXPECT 'off' volinfo_field $V0 'performance.quick-read' +TEST $CLI volume set $V0 performance.write-behind off +EXPECT 'off' volinfo_field $V0 'performance.write-behind' +TEST $CLI volume set $V0 performance.open-behind off +EXPECT 'off' volinfo_field $V0 'performance.open-behind' + +## Turn on crypt xlator by setting features.encryption to on +TEST $CLI volume set $V0 encryption on +EXPECT 'on' volinfo_field $V0 'features.encryption' + +## Specify location of master key +TEST $CLI volume set $V0 encryption.master-key /tmp/$V0-master-key + +## Create a file with master key + +echo "0000111122223333444455556666777788889999aaaabbbbccccddddeeeeffff" > /tmp/$V0-master-key + +## Start the volume +TEST $CLI volume start $V0; +EXPECT 'Started' volinfo_field $V0 'Status'; + +## Mount the volume +TEST glusterfs --volfile-server=$H0 --volfile-id=$V0 $M0; + +## Testing writev, readv, ftruncate: +## Create fragmented files and compare them with the reference files + +build_tester $(dirname $0)/frag.c +TEST $(dirname $0)/frag $M0/testfile /tmp/$V0-goodfile 262144 500 + +## Testing link, unlink, symlink, rename + +TEST ln $M0/testfile $M0/testfile-link +TEST mv $M0/testfile $M0/testfile-renamed +TEST ln -s $M0/testfile-link $M0/testfile-symlink +TEST rm -f $M0/testfile-renamed + +## Remount the volume +TEST umount $M0 +TEST glusterfs --volfile-server=$H0 --volfile-id=$V0 $M0; + +TEST diff -u $M0/testfile-symlink /tmp/$V0-goodfile +EXPECT '' + +TEST rm -f $M0/testfile-symlink +TEST rm -f $M0/testfile-link + +## Cleanup files + +TEST rm -f /tmp/$V0-master-key +TEST rm -f /tmp/$V0-goodfile + +TEST umount $M0 + +## Reset crypt options +TEST $CLI volume reset $V0 encryption.block-size +TEST $CLI volume reset $V0 encryption.data-key-size + +## Stop the volume +TEST $CLI volume stop $V0; +EXPECT 'Stopped' volinfo_field $V0 'Status'; + +## Delete the volume +TEST $CLI volume delete $V0; +TEST ! $CLI volume info $V0; + +TEST rm -rf $(dirname $0)/frag +cleanup; diff --git a/tests/encryption/frag.c b/tests/encryption/frag.c new file mode 100644 index 000000000..86da037c6 --- /dev/null +++ b/tests/encryption/frag.c @@ -0,0 +1,328 @@ +/* + Copyright (c) 2008-2013 Red Hat, Inc. <http://www.redhat.com> + This file is part of GlusterFS. + + This file is licensed to you under your choice of the GNU Lesser + General Public License, version 3 or any later version (LGPLv3 or + later), or the GNU General Public License, version 2 (GPLv2), in all + cases as published by the Free Software Foundation. +*/ + +#include <stdlib.h> +#include <stdio.h> +#include <sys/types.h> +#include <string.h> +#include <sys/stat.h> +#include <sys/syscall.h> +#include <unistd.h> +#include <fcntl.h> + +#define MAX_NUM_OPS (1 << 20) +#define MAX_FILE_SIZE (1 << 30) + +typedef enum { + READ_OP, + WRITE_OP, + TRUNC_OP, + LAST_OP +} frag_op; + +struct frag_ctx { + int test_fd; + int good_fd; + char *test_buf; + char *good_buf; + char *content; + int max_file_size; +}; + +typedef int (*frag_op_t)(struct frag_ctx *ctx, off_t offset, size_t count); + +static int doread(int fd, off_t offset, size_t count, + char *buf, int max_file_size) +{ + int ret = 0; + int was_read = 0; + + if (lseek(fd, offset, SEEK_SET) == -1) { + perror("lseek failed"); + return -1; + } + while (count) { + ret = read(fd, buf + offset + was_read, count); + if (ret < 0) + return -1; + if (ret == 0) + break; + if (ret > count) { + fprintf(stderr, "READ: read more than asked\n"); + return -1; + } + count -= ret; + was_read += ret; + } + return ret; +} + +static int dowrite(int fd, off_t offset, size_t count, char *buf) +{ + int ret; + + ret = lseek(fd, offset, SEEK_SET); + if (ret == -1) + return ret; + return write(fd, buf, count); +} + +static int dotrunc(int fd, off_t offset) +{ + int ret; + + ret = ftruncate(fd, offset); + if (ret == -1) + perror("truncate failed"); + return ret; +} + +static int prepare_file(char *filename, int *fd, char **buf, int max_file_size) +{ + int ret; + + *buf = malloc(max_file_size); + if (*buf == NULL) { + perror("malloc failed"); + return -1; + } + *fd = open(filename, O_CREAT | O_RDWR, S_IRWXU); + if (*fd == -1) { + perror("open failed"); + free(*buf); + *buf = NULL; + return -1; + } + return 0; +} + +/* + * @offset, @count: random values from [0, max_file_size - 1] + */ +static int frag_write(struct frag_ctx *ctx, off_t offset, size_t count) +{ + int ret; + struct stat test_stbuf; + struct stat good_stbuf; + + if (offset + count > ctx->max_file_size) + offset = offset / 2; + if (offset + count > ctx->max_file_size) + count = count / 2; + + if (fstat(ctx->test_fd, &test_stbuf)) { + fprintf(stderr, "WRITE: fstat of test file failed\n"); + return -1; + } + if (offset > test_stbuf.st_size) + printf("writing hole\n"); + + ret = dowrite(ctx->test_fd, offset, count, ctx->content); + if (ret < 0 || ret != count){ + fprintf(stderr, "WRITE: failed to write test file\n"); + return -1; + } + ret = dowrite(ctx->good_fd, offset, count, ctx->content); + if (ret < 0 || ret != count) { + fprintf(stderr, "WRITE: failed to write test file\n"); + return -1; + } + if (fstat(ctx->test_fd, &test_stbuf)) { + fprintf(stderr, "WRITE: fstat of test file failed\n"); + return -1; + } + if (fstat(ctx->good_fd, &good_stbuf)) { + fprintf(stderr, "WRITE: fstat of good file failed\n"); + return -1; + } + if (test_stbuf.st_size != good_stbuf.st_size) { + fprintf(stderr, + "READ: Bad file size %d (expected %d)\n", + (int)test_stbuf.st_size, + (int)good_stbuf.st_size); + return -1; + } + return 0; +} + +/* + * @offset, @count: random values from [0, max_file_size - 1] + */ +static int frag_read(struct frag_ctx *ctx, off_t offset, size_t count) +{ + ssize_t test_ret; + ssize_t good_ret; + + test_ret = doread(ctx->test_fd, + offset, count, ctx->test_buf, ctx->max_file_size); + if (test_ret < 0) { + fprintf(stderr, "READ: failed to read test file\n"); + return -1; + } + good_ret = doread(ctx->good_fd, + offset, count, ctx->good_buf, ctx->max_file_size); + if (good_ret < 0) { + fprintf(stderr, "READ: failed to read good file\n"); + return -1; + } + if (test_ret != good_ret) { + fprintf(stderr, + "READ: Bad return value %d (expected %d\n)", + test_ret, good_ret); + return -1; + } + if (memcmp(ctx->test_buf + offset, ctx->good_buf + offset, good_ret)) { + fprintf(stderr, "READ: bad data\n"); + return -1; + } + return 0; +} + +/* + * @offset: random value from [0, max_file_size - 1] + */ +static int frag_truncate(struct frag_ctx *ctx, + off_t offset, __attribute__((unused))size_t count) +{ + int ret; + struct stat test_stbuf; + struct stat good_stbuf; + + if (fstat(ctx->test_fd, &test_stbuf)) { + fprintf(stderr, "TRUNCATE: fstat of test file failed\n"); + return -1; + } + if (offset > test_stbuf.st_size) + printf("expanding truncate to %d\n", offset); + else if (offset < test_stbuf.st_size) + printf("shrinking truncate to %d\n", offset); + else + printf("trivial truncate\n"); + + ret = dotrunc(ctx->test_fd, offset); + if (ret == -1) { + fprintf(stderr, "TRUNCATE: failed for test file\n"); + return -1; + } + ret = dotrunc(ctx->good_fd, offset); + if (ret == -1) { + fprintf(stderr, "TRUNCATE: failed for good file\n"); + return -1; + } + if (fstat(ctx->test_fd, &test_stbuf)) { + fprintf(stderr, "TRUNCATE: fstat of test file failed\n"); + return -1; + } + if (fstat(ctx->good_fd, &good_stbuf)) { + fprintf(stderr, "TRUNCATE: fstat of good file failed\n"); + return -1; + } + if (test_stbuf.st_size != good_stbuf.st_size) { + fprintf(stderr, + "TRUNCATE: bad test file size %d (expected %d)\n", + test_stbuf.st_size, + good_stbuf.st_size); + return -1; + } + return 0; +} + +frag_op_t frag_ops[LAST_OP] = { + [READ_OP] = frag_read, + [WRITE_OP] = frag_write, + [TRUNC_OP] = frag_truncate +}; + +static void put_ctx(struct frag_ctx *ctx) +{ + if (ctx->test_buf) + free(ctx->test_buf); + if (ctx->good_buf) + free(ctx->good_buf); + if (ctx->content) + free(ctx->content); +} + +main (int argc, char *argv[]) +{ + int i; + int ret = 0; + struct frag_ctx ctx; + char *test_filename = NULL; + char *good_filename = NULL; + int num_ops; + int max_file_size; + + memset(&ctx, 0, sizeof(ctx)); + if (argc != 5) { + fprintf(stderr, + "usage: %s <test-file-name> <good-file-name> <max-file-size> <number-of-operations>\n", + argv[0]); + ret = -1; + goto exit; + } + test_filename = argv[1]; + good_filename = argv[2]; + max_file_size = atoi(argv[3]); + if (max_file_size > MAX_FILE_SIZE) + max_file_size = MAX_FILE_SIZE; + num_ops = atoi(argv[4]); + if (num_ops > MAX_NUM_OPS) + num_ops = MAX_NUM_OPS; + + ret = prepare_file(test_filename, + &ctx.test_fd, &ctx.test_buf, max_file_size); + if (ret) + goto exit; + ret = prepare_file(good_filename, + &ctx.good_fd, &ctx.good_buf, max_file_size); + if (ret) { + if (close(ctx.test_fd) == -1) + perror("close test_buf failed"); + goto exit; + } + ctx.content = malloc(max_file_size); + if (!ctx.content) { + perror("malloc failed"); + goto close; + } + ctx.max_file_size = max_file_size; + for (i = 0; i < max_file_size; i++) + ctx.content[i] = random() % 256; + + for (i = 0; i < num_ops; i++) { + ret = frag_ops[random() % LAST_OP](&ctx, + random() % max_file_size, /* offset */ + random() % max_file_size /* count */); + if (ret) + break; + } + close: + if (close(ctx.test_fd) == -1) + perror("close test_fd failed"); + if (close(ctx.good_fd) == -1) + perror("close good_fd failed"); + exit: + put_ctx(&ctx); + if (ret) + exit(1); + exit(0); +} + +/* + Local variables: + c-indentation-style: "K&R" + mode-name: "LC" + c-basic-offset: 8 + tab-width: 8 + fill-column: 80 + scroll-step: 1 + End: +*/ diff --git a/xlators/bindings/Makefile.am b/xlators/bindings/Makefile.am deleted file mode 100644 index f77665802..000000000 --- a/xlators/bindings/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = $(BINDINGS_SUBDIRS) diff --git a/xlators/bindings/python/Makefile.am b/xlators/bindings/python/Makefile.am deleted file mode 100644 index af437a64d..000000000 --- a/xlators/bindings/python/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = src diff --git a/xlators/bindings/python/src/Makefile.am b/xlators/bindings/python/src/Makefile.am deleted file mode 100644 index 90370d861..000000000 --- a/xlators/bindings/python/src/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ - -xlator_PROGRAMS = python.so - -xlatordir = $(libdir)/glusterfs/$(PACKAGE_VERSION)/xlator/bindings - -python_PYTHON = gluster.py glustertypes.py glusterstack.py - -pythondir = $(xlatordir)/python - -python_so_SOURCES = python.c - -AM_CFLAGS = -fPIC $(GF_CPPFLAGS) -Wall \ - -I$(top_srcdir)/libglusterfs/src -shared -nostartfiles \ - $(PYTHON_CPPLAGS) -DGLUSTER_PYTHON_PATH=\"$(pythondir)\" - -AM_LDFLAGS = $(PYTHON_LDFLAGS) - -CLEANFILES = - diff --git a/xlators/bindings/python/src/gluster.py b/xlators/bindings/python/src/gluster.py deleted file mode 100644 index 337c983ec..000000000 --- a/xlators/bindings/python/src/gluster.py +++ /dev/null @@ -1,40 +0,0 @@ - -# Copyright (c) 2007-2012 Red Hat, Inc. <http://www.redhat.com> -# This file is part of GlusterFS. -# -# This file is licensed to you under your choice of the GNU Lesser -# General Public License, version 3 or any later version (LGPLv3 or -# later), or the GNU General Public License, version 2 (GPLv2), in all -# cases as published by the Free Software Foundation. - -from ctypes import * -from glustertypes import * -from glusterstack import * -import sys -import inspect - -libglusterfs = CDLL("libglusterfs.so") -_gf_log = libglusterfs._gf_log -_gf_log.restype = c_int32 -_gf_log.argtypes = [c_char_p, c_char_p, c_char_p, c_int32, c_int, c_char_p] - -gf_log_loglevel = c_int.in_dll(libglusterfs, "gf_log_loglevel") - -GF_LOG_NONE = 0 -GF_LOG_CRITICAL = 1 -GF_LOG_ERROR = 2 -GF_LOG_WARNING = 3 -GF_LOG_DEBUG = 4 - -def gf_log(module, level, fmt, *params): - if level <= gf_log_loglevel: - frame = sys._getframe(1) - _gf_log(module, frame.f_code.co_filename, frame.f_code.co_name, - frame.f_lineno, level, fmt, *params) - -class ComplexTranslator(object): - def __init__(self, xlator): - self.xlator = xlator_t.from_address(xlator) - - def __getattr__(self, item): - return getattr(self.xlator, item) diff --git a/xlators/bindings/python/src/glusterstack.py b/xlators/bindings/python/src/glusterstack.py deleted file mode 100644 index 0c071ae98..000000000 --- a/xlators/bindings/python/src/glusterstack.py +++ /dev/null @@ -1,48 +0,0 @@ - -# Copyright (c) 2007-2012 Red Hat, Inc. <http://www.redhat.com> -# This file is part of GlusterFS. -# -# This file is licensed to you under your choice of the GNU Lesser -# General Public License, version 3 or any later version (LGPLv3 or -# later), or the GNU General Public License, version 2 (GPLv2), in all -# cases as published by the Free Software Foundation. - -from ctypes import * -from glustertypes import * - -libc = CDLL("libc.so.6") -calloc = libc.calloc -calloc.argtypes = [c_int, c_int] -calloc.restype = c_void_p - -# TODO: Can these be done in C somehow? -def stack_wind(frame, rfn, obj, fn, *params): - """Frame is a frame object""" - _new = cast(calloc(1, sizeof(call_frame_t)), POINTER(call_frame_t)) - _new[0].root = frame.root - _new[0].next = frame.root[0].frames.next - _new[0].prev = pointer(frame.root[0].frames) - if frame.root[0].frames.next: - frame.root[0].frames.next[0].prev = _new - frame.root[0].frames.next = _new - _new[0].this = obj - # TODO: Type checking like tmp_cbk? - _new[0].ret = rfn - _new[0].parent = pointer(frame) - _new[0].cookie = cast(_new, c_void_p) - # TODO: Initialize lock - #_new.lock.init() - frame.ref_count += 1 - fn(_new, obj, *params) - -def stack_unwind(frame, *params): - """Frame is a frame object""" - fn = frame[0].ret - parent = frame[0].parent[0] - parent.ref_count -= 1 - - op_ret = params[0] - op_err = params[1] - params = params[2:] - fn(parent, call_frame_t.from_address(frame[0].cookie), parent.this, - op_ret, op_err, *params) diff --git a/xlators/bindings/python/src/glustertypes.py b/xlators/bindings/python/src/glustertypes.py deleted file mode 100644 index 98437d22e..000000000 --- a/xlators/bindings/python/src/glustertypes.py +++ /dev/null @@ -1,160 +0,0 @@ - -# Copyright (c) 2007-2012 Red Hat, Inc. <http://www.redhat.com> -# This file is part of GlusterFS. -# -# This file is licensed to you under your choice of the GNU Lesser -# General Public License, version 3 or any later version (LGPLv3 or -# later), or the GNU General Public License, version 2 (GPLv2), in all -# cases as published by the Free Software Foundation. - -from ctypes import * -import collections - -# -# Forward declaration of some gluster types -# -class call_frame_t(Structure): - pass - -class call_ctx_t(Structure): - pass - -class call_pool_t(Structure): - pass - -class xlator_t(Structure): - def _getFirstChild(self): - return self.children[0].xlator - firstChild = property(_getFirstChild) - -class xlator_list_t(Structure): - pass - -class xlator_fops(Structure): - pass - -class xlator_mops(Structure): - pass - -class glusterfs_ctx_t(Structure): - pass - -class list_head(Structure): - pass - -class dict_t(Structure): - pass - -class inode_table_t(Structure): - pass - -class fd_t(Structure): - pass - -class iovec(Structure): - _fields_ = [ - ("iov_base", c_void_p), - ("iov_len", c_size_t), - ] - - def __init__(self, s): - self.iov_base = cast(c_char_p(s), c_void_p) - self.iov_len = len(s) - - def getBytes(self): - return string_at(self.iov_base, self.iov_len) - -# This is a pthread_spinlock_t -# TODO: what happens to volatile-ness? -gf_lock_t = c_int - -uid_t = c_uint32 -gid_t = c_uint32 -pid_t = c_int32 - -off_t = c_int64 - -# -# Function pointer types -# -ret_fn_t = CFUNCTYPE(c_int32, POINTER(call_frame_t), POINTER(call_frame_t), - POINTER(xlator_t), c_int32, c_int32) - -fini_fn_t = CFUNCTYPE(None, POINTER(xlator_t)) -init_fn_t = CFUNCTYPE(c_int32, POINTER(xlator_t)) -event_notify_fn_t = CFUNCTYPE(c_int32, POINTER(xlator_t), c_int32, c_void_p) - -list_head._fields_ = [ - ("next", POINTER(list_head)), - ("prev", POINTER(list_head)), - ] - -call_frame_t._fields_ = [ - ("root", POINTER(call_ctx_t)), - ("parent", POINTER(call_frame_t)), - ("next", POINTER(call_frame_t)), - ("prev", POINTER(call_frame_t)), - ("local", c_void_p), - ("this", POINTER(xlator_t)), - ("ret", ret_fn_t), - ("ref_count", c_int32), - ("lock", gf_lock_t), - ("cookie", c_void_p), - ("op", c_int32), - ("type", c_int8), - ] - -call_ctx_t._fields_ = [ - ("all_frames", list_head), - ("trans", c_void_p), - ("pool", call_pool_t), - ("unique", c_uint64), - ("state", c_void_p), - ("uid", uid_t), - ("gid", gid_t), - ("pid", pid_t), - ("frames", call_frame_t), - ("req_refs", POINTER(dict_t)), - ("rsp_refs", POINTER(dict_t)), - ] - -xlator_t._fields_ = [ - ("name", c_char_p), - ("type", c_char_p), - ("next", POINTER(xlator_t)), - ("prev", POINTER(xlator_t)), - ("parent", POINTER(xlator_t)), - ("children", POINTER(xlator_list_t)), - ("fops", POINTER(xlator_fops)), - ("mops", POINTER(xlator_mops)), - ("fini", fini_fn_t), - ("init", init_fn_t), - ("notify", event_notify_fn_t), - ("options", POINTER(dict_t)), - ("ctx", POINTER(glusterfs_ctx_t)), - ("itable", POINTER(inode_table_t)), - ("ready", c_char), - ("private", c_void_p), - ] - -xlator_list_t._fields_ = [ - ("xlator", POINTER(xlator_t)), - ("next", POINTER(xlator_list_t)), - ] - -fop_functions = collections.defaultdict(lambda: c_void_p) -fop_function_names = ['lookup', 'forget', 'stat', 'fstat', 'chmod', 'fchmod', - 'chown', 'fchown', 'truncate', 'ftruncate', 'utimens', 'access', - 'readlink', 'mknod', 'mkdir', 'unlink', 'rmdir', 'symlink', - 'rename', 'link', 'create', 'open', 'readv', 'writev', 'flush', - 'close', 'fsync', 'opendir', 'readdir', 'closedir', 'fsyncdir', - 'statfs', 'setxattr', 'getxattr', 'removexattr', 'lk', 'writedir', - # TODO: Call backs? - ] - -fop_writev_t = CFUNCTYPE(c_int32, POINTER(call_frame_t), POINTER(xlator_t), - POINTER(fd_t), POINTER(iovec), c_int32, - off_t) - -fop_functions['writev'] = fop_writev_t -xlator_fops._fields_ = [(f, fop_functions[f]) for f in fop_function_names] diff --git a/xlators/bindings/python/src/python.c b/xlators/bindings/python/src/python.c deleted file mode 100644 index 9b96790de..000000000 --- a/xlators/bindings/python/src/python.c +++ /dev/null @@ -1,222 +0,0 @@ -/* - Copyright (c) 2008-2012 Red Hat, Inc. <http://www.redhat.com> - This file is part of GlusterFS. - - This file is licensed to you under your choice of the GNU Lesser - General Public License, version 3 or any later version (LGPLv3 or - later), or the GNU General Public License, version 2 (GPLv2), in all - cases as published by the Free Software Foundation. -*/ -#include <Python.h> - -#ifndef _CONFIG_H -#define _CONFIG_H -#include "config.h" -#endif - -#include "glusterfs.h" -#include "xlator.h" -#include "logging.h" -#include "defaults.h" - -typedef struct -{ - char *scriptname; - PyObject *pXlator; - PyObject *pScriptModule; - PyObject *pGlusterModule; - PyThreadState *pInterp; - - PyObject *pFrameType, *pVectorType, *pFdType; -} python_private_t; - -int32_t -python_writev (call_frame_t *frame, - xlator_t *this, - fd_t *fd, - struct iovec *vector, - int32_t count, - off_t offset) -{ - python_private_t *priv = (python_private_t *)this->private; - gf_log("python", GF_LOG_DEBUG, "In writev"); - if (PyObject_HasAttrString(priv->pXlator, "writev")) - { - - PyObject *retval = PyObject_CallMethod(priv->pXlator, "writev", - "O O O i l", - PyObject_CallMethod(priv->pFrameType, "from_address", "O&", PyLong_FromVoidPtr, frame), - PyObject_CallMethod(priv->pFdType, "from_address", "O&", PyLong_FromVoidPtr, fd), - PyObject_CallMethod(priv->pVectorType, "from_address", "O&", PyLong_FromVoidPtr, vector), - count, - offset); - if (PyErr_Occurred()) - { - PyErr_Print(); - } - Py_XDECREF(retval); - } - else - { - return default_writev(frame, this, fd, vector, count, offset); - } - return 0; -} - -struct xlator_fops fops = { - .writev = python_writev -}; - -static PyObject * -AnonModule_FromFile (const char* fname) -{ - // Get the builtins - PyThreadState* pThread = PyThreadState_Get(); - PyObject *pBuiltins = pThread->interp->builtins; - - if (PyErr_Occurred()) - { - PyErr_Print(); - return NULL; - } - - // Create a new dictionary for running code in - PyObject *pModuleDict = PyDict_New(); - PyDict_SetItemString(pModuleDict, "__builtins__", pBuiltins); - Py_INCREF(pBuiltins); - - // Run the file in the new context - FILE* fp = fopen(fname, "r"); - PyRun_File(fp, fname, Py_file_input, pModuleDict, pModuleDict); - fclose(fp); - if (PyErr_Occurred()) - { - PyErr_Print(); - Py_DECREF(pModuleDict); - Py_DECREF(pBuiltins); - return NULL; - } - - // Create an object to hold the new context - PyRun_String("class ModuleWrapper(object):\n\tpass\n", Py_single_input, pModuleDict, pModuleDict); - if (PyErr_Occurred()) - { - PyErr_Print(); - Py_DECREF(pModuleDict); - Py_DECREF(pBuiltins); - return NULL; - } - PyObject *pModule = PyRun_String("ModuleWrapper()", Py_eval_input, pModuleDict, pModuleDict); - if (PyErr_Occurred()) - { - PyErr_Print(); - Py_DECREF(pModuleDict); - Py_DECREF(pBuiltins); - Py_XDECREF(pModule); - return NULL; - } - - // Set the new context's dictionary to the one we used to run the code - // inside - PyObject_SetAttrString(pModule, "__dict__", pModuleDict); - if (PyErr_Occurred()) - { - PyErr_Print(); - Py_DECREF(pModuleDict); - Py_DECREF(pBuiltins); - Py_DECREF(pModule); - return NULL; - } - - return pModule; -} - -int32_t -init (xlator_t *this) -{ - // This is ok to call more than once per process - Py_InitializeEx(0); - - if (!this->children) { - gf_log ("python", GF_LOG_ERROR, - "FATAL: python should have exactly one child"); - return -1; - } - - python_private_t *priv = CALLOC (sizeof (python_private_t), 1); - ERR_ABORT (priv); - - data_t *scriptname = dict_get (this->options, "scriptname"); - if (scriptname) { - priv->scriptname = data_to_str(scriptname); - } else { - gf_log("python", GF_LOG_ERROR, - "FATAL: python requires the scriptname parameter"); - return -1; - } - - priv->pInterp = Py_NewInterpreter(); - - // Adjust python's path - PyObject *syspath = PySys_GetObject("path"); - PyObject *path = PyString_FromString(GLUSTER_PYTHON_PATH); - PyList_Append(syspath, path); - Py_DECREF(path); - - gf_log("python", GF_LOG_DEBUG, - "Loading gluster module"); - - priv->pGlusterModule = PyImport_ImportModule("gluster"); - if (PyErr_Occurred()) - { - PyErr_Print(); - return -1; - } - - priv->pFrameType = PyObject_GetAttrString(priv->pGlusterModule, "call_frame_t"); - priv->pFdType = PyObject_GetAttrString(priv->pGlusterModule, "fd_t"); - priv->pVectorType = PyObject_GetAttrString(priv->pGlusterModule, "iovec"); - - gf_log("python", GF_LOG_DEBUG, "Loading script...%s", priv->scriptname); - - priv->pScriptModule = AnonModule_FromFile(priv->scriptname); - if (!priv->pScriptModule || PyErr_Occurred()) - { - gf_log("python", GF_LOG_ERROR, "Error loading %s", priv->scriptname); - PyErr_Print(); - return -1; - } - - if (!PyObject_HasAttrString(priv->pScriptModule, "xlator")) - { - gf_log("python", GF_LOG_ERROR, "%s does not have a xlator attribute", priv->scriptname); - return -1; - } - gf_log("python", GF_LOG_DEBUG, "Instantiating translator"); - priv->pXlator = PyObject_CallMethod(priv->pScriptModule, "xlator", "O&", - PyLong_FromVoidPtr, this); - if (PyErr_Occurred() || !priv->pXlator) - { - PyErr_Print(); - return -1; - } - - this->private = priv; - - gf_log ("python", GF_LOG_DEBUG, "python xlator loaded"); - return 0; -} - -void -fini (xlator_t *this) -{ - python_private_t *priv = (python_private_t*)(this->private); - Py_DECREF(priv->pXlator); - Py_DECREF(priv->pScriptModule); - Py_DECREF(priv->pGlusterModule); - Py_DECREF(priv->pFrameType); - Py_DECREF(priv->pFdType); - Py_DECREF(priv->pVectorType); - Py_EndInterpreter(priv->pInterp); - return; -} diff --git a/xlators/bindings/python/src/testxlator.py b/xlators/bindings/python/src/testxlator.py deleted file mode 100644 index 59a991dca..000000000 --- a/xlators/bindings/python/src/testxlator.py +++ /dev/null @@ -1,49 +0,0 @@ -""" - Copyright (c) 2007-2012 Red Hat, Inc. <http://www.redhat.com> - This file is part of GlusterFS. - - This file is licensed to you under your choice of the GNU Lesser - General Public License, version 3 or any later version (LGPLv3 or - later), or the GNU General Public License, version 2 (GPLv2), in all - cases as published by the Free Software Foundation. -""" - -""" -This is a test translator written in python. - -Important things to note: - This file must be import-able from glusterfsd. This probably means - setting PYTHONPATH to where this file is located. - - This file must have a top-level xlator class object that will be - used to instantiate individual translators. -""" -from gluster import * - -class MyXlator(ComplexTranslator): - name = "MyXlator" - def writev_cbk(self, frame, cookie, op_ret, op_errno, buf): - stack_unwind(frame, op_ret, op_errno, buf) - return 0 - - def writev(self, frame, fd, vector, count, offset): - gf_log(self.name, GF_LOG_WARNING, "writev %i bytes", vector.iov_len) - # TODO: Use cookie to pass this to writev_cbk - old_count = vector.iov_len - - data = vector.getBytes().encode("zlib") - - vector = iovec(data) - gf_log(self.name, GF_LOG_WARNING, "writev %i bytes", vector.iov_len) - - @ret_fn_t - def rfn(frame, prev, this, op_ret, op_errno, *params): - if len(params) == 0: - params = [0] - return self.writev_cbk(frame, prev, old_count, op_errno, *params) - - stack_wind(frame, rfn, self.firstChild, - self.firstChild[0].fops[0].writev, fd, vector, count, offset) - return 0 - -xlator = MyXlator diff --git a/xlators/cluster/afr/src/pump.c b/xlators/cluster/afr/src/pump.c index a8e0c21ab..987696e55 100644 --- a/xlators/cluster/afr/src/pump.c +++ b/xlators/cluster/afr/src/pump.c @@ -496,14 +496,14 @@ pump_xattr_cleaner (call_frame_t *frame, void *cookie, xlator_t *this, afr_build_root_loc (this, &loc); ret = syncop_removexattr (priv->children[source], &loc, - PUMP_PATH); + PUMP_PATH, 0); ret = syncop_removexattr (priv->children[sink], &loc, - PUMP_SINK_COMPLETE); + PUMP_SINK_COMPLETE, 0); for (i = 0; i < priv->child_count; i++) { ret = syncop_removexattr (priv->children[i], &loc, - PUMP_SOURCE_COMPLETE); + PUMP_SOURCE_COMPLETE, 0); if (ret) { gf_log (this->name, GF_LOG_DEBUG, "removexattr " "failed with %s", strerror (-ret)); diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index a5a4585f1..a17319ba6 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -892,7 +892,7 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to, } /* remove the 'linkto' xattr from the destination */ - ret = syncop_fremovexattr (to, dst_fd, conf->link_xattr_name); + ret = syncop_fremovexattr (to, dst_fd, conf->link_xattr_name, 0); if (ret) { gf_log (this->name, GF_LOG_WARNING, "%s: failed to perform removexattr on %s (%s)", diff --git a/xlators/cluster/stripe/src/stripe-helpers.c b/xlators/cluster/stripe/src/stripe-helpers.c index a83abdc72..a047d4a2e 100644 --- a/xlators/cluster/stripe/src/stripe-helpers.c +++ b/xlators/cluster/stripe/src/stripe-helpers.c @@ -223,6 +223,7 @@ stripe_fill_lockinfo_xattr (xlator_t *this, stripe_local_t *local, if (ret < 0) { gf_log (this->name, GF_LOG_WARNING, "dict_serialize failed (%s)", strerror (-ret)); + GF_FREE(buf); ret = -1; goto out; } @@ -280,6 +281,7 @@ stripe_fill_pathinfo_xattr (xlator_t *this, stripe_local_t *local, if (ret) { gf_log (this->name, GF_LOG_ERROR, "Cannot aggregate pathinfo list"); + GF_FREE(pathinfo_serz); goto out; } diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c index c736e83ed..32d53e8e6 100644 --- a/xlators/cluster/stripe/src/stripe.c +++ b/xlators/cluster/stripe/src/stripe.c @@ -1053,6 +1053,9 @@ stripe_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, op_errno = ENOMEM; goto err; } + + frame->local = local; + local->op_ret = -1; loc_copy (&local->loc, oldloc); loc_copy (&local->loc2, newloc); @@ -1066,8 +1069,6 @@ stripe_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, local->fctx = fctx; } - frame->local = local; - STACK_WIND (frame, stripe_first_rename_cbk, trav->xlator, trav->xlator->fops->rename, oldloc, newloc, NULL); @@ -2879,15 +2880,15 @@ stripe_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags, dict goto err; } + frame->local = local; + inode_ctx_get(fd->inode, this, (uint64_t *) &fctx); if (!fctx) { op_errno = EINVAL; goto err; } local->fctx = fctx; - local->op_ret = -1; - frame->local = local; local->call_count = priv->child_count; while (trav) { diff --git a/xlators/encryption/rot-13/src/rot-13.c b/xlators/encryption/rot-13/src/rot-13.c index b9ac29a72..1bcfe0192 100644 --- a/xlators/encryption/rot-13/src/rot-13.c +++ b/xlators/encryption/rot-13/src/rot-13.c @@ -150,6 +150,7 @@ init (xlator_t *this) if (gf_string2boolean (data->data, &priv->encrypt_write) == -1) { gf_log (this->name, GF_LOG_ERROR, "encrypt-write takes only boolean options"); + GF_FREE (priv); return -1; } } @@ -159,6 +160,7 @@ init (xlator_t *this) if (gf_string2boolean (data->data, &priv->decrypt_read) == -1) { gf_log (this->name, GF_LOG_ERROR, "decrypt-read takes only boolean options"); + GF_FREE (priv); return -1; } } diff --git a/xlators/features/compress/src/cdc.c b/xlators/features/compress/src/cdc.c index eb7d87c56..a334c7e06 100644 --- a/xlators/features/compress/src/cdc.c +++ b/xlators/features/compress/src/cdc.c @@ -115,8 +115,8 @@ cdc_writev_cbk (call_frame_t *frame, struct iatt *postbuf, dict_t *xdata) { - STACK_UNWIND_STRICT (writev, frame, op_ret, op_errno, prebuf, postbuf, xdata); - return 0; + STACK_UNWIND_STRICT (writev, frame, op_ret, op_errno, prebuf, postbuf, xdata); + return 0; } int32_t @@ -129,24 +129,23 @@ cdc_writev (call_frame_t *frame, uint32_t flags, struct iobref *iobref, dict_t *xdata) { - int ret = -1; - cdc_priv_t *priv = NULL; - cdc_info_t ci = {0,}; - size_t isize = 0; + int ret = -1; + cdc_priv_t *priv = NULL; + cdc_info_t ci = {0,}; + size_t isize = 0; - GF_VALIDATE_OR_GOTO ("cdc", this, default_out); - GF_VALIDATE_OR_GOTO (this->name, frame, default_out); + GF_VALIDATE_OR_GOTO ("cdc", this, default_out); + GF_VALIDATE_OR_GOTO (this->name, frame, default_out); - priv = this->private; + priv = this->private; - isize = iov_length(vector, count); + isize = iov_length(vector, count); - if (isize <= 0) - goto default_out; + if (isize <= 0) + goto default_out; - if ( (priv->min_file_size != 0) - && (isize < priv->min_file_size) ) - goto default_out; + if ( (priv->min_file_size != 0) && (isize < priv->min_file_size) ) + goto default_out; ci.count = count; ci.ibytes = isize; @@ -159,18 +158,18 @@ cdc_writev (call_frame_t *frame, /* A writev compresses on the client side and decompresses on the server side */ - if (priv->op_mode == GF_CDC_MODE_CLIENT) { - ret = cdc_compress (this, priv, &ci, &xdata); - } else if (priv->op_mode == GF_CDC_MODE_SERVER) { - ret = cdc_decompress (this, priv, &ci, xdata); - } else { - gf_log (this->name, GF_LOG_ERROR, "Invalid operation mode (%d) ", priv->op_mode); - } - - if (ret) - goto default_out; - - STACK_WIND (frame, + if (priv->op_mode == GF_CDC_MODE_CLIENT) { + ret = cdc_compress (this, priv, &ci, &xdata); + } else if (priv->op_mode == GF_CDC_MODE_SERVER) { + ret = cdc_decompress (this, priv, &ci, xdata); + } else { + gf_log (this->name, GF_LOG_ERROR, "Invalid operation mode (%d) ", priv->op_mode); + } + + if (ret) + goto default_out; + + STACK_WIND (frame, cdc_writev_cbk, FIRST_CHILD (this), FIRST_CHILD (this)->fops->writev, @@ -181,13 +180,13 @@ cdc_writev (call_frame_t *frame, return 0; default_out: - STACK_WIND (frame, + STACK_WIND (frame, cdc_writev_cbk, FIRST_CHILD (this), FIRST_CHILD (this)->fops->writev, fd, vector, count, offset, flags, iobref, xdata); - return 0; + return 0; } int32_t @@ -309,17 +308,17 @@ struct volume_options options[] = { { .key = {"mem-level"}, .default_value = "8", .type = GF_OPTION_TYPE_INT, - .description = "Memory allocated for internal compression state.\ - 1 uses minimum memory but is slow and reduces \ - compression ratio; memLevel=9 uses maximum memory \ - for optimal speed. The default value is 8." + .description = "Memory allocated for internal compression state. " + "1 uses minimum memory but is slow and reduces " + "compression ratio; memLevel=9 uses maximum memory " + "for optimal speed. The default value is 8." }, { .key = {"compression-level"}, .default_value = "-1", .type = GF_OPTION_TYPE_INT, - .description = "Compression levels \ - 0 : no compression, 1 : best speed, \ - 9 : best compression, -1 : default compression " + .description = "Compression levels \n" + "0 : no compression, 1 : best speed, \n" + "9 : best compression, -1 : default compression " }, { .key = {"min-size"}, .default_value = "0", @@ -329,13 +328,14 @@ struct volume_options options[] = { { .key = {"mode"}, .value = {"server", "client"}, .type = GF_OPTION_TYPE_STR, - .description = "Set on the basis of where the xlator is loaded." + .description = "Set on the basis of where the xlator is loaded. " + "This option should NOT be configured by user." }, { .key = {"debug"}, .default_value = "false", .type = GF_OPTION_TYPE_BOOL, - .description = "This is used in testing. Will dump compressed data \ - to disk as a gzip file." + .description = "This is used in testing. Will dump compressed data " + "to disk as a gzip file." }, { .key = {NULL} }, diff --git a/xlators/features/gfid-access/src/gfid-access.c b/xlators/features/gfid-access/src/gfid-access.c index 362fdab5a..8e614397c 100644 --- a/xlators/features/gfid-access/src/gfid-access.c +++ b/xlators/features/gfid-access/src/gfid-access.c @@ -666,6 +666,11 @@ ga_virtual_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, buf->ia_ino = temp_ino; unwind: + /* Lookup on non-existing gfid returns ESTALE. + Convert into ENOENT for virtual lookup*/ + if (op_errno == ESTALE) + op_errno = ENOENT; + STACK_UNWIND_STRICT (lookup, frame, op_ret, op_errno, cbk_inode, buf, xdata, postparent); diff --git a/xlators/features/glupy/src/Makefile.am b/xlators/features/glupy/src/Makefile.am index 960862839..21b91a164 100644 --- a/xlators/features/glupy/src/Makefile.am +++ b/xlators/features/glupy/src/Makefile.am @@ -6,15 +6,15 @@ glupydir = $(xlatordir)/glupy glupy_PYTHON = gluster.py negative.py helloworld.py debug-trace.py -glupy_la_LDFLAGS = -module -avoid-version -shared -nostartfiles +glupy_la_LDFLAGS = $(PYTHONDEV_LDFLAGS) -module -avoid-version -shared -nostartfiles glupy_la_SOURCES = glupy.c glupy_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \ -lpthread -l$(BUILD_PYTHON_LIB) noinst_HEADERS = glupy.h -AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src -isystem $(BUILD_PYTHON_INC) +AM_CPPFLAGS = $(PYTHONDEV_CPPFLAGS) $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src -isystem $(BUILD_PYTHON_INC) -AM_CFLAGS = -Wall -fno-strict-aliasing -DGLUSTER_PYTHON_PATH=\"$(glupydir)\" $(GF_CFLAGS) +AM_CFLAGS = $(PYTHONDEV_CFLAGS) -Wall -fno-strict-aliasing -DGLUSTER_PYTHON_PATH=\"$(glupydir)\" $(GF_CFLAGS) CLEANFILES = diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c index 45058652b..a27a266f0 100644 --- a/xlators/features/marker/src/marker.c +++ b/xlators/features/marker/src/marker.c @@ -2167,7 +2167,7 @@ remove_quota_keys (dict_t *dict, char *k, data_t *v, void *data) xlator_t *this = frame->this; int ret = -1; - ret = syncop_removexattr (FIRST_CHILD (this), &local->loc, k); + ret = syncop_removexattr (FIRST_CHILD (this), &local->loc, k, 0); if (ret) { gf_log (this->name, GF_LOG_ERROR, "%s: Failed to remove " "extended attribute: %s", local->loc.path, k); diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c index a0bc9f737..9208ece2d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c +++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c @@ -2531,6 +2531,90 @@ out: return ret; } +/* + * glusterd_gsync_op_already_set: + * This funcion checks whether the op_value is same as in the + * gsyncd.conf file. + * + * RETURN VALUE: + * 0 : op_value matches the conf file. + * 1 : op_value does not matches the conf file or op_param not + * found in conf file. + * -1 : error + */ + +int +glusterd_gsync_op_already_set (char* master, char* slave, char* conf_path, + char* op_name, char* op_value) +{ + dict_t *confd = NULL; + char *op_val_buf = NULL; + int32_t op_val_conf = 0; + int32_t op_val_cli = 0; + int32_t ret = -1; + gf_boolean_t is_bool = _gf_true; + + confd = dict_new (); + if (!confd) { + gf_log ("", GF_LOG_ERROR, "Not able to create dict."); + return -1; + } + + ret = glusterd_gsync_get_config (master, slave, conf_path, + confd); + if (ret) { + gf_log ("", GF_LOG_ERROR, "Unable to get configuration data" + "for %s(master), %s(slave)", master, slave); + goto out; + } + + ret = dict_get_param (confd, op_name, &op_val_buf); + if (ret) { + gf_log ("", GF_LOG_ERROR, "Unable to get op_value " + "for %s(master), %s(slave). Please check gsync " + "config file.", master, slave); + ret = 1; + goto out; + } + + gf_log("",GF_LOG_DEBUG, "val_cli:%s val_conf:%s",op_value,op_val_buf); + + if (!strcmp(op_val_buf,"true") || !strcmp(op_val_buf,"1") + || !strcmp(op_val_buf,"yes")) { + op_val_conf = 1; + } else if(!strcmp(op_val_buf,"false") || !strcmp(op_val_buf,"0") + || !strcmp(op_val_buf,"no")) { + op_val_conf = 0; + } else { + is_bool = _gf_false; + } + + if (is_bool) { + if (!strcmp(op_value,"true") || !strcmp(op_value,"1") + || !strcmp(op_value,"yes")) { + op_val_cli = 1; + } else { + op_val_cli = 0; + } + + if ( op_val_cli == op_val_conf ) { + ret = 0; + goto out; + } + } else { + if (!strcmp(op_val_buf,op_value)) { + ret = 0; + goto out; + } + } + + ret = 1; + +out: + dict_unref(confd); + return ret; +} + static int glusterd_gsync_configure (glusterd_volinfo_t *volinfo, char *slave, char *path_list, dict_t *dict, @@ -2549,6 +2633,7 @@ glusterd_gsync_configure (glusterd_volinfo_t *volinfo, char *slave, struct stat stbuf = {0, }; gf_boolean_t restart_required = _gf_true; char **resopt = NULL; + gf_boolean_t op_already_set = _gf_false; GF_ASSERT (slave); GF_ASSERT (op_errstr); @@ -2603,6 +2688,24 @@ glusterd_gsync_configure (glusterd_volinfo_t *volinfo, char *slave, runner_add_arg (&runner, op_name); if (op_value) runner_add_arg (&runner, op_value); + + if ( strcmp(op_name,"checkpoint") != 0 ) { + ret = glusterd_gsync_op_already_set(master,slave,conf_path, + op_name,op_value); + if (ret == -1) { + gf_log ("", GF_LOG_WARNING, + "glusterd_gsync_op_already_set failed."); + gf_asprintf (op_errstr, GEOREP" config-%s failed for " + "%s %s", subop, master, slave); + goto out; + } + if (ret == 0) { + gf_log("", GF_LOG_DEBUG, "op_value is already set"); + op_already_set = _gf_true; + goto out; + } + } + synclock_unlock (&priv->big_lock); ret = runner_run (&runner); synclock_lock (&priv->big_lock); @@ -2652,7 +2755,7 @@ glusterd_gsync_configure (glusterd_volinfo_t *volinfo, char *slave, gf_asprintf (op_errstr, "config-%s successful", subop); out: - if (!ret && volinfo) { + if (!ret && volinfo && !op_already_set) { for (resopt = gsync_no_restart_opts; *resopt; resopt++) { restart_required = _gf_true; if (!strcmp ((*resopt), op_name)){ @@ -3873,12 +3976,13 @@ glusterd_op_gsync_set (dict_t *dict, char **op_errstr, dict_t *rsp_dict) if (type == GF_GSYNC_OPTION_TYPE_CONFIG) { ret = glusterd_gsync_configure (volinfo, slave, path_list, dict, resp_dict, op_errstr); - - ret = dict_set_str (resp_dict, "conf_path", conf_path); - if (ret) { - gf_log ("", GF_LOG_ERROR, - "Unable to store conf_file_path."); - goto out; + if (!ret) { + ret = dict_set_str (resp_dict, "conf_path", conf_path); + if (ret) { + gf_log ("", GF_LOG_ERROR, + "Unable to store conf_file_path."); + goto out; + } } goto out; } diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index 5a140bb22..34dd20545 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -57,7 +57,6 @@ #endif extern glusterd_op_info_t opinfo; -extern uuid_t global_txn_id; int glusterd_big_locked_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event, @@ -624,7 +623,6 @@ glusterd_op_txn_begin (rpcsvc_request_t *req, glusterd_op_t op, void *ctx, gf_log (this->name, GF_LOG_ERROR, "Failed to generate transaction id"); goto out; - } /* Save the MY_UUID as the originator_uuid. This originator_uuid @@ -685,7 +683,7 @@ local_locking_done: /* If no volname is given as a part of the command, locks will * not be held, hence sending stage event. */ - if (volname) + if (volname || (priv->op_version < GD_OP_VERSION_4)) event_type = GD_OP_EVENT_START_LOCK; else { txn_op_info.state.state = GD_OP_STATE_LOCK_SENT; @@ -744,13 +742,18 @@ __glusterd_handle_cluster_lock (rpcsvc_request_t *req) glusterd_op_t op = GD_OP_EVENT_LOCK; glusterd_peerinfo_t *peerinfo = NULL; glusterd_op_info_t txn_op_info = {{0},}; - uuid_t *txn_id = &global_txn_id; + glusterd_conf_t *priv = NULL; + uuid_t *txn_id = NULL; xlator_t *this = NULL; this = THIS; GF_ASSERT (this); + priv = this->private; + GF_ASSERT (priv); GF_ASSERT (req); + txn_id = &priv->global_txn_id; + ret = xdr_to_generic (req->msg[0], &lock_req, (xdrproc_t)xdr_gd1_mgmt_cluster_lock_req); if (ret < 0) { @@ -896,10 +899,11 @@ glusterd_handle_volume_lock_fn (rpcsvc_request_t *req) out: if (ret) { - if (ctx->dict) - dict_destroy (ctx->dict); - if (ctx) + if (ctx) { + if (ctx->dict) + dict_destroy (ctx->dict); GF_FREE (ctx); + } } glusterd_friend_sm (); @@ -980,10 +984,11 @@ glusterd_handle_volume_unlock_fn (rpcsvc_request_t *req) out: if (ret) { - if (ctx->dict) - dict_destroy (ctx->dict); - if (ctx) + if (ctx) { + if (ctx->dict) + dict_destroy (ctx->dict); GF_FREE (ctx); + } } glusterd_friend_sm (); @@ -1058,14 +1063,19 @@ __glusterd_handle_stage_op (rpcsvc_request_t *req) gd1_mgmt_stage_op_req op_req = {{0},}; glusterd_peerinfo_t *peerinfo = NULL; xlator_t *this = NULL; - uuid_t *txn_id = &global_txn_id; + uuid_t *txn_id = NULL; glusterd_op_info_t txn_op_info = {{0},}; glusterd_op_sm_state_info_t state = {0,}; + glusterd_conf_t *priv = NULL; this = THIS; GF_ASSERT (this); + priv = this->private; + GF_ASSERT (priv); GF_ASSERT (req); + txn_id = &priv->global_txn_id; + ret = xdr_to_generic (req->msg[0], &op_req, (xdrproc_t)xdr_gd1_mgmt_stage_op_req); if (ret < 0) { @@ -1142,12 +1152,17 @@ __glusterd_handle_commit_op (rpcsvc_request_t *req) gd1_mgmt_commit_op_req op_req = {{0},}; glusterd_peerinfo_t *peerinfo = NULL; xlator_t *this = NULL; - uuid_t *txn_id = &global_txn_id; + uuid_t *txn_id = NULL; + glusterd_conf_t *priv = NULL; this = THIS; GF_ASSERT (this); + priv = this->private; + GF_ASSERT (priv); GF_ASSERT (req); + txn_id = &priv->global_txn_id; + ret = xdr_to_generic (req->msg[0], &op_req, (xdrproc_t)xdr_gd1_mgmt_commit_op_req); if (ret < 0) { @@ -2286,12 +2301,17 @@ __glusterd_handle_cluster_unlock (rpcsvc_request_t *req) glusterd_op_lock_ctx_t *ctx = NULL; glusterd_peerinfo_t *peerinfo = NULL; xlator_t *this = NULL; - uuid_t *txn_id = &global_txn_id; + uuid_t *txn_id = NULL; + glusterd_conf_t *priv = NULL; this = THIS; GF_ASSERT (this); + priv = this->private; + GF_ASSERT (priv); GF_ASSERT (req); + txn_id = &priv->global_txn_id; + ret = xdr_to_generic (req->msg[0], &unlock_req, (xdrproc_t)xdr_gd1_mgmt_cluster_unlock_req); if (ret < 0) { diff --git a/xlators/mgmt/glusterd/src/glusterd-locks.c b/xlators/mgmt/glusterd/src/glusterd-locks.c index 68c6d7426..9e8bbc21b 100644 --- a/xlators/mgmt/glusterd/src/glusterd-locks.c +++ b/xlators/mgmt/glusterd/src/glusterd-locks.c @@ -26,17 +26,22 @@ #include <signal.h> -static dict_t *vol_lock; - /* Initialize the global vol-lock list(dict) when * glusterd is spawned */ int32_t glusterd_vol_lock_init () { - int32_t ret = -1; + int32_t ret = -1; + xlator_t *this = NULL; + glusterd_conf_t *priv = NULL; + + this = THIS; + GF_ASSERT (this); + priv = this->private; + GF_ASSERT (priv); - vol_lock = dict_new (); - if (!vol_lock) + priv->vol_lock = dict_new (); + if (!priv->vol_lock) goto out; ret = 0; @@ -49,16 +54,31 @@ out: void glusterd_vol_lock_fini () { - if (vol_lock) - dict_unref (vol_lock); + xlator_t *this = NULL; + glusterd_conf_t *priv = NULL; + + this = THIS; + GF_ASSERT (this); + priv = this->private; + GF_ASSERT (priv); + + if (priv->vol_lock) + dict_unref (priv->vol_lock); } int32_t glusterd_get_vol_lock_owner (char *volname, uuid_t *uuid) { - int32_t ret = -1; - vol_lock_obj *lock_obj = NULL; - uuid_t no_owner = {0,}; + int32_t ret = -1; + glusterd_vol_lock_obj *lock_obj = NULL; + glusterd_conf_t *priv = NULL; + uuid_t no_owner = {0,}; + xlator_t *this = NULL; + + this = THIS; + GF_ASSERT (this); + priv = this->private; + GF_ASSERT (priv); if (!volname || !uuid) { gf_log ("", GF_LOG_ERROR, "volname or uuid is null."); @@ -66,7 +86,7 @@ glusterd_get_vol_lock_owner (char *volname, uuid_t *uuid) goto out; } - ret = dict_get_bin (vol_lock, volname, (void **) &lock_obj); + ret = dict_get_bin (priv->vol_lock, volname, (void **) &lock_obj); if (!ret) uuid_copy (*uuid, lock_obj->lock_owner); else @@ -81,9 +101,16 @@ out: int32_t glusterd_volume_lock (char *volname, uuid_t uuid) { - int32_t ret = -1; - vol_lock_obj *lock_obj = NULL; - uuid_t owner = {0}; + int32_t ret = -1; + glusterd_vol_lock_obj *lock_obj = NULL; + glusterd_conf_t *priv = NULL; + uuid_t owner = {0}; + xlator_t *this = NULL; + + this = THIS; + GF_ASSERT (this); + priv = this->private; + GF_ASSERT (priv); if (!volname) { gf_log ("", GF_LOG_ERROR, "volname is null."); @@ -93,21 +120,22 @@ glusterd_volume_lock (char *volname, uuid_t uuid) ret = glusterd_get_vol_lock_owner (volname, &owner); if (ret) { - gf_log ("", GF_LOG_DEBUG, "Unable to get volume lock owner"); + gf_log ("", GF_LOG_WARNING, + "Unable to get volume lock owner"); goto out; } /* If the lock has already been held for the given volume * we fail */ if (!uuid_is_null (owner)) { - gf_log ("", GF_LOG_ERROR, "Unable to acquire lock. " + gf_log ("", GF_LOG_WARNING, "Unable to acquire lock. " "Lock for %s held by %s", volname, uuid_utoa (owner)); ret = -1; goto out; } - lock_obj = GF_CALLOC (1, sizeof(vol_lock_obj), + lock_obj = GF_CALLOC (1, sizeof(glusterd_vol_lock_obj), gf_common_mt_vol_lock_obj_t); if (!lock_obj) { ret = -1; @@ -116,7 +144,8 @@ glusterd_volume_lock (char *volname, uuid_t uuid) uuid_copy (lock_obj->lock_owner, uuid); - ret = dict_set_bin (vol_lock, volname, lock_obj, sizeof(vol_lock_obj)); + ret = dict_set_bin (priv->vol_lock, volname, lock_obj, + sizeof(glusterd_vol_lock_obj)); if (ret) { gf_log ("", GF_LOG_ERROR, "Unable to set lock owner " "in volume lock"); @@ -137,8 +166,15 @@ out: int32_t glusterd_volume_unlock (char *volname, uuid_t uuid) { - int32_t ret = -1; - uuid_t owner = {0}; + int32_t ret = -1; + glusterd_conf_t *priv = NULL; + uuid_t owner = {0}; + xlator_t *this = NULL; + + this = THIS; + GF_ASSERT (this); + priv = this->private; + GF_ASSERT (priv); if (!volname) { gf_log ("", GF_LOG_ERROR, "volname is null."); @@ -151,21 +187,21 @@ glusterd_volume_unlock (char *volname, uuid_t uuid) goto out; if (uuid_is_null (owner)) { - gf_log ("", GF_LOG_ERROR, "Lock for %s not held", volname); + gf_log ("", GF_LOG_WARNING, "Lock for %s not held", volname); ret = -1; goto out; } ret = uuid_compare (uuid, owner); if (ret) { - gf_log (THIS->name, GF_LOG_ERROR, "Lock owner mismatch. " + gf_log (THIS->name, GF_LOG_WARNING, "Lock owner mismatch. " "Lock for %s held by %s", volname, uuid_utoa (owner)); goto out; } /* Removing the volume lock from the global list */ - dict_del (vol_lock, volname); + dict_del (priv->vol_lock, volname); gf_log ("", GF_LOG_DEBUG, "Lock for %s successfully released", volname); diff --git a/xlators/mgmt/glusterd/src/glusterd-locks.h b/xlators/mgmt/glusterd/src/glusterd-locks.h index 2a8cc20ed..6e3f56f9c 100644 --- a/xlators/mgmt/glusterd/src/glusterd-locks.h +++ b/xlators/mgmt/glusterd/src/glusterd-locks.h @@ -15,10 +15,9 @@ #include "config.h" #endif -struct volume_lock_object_ { +typedef struct glusterd_volume_lock_object_ { uuid_t lock_owner; -}; -typedef struct volume_lock_object_ vol_lock_obj; +} glusterd_vol_lock_obj; int32_t glusterd_vol_lock_init (); diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index 83c91a52d..e3ae369e4 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -68,29 +68,27 @@ static struct list_head gd_op_sm_queue; pthread_mutex_t gd_op_sm_lock; glusterd_op_info_t opinfo = {{0},}; -uuid_t global_txn_id = {0}; /* To be used in - * heterogeneous - * cluster with no - * transaction ids */ - -static dict_t *txn_opinfo; - -struct glusterd_txn_opinfo_object_ { - glusterd_op_info_t opinfo; -}; -typedef struct glusterd_txn_opinfo_object_ glusterd_txn_opinfo_obj; int32_t glusterd_txn_opinfo_dict_init () { - int32_t ret = -1; + int32_t ret = -1; + xlator_t *this = NULL; + glusterd_conf_t *priv = NULL; + + this = THIS; + GF_ASSERT (this); + priv = this->private; + GF_ASSERT (priv); - txn_opinfo = dict_new (); - if (!txn_opinfo) { + priv->glusterd_txn_opinfo = dict_new (); + if (!priv->glusterd_txn_opinfo) { ret = -1; goto out; } + memset (priv->global_txn_id, '\0', sizeof(uuid_t)); + ret = 0; out: return ret; @@ -99,8 +97,16 @@ out: void glusterd_txn_opinfo_dict_fini () { - if (txn_opinfo) - dict_destroy (txn_opinfo); + xlator_t *this = NULL; + glusterd_conf_t *priv = NULL; + + this = THIS; + GF_ASSERT (this); + priv = this->private; + GF_ASSERT (priv); + + if (priv->glusterd_txn_opinfo) + dict_unref (priv->glusterd_txn_opinfo); } void @@ -118,7 +124,10 @@ glusterd_txn_opinfo_init (glusterd_op_info_t *opinfo, if (op) opinfo->op = *op; - opinfo->op_ctx = dict_ref(op_ctx); + if (op_ctx) + opinfo->op_ctx = dict_ref(op_ctx); + else + opinfo->op_ctx = NULL; if (req) opinfo->req = req; @@ -130,14 +139,23 @@ int32_t glusterd_generate_txn_id (dict_t *dict, uuid_t **txn_id) { int32_t ret = -1; + glusterd_conf_t *priv = NULL; + xlator_t *this = NULL; + this = THIS; + GF_ASSERT (this); + priv = this->private; + GF_ASSERT (priv); GF_ASSERT (dict); *txn_id = GF_CALLOC (1, sizeof(uuid_t), gf_common_mt_uuid_t); if (!*txn_id) goto out; - uuid_generate (**txn_id); + if (priv->op_version < GD_OP_VERSION_4) + uuid_copy (**txn_id, priv->global_txn_id); + else + uuid_generate (**txn_id); ret = dict_set_bin (dict, "transaction_id", *txn_id, sizeof (uuid_t)); @@ -150,8 +168,10 @@ glusterd_generate_txn_id (dict_t *dict, uuid_t **txn_id) gf_log ("", GF_LOG_DEBUG, "Transaction_id = %s", uuid_utoa (**txn_id)); out: - if (ret && *txn_id) + if (ret && *txn_id) { GF_FREE (*txn_id); + *txn_id = NULL; + } return ret; } @@ -161,6 +181,13 @@ glusterd_get_txn_opinfo (uuid_t *txn_id, glusterd_op_info_t *opinfo) { int32_t ret = -1; glusterd_txn_opinfo_obj *opinfo_obj = NULL; + glusterd_conf_t *priv = NULL; + xlator_t *this = NULL; + + this = THIS; + GF_ASSERT (this); + priv = this->private; + GF_ASSERT (priv); if (!txn_id || !opinfo) { gf_log ("", GF_LOG_ERROR, @@ -169,16 +196,23 @@ glusterd_get_txn_opinfo (uuid_t *txn_id, glusterd_op_info_t *opinfo) goto out; } - ret = dict_get_bin(txn_opinfo, uuid_utoa (*txn_id), + ret = dict_get_bin(priv->glusterd_txn_opinfo, + uuid_utoa (*txn_id), (void **) &opinfo_obj); if (ret) { gf_log ("", GF_LOG_ERROR, - "Unable to get transaction opinfo"); + "Unable to get transaction opinfo " + "for transaction ID : %s", + uuid_utoa (*txn_id)); goto out; } (*opinfo) = opinfo_obj->opinfo; + gf_log ("", GF_LOG_DEBUG, + "Successfully got opinfo for transaction ID : %s", + uuid_utoa (*txn_id)); + ret = 0; out: gf_log ("", GF_LOG_DEBUG, "Returning %d", ret); @@ -190,6 +224,13 @@ glusterd_set_txn_opinfo (uuid_t *txn_id, glusterd_op_info_t *opinfo) { int32_t ret = -1; glusterd_txn_opinfo_obj *opinfo_obj = NULL; + glusterd_conf_t *priv = NULL; + xlator_t *this = NULL; + + this = THIS; + GF_ASSERT (this); + priv = this->private; + GF_ASSERT (priv); if (!txn_id) { gf_log ("", GF_LOG_ERROR, "Empty transaction id received."); @@ -197,7 +238,8 @@ glusterd_set_txn_opinfo (uuid_t *txn_id, glusterd_op_info_t *opinfo) goto out; } - ret = dict_get_bin(txn_opinfo, uuid_utoa (*txn_id), + ret = dict_get_bin(priv->glusterd_txn_opinfo, + uuid_utoa (*txn_id), (void **) &opinfo_obj); if (ret) { opinfo_obj = GF_CALLOC (1, sizeof(glusterd_txn_opinfo_obj), @@ -207,7 +249,8 @@ glusterd_set_txn_opinfo (uuid_t *txn_id, glusterd_op_info_t *opinfo) goto out; } - ret = dict_set_bin(txn_opinfo, uuid_utoa (*txn_id), opinfo_obj, + ret = dict_set_bin(priv->glusterd_txn_opinfo, + uuid_utoa (*txn_id), opinfo_obj, sizeof(glusterd_txn_opinfo_obj)); if (ret) { gf_log ("", GF_LOG_ERROR, @@ -219,6 +262,9 @@ glusterd_set_txn_opinfo (uuid_t *txn_id, glusterd_op_info_t *opinfo) opinfo_obj->opinfo = (*opinfo); + gf_log ("", GF_LOG_DEBUG, + "Successfully set opinfo for transaction ID : %s", + uuid_utoa (*txn_id)); ret = 0; out: if (ret) @@ -234,6 +280,13 @@ glusterd_clear_txn_opinfo (uuid_t *txn_id) { int32_t ret = -1; glusterd_op_info_t txn_op_info = {{0},}; + glusterd_conf_t *priv = NULL; + xlator_t *this = NULL; + + this = THIS; + GF_ASSERT (this); + priv = this->private; + GF_ASSERT (priv); if (!txn_id) { gf_log ("", GF_LOG_ERROR, "Empty transaction id received."); @@ -247,9 +300,14 @@ glusterd_clear_txn_opinfo (uuid_t *txn_id) goto out; } - dict_unref (txn_op_info.op_ctx); + if (txn_op_info.op_ctx) + dict_unref (txn_op_info.op_ctx); - dict_del(txn_opinfo, uuid_utoa (*txn_id)); + dict_del(priv->glusterd_txn_opinfo, uuid_utoa (*txn_id)); + + gf_log ("", GF_LOG_DEBUG, + "Successfully cleared opinfo for transaction ID : %s", + uuid_utoa (*txn_id)); ret = 0; out: @@ -1663,10 +1721,6 @@ glusterd_op_set_all_volume_options (xlator_t *this, dict_t *dict) if (ret) goto out; - dup_value = gf_strdup (value); - if (!dup_value) - goto out; - ret = glusterd_store_options (this, dup_opt); if (ret) goto out; @@ -1681,10 +1735,18 @@ glusterd_op_set_all_volume_options (xlator_t *this, dict_t *dict) else next_version = NULL; + dup_value = gf_strdup (value); + if (!dup_value) + goto out; + ret = dict_set_dynstr (conf->opts, key, dup_value); if (ret) goto out; + else + dup_value = NULL; /* Protect the allocation from GF_FREE */ + out: + GF_FREE (dup_value); GF_FREE (key_fixed); if (dup_opt) dict_unref (dup_opt); @@ -4293,7 +4355,7 @@ glusterd_op_ac_stage_op (glusterd_op_sm_event_t *event, void *ctx) } ret = dict_set_bin (rsp_dict, "transaction_id", - txn_id, sizeof(uuid_t *)); + txn_id, sizeof(uuid_t)); if (ret) { gf_log (this->name, GF_LOG_ERROR, "Failed to set transaction id."); diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.h b/xlators/mgmt/glusterd/src/glusterd-op-sm.h index 53d4e2ff4..4a73b08f4 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.h +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.h @@ -172,6 +172,10 @@ typedef struct gsync_status_param { glusterd_volinfo_t *volinfo; }gsync_status_param_t; +typedef struct glusterd_txn_opinfo_object_ { + glusterd_op_info_t opinfo; +} glusterd_txn_opinfo_obj; + typedef enum cli_cmd_type_ { PER_REPLICA, ALL_REPLICA, diff --git a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c index f26108f89..9685cb374 100644 --- a/xlators/mgmt/glusterd/src/glusterd-replace-brick.c +++ b/xlators/mgmt/glusterd/src/glusterd-replace-brick.c @@ -1895,15 +1895,17 @@ glusterd_do_replace_brick (void *data) glusterd_brickinfo_t *src_brickinfo = NULL; glusterd_brickinfo_t *dst_brickinfo = NULL; glusterd_conf_t *priv = NULL; - uuid_t *txn_id = &global_txn_id; + uuid_t *txn_id = NULL; int ret = 0; dict = data; GF_ASSERT (THIS); - priv = THIS->private; + GF_ASSERT (priv); + + txn_id = &priv->global_txn_id; if (priv->timer) { gf_timer_call_cancel (THIS->ctx, priv->timer); diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c index 9af26cfab..18f37c190 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c @@ -575,12 +575,17 @@ __glusterd_cluster_lock_cbk (struct rpc_req *req, struct iovec *iov, glusterd_op_sm_event_type_t event_type = GD_OP_EVENT_NONE; glusterd_peerinfo_t *peerinfo = NULL; xlator_t *this = NULL; - uuid_t *txn_id = &global_txn_id; + uuid_t *txn_id = NULL; + glusterd_conf_t *priv = NULL; this = THIS; GF_ASSERT (this); + priv = this->private; + GF_ASSERT (priv); GF_ASSERT (req); + txn_id = &priv->global_txn_id; + if (-1 == req->rpc_status) { rsp.op_ret = -1; rsp.op_errno = EINVAL; @@ -811,12 +816,17 @@ __glusterd_cluster_unlock_cbk (struct rpc_req *req, struct iovec *iov, glusterd_op_sm_event_type_t event_type = GD_OP_EVENT_NONE; glusterd_peerinfo_t *peerinfo = NULL; xlator_t *this = NULL; - uuid_t *txn_id = &global_txn_id; + uuid_t *txn_id = NULL; + glusterd_conf_t *priv = NULL; this = THIS; GF_ASSERT (this); + priv = this->private; + GF_ASSERT (priv); GF_ASSERT (req); + txn_id = &priv->global_txn_id; + if (-1 == req->rpc_status) { rsp.op_ret = -1; rsp.op_errno = EINVAL; @@ -1403,6 +1413,7 @@ glusterd_vol_lock (call_frame_t *frame, xlator_t *this, glusterd_conf_t *priv = NULL; call_frame_t *dummy_frame = NULL; dict_t *dict = NULL; + uuid_t *txn_id = NULL; if (!this) goto out; @@ -1429,9 +1440,23 @@ glusterd_vol_lock (call_frame_t *frame, xlator_t *this, goto out; } + ret = dict_get_bin (dict, "transaction_id", + (void **)&txn_id); + if (ret) { + gf_log (this->name, GF_LOG_ERROR, + "Failed to get transaction id."); + goto out; + } else { + gf_log (this->name, GF_LOG_DEBUG, + "Transaction_id = %s", uuid_utoa (*txn_id)); + uuid_copy (req.txn_id, *txn_id); + } + dummy_frame = create_frame (this, this->ctx->pool); - if (!dummy_frame) + if (!dummy_frame) { + ret = -1; goto out; + } ret = glusterd_submit_request (peerinfo->rpc, &req, dummy_frame, peerinfo->mgmt_v3, @@ -1453,6 +1478,7 @@ glusterd_vol_unlock (call_frame_t *frame, xlator_t *this, glusterd_conf_t *priv = NULL; call_frame_t *dummy_frame = NULL; dict_t *dict = NULL; + uuid_t *txn_id = NULL; if (!this) goto out; @@ -1479,9 +1505,23 @@ glusterd_vol_unlock (call_frame_t *frame, xlator_t *this, goto out; } + ret = dict_get_bin (dict, "transaction_id", + (void **)&txn_id); + if (ret) { + gf_log (this->name, GF_LOG_ERROR, + "Failed to get transaction id."); + goto out; + } else { + gf_log (this->name, GF_LOG_DEBUG, + "Transaction_id = %s", uuid_utoa (*txn_id)); + uuid_copy (req.txn_id, *txn_id); + } + dummy_frame = create_frame (this, this->ctx->pool); - if (!dummy_frame) + if (!dummy_frame) { + ret = -1; goto out; + } ret = glusterd_submit_request (peerinfo->rpc, &req, dummy_frame, peerinfo->mgmt_v3, @@ -1657,12 +1697,16 @@ __glusterd_brick_op_cbk (struct rpc_req *req, struct iovec *iov, glusterd_req_ctx_t *req_ctx = NULL; glusterd_pending_node_t *node = NULL; xlator_t *this = NULL; - uuid_t *txn_id = &global_txn_id; + uuid_t *txn_id = NULL; + glusterd_conf_t *priv = NULL; this = THIS; GF_ASSERT (this); - + priv = this->private; + GF_ASSERT (priv); GF_ASSERT (req); + + txn_id = &priv->global_txn_id; frame = myframe; req_ctx = frame->local; @@ -1760,7 +1804,7 @@ glusterd_brick_op_cbk (struct rpc_req *req, struct iovec *iov, int32_t glusterd_brick_op (call_frame_t *frame, xlator_t *this, - void *data) + void *data) { gd1_mgmt_brick_op_req *req = NULL; @@ -1773,7 +1817,7 @@ glusterd_brick_op (call_frame_t *frame, xlator_t *this, glusterd_req_ctx_t *req_ctx = NULL; struct rpc_clnt *rpc = NULL; dict_t *op_ctx = NULL; - uuid_t *txn_id = &global_txn_id; + uuid_t *txn_id = NULL; if (!this) { ret = -1; @@ -1782,6 +1826,8 @@ glusterd_brick_op (call_frame_t *frame, xlator_t *this, priv = this->private; GF_ASSERT (priv); + txn_id = &priv->global_txn_id; + req_ctx = data; GF_ASSERT (req_ctx); INIT_LIST_HEAD (&opinfo.pending_bricks); diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c index 5eb5e9f38..578bce897 100644 --- a/xlators/mgmt/glusterd/src/glusterd-syncop.c +++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c @@ -1313,7 +1313,7 @@ out: } int -gd_unlock_op_phase (glusterd_conf_t *conf, glusterd_op_t op, int op_ret, +gd_unlock_op_phase (glusterd_conf_t *conf, glusterd_op_t op, int *op_ret, rpcsvc_request_t *req, dict_t *op_ctx, char *op_errstr, int npeers, char *volname, gf_boolean_t is_acquired, uuid_t txn_id) @@ -1336,8 +1336,10 @@ gd_unlock_op_phase (glusterd_conf_t *conf, glusterd_op_t op, int op_ret, /* If the lock has not been held during this * transaction, do not send unlock requests */ - if (!is_acquired) + if (!is_acquired) { + ret = 0; goto out; + } this = THIS; synctask_barrier_init((&args)); @@ -1376,7 +1378,11 @@ gd_unlock_op_phase (glusterd_conf_t *conf, glusterd_op_t op, int op_ret, } out: - glusterd_op_send_cli_response (op, op_ret, 0, req, op_ctx, op_errstr); + /* If unlock failed, and op_ret was previously set + * priority is given to the op_ret. If op_ret was + * not set, and unlock failed, then set op_ret */ + if (!*op_ret) + *op_ret = ret; if (is_acquired) { /* Based on the op-version, @@ -1397,6 +1403,9 @@ out: } } + if (!*op_ret) + *op_ret = ret; + return 0; } @@ -1486,6 +1495,7 @@ void gd_sync_task_begin (dict_t *op_ctx, rpcsvc_request_t * req) { int ret = -1; + int op_ret = -1; int npeers = 0; dict_t *req_dict = NULL; glusterd_conf_t *conf = NULL; @@ -1504,6 +1514,14 @@ gd_sync_task_begin (dict_t *op_ctx, rpcsvc_request_t * req) conf = this->private; GF_ASSERT (conf); + ret = dict_get_int32 (op_ctx, GD_SYNC_OPCODE_KEY, &tmp_op); + if (ret) { + gf_log (this->name, GF_LOG_ERROR, "Failed to get volume " + "operation"); + goto out; + } + op = tmp_op; + /* Generate a transaction-id for this operation and * save it in the dict */ ret = glusterd_generate_txn_id (op_ctx, &txn_id); @@ -1511,9 +1529,20 @@ gd_sync_task_begin (dict_t *op_ctx, rpcsvc_request_t * req) gf_log (this->name, GF_LOG_ERROR, "Failed to generate transaction id"); goto out; - } + /* Save opinfo for this transaction with the transaction id */ + glusterd_txn_opinfo_init (&txn_opinfo, NULL, &op, NULL, NULL); + ret = glusterd_set_txn_opinfo (txn_id, &txn_opinfo); + if (ret) + gf_log (this->name, GF_LOG_ERROR, + "Unable to set transaction's opinfo"); + + gf_log (this->name, GF_LOG_DEBUG, + "Transaction ID : %s", uuid_utoa (*txn_id)); + + opinfo = txn_opinfo; + /* Save the MY_UUID as the originator_uuid */ ret = glusterd_set_originator_uuid (op_ctx); if (ret) { @@ -1522,15 +1551,6 @@ gd_sync_task_begin (dict_t *op_ctx, rpcsvc_request_t * req) goto out; } - ret = dict_get_int32 (op_ctx, GD_SYNC_OPCODE_KEY, &tmp_op); - if (ret) { - gf_log (this->name, GF_LOG_ERROR, "Failed to get volume " - "operation"); - goto out; - } - - op = tmp_op; - /* Based on the op_version, acquire a cluster or volume lock */ if (conf->op_version < GD_OP_VERSION_4) { ret = glusterd_lock (MY_UUID); @@ -1576,26 +1596,20 @@ gd_sync_task_begin (dict_t *op_ctx, rpcsvc_request_t * req) local_locking_done: - /* Save opinfo for this transaction with the transaction id */ - glusterd_txn_opinfo_init (&txn_opinfo, NULL, &op, NULL, NULL); - ret = glusterd_set_txn_opinfo (txn_id, &txn_opinfo); - if (ret) - gf_log (this->name, GF_LOG_ERROR, - "Unable to set transaction's opinfo"); - - opinfo = txn_opinfo; - INIT_LIST_HEAD (&conf->xaction_peers); npeers = gd_build_peers_list (&conf->peers, &conf->xaction_peers, op); /* If no volname is given as a part of the command, locks will * not be held */ - if (volname) { + if (volname || (conf->op_version < GD_OP_VERSION_4)) { ret = gd_lock_op_phase (conf, op, op_ctx, &op_errstr, npeers, *txn_id); - if (ret) + if (ret) { + gf_log (this->name, GF_LOG_ERROR, + "Locking Peers Failed."); goto out; + } } ret = glusterd_op_build_payload (&req_dict, &op_errstr, op_ctx); @@ -1623,14 +1637,23 @@ local_locking_done: ret = 0; out: - (void) gd_unlock_op_phase (conf, op, ret, req, op_ctx, op_errstr, - npeers, volname, is_acquired, *txn_id); + op_ret = ret; + if (txn_id) { + (void) gd_unlock_op_phase (conf, op, &op_ret, req, + op_ctx, op_errstr, + npeers, volname, + is_acquired, *txn_id); + + /* Clearing the transaction opinfo */ + ret = glusterd_clear_txn_opinfo (txn_id); + if (ret) + gf_log (this->name, GF_LOG_ERROR, + "Unable to clear transaction's " + "opinfo for transaction ID : %s", + uuid_utoa (*txn_id)); + } - /* Clearing the transaction opinfo */ - ret = glusterd_clear_txn_opinfo (txn_id); - if (ret) - gf_log (this->name, GF_LOG_ERROR, - "Unable to clear transaction's opinfo"); + glusterd_op_send_cli_response (op, op_ret, 0, req, op_ctx, op_errstr); if (volname) GF_FREE (volname); diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index 102bd9d8b..86bdc754a 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -1723,6 +1723,7 @@ server_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, glusterd_brickinfo_t *brickinfo = NULL; char changelog_basepath[PATH_MAX] = {0,}; gf_boolean_t quota_enabled = _gf_true; + gf_boolean_t pgfid_feat = _gf_false; char *value = NULL; brickinfo = param; @@ -1749,6 +1750,15 @@ server_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, goto out; } + ret = glusterd_volinfo_get (volinfo, + "update-link-count-parent", + &value); + if (value) { + ret = gf_string2boolean (value, &pgfid_feat); + if (ret) + goto out; + } + xl = volgen_graph_add (graph, "storage/posix", volname); if (!xl) return -1; @@ -1762,9 +1772,9 @@ server_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, if (ret) return -1; - if (quota_enabled) + if (quota_enabled || pgfid_feat) xlator_set_option (xl, "update-link-count-parent", - value); + "on"); ret = check_and_add_debug_xl (graph, set_dict, volname, "posix"); @@ -1973,13 +1983,16 @@ server_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, } /* Check for compress volume option, and add it to the graph on server side */ - if (dict_get_str_boolean (set_dict, "network.compression", 0)) { + ret = dict_get_str_boolean (set_dict, "network.compression", 0); + if (ret == -1) + goto out; + if (ret) { xl = volgen_graph_add (graph, "features/cdc", volname); if (!xl) { ret = -1; goto out; } - ret = dict_set_str (set_dict, "network.compression.mode", "server"); + ret = xlator_set_option (xl, "mode", "server"); if (ret) goto out; } @@ -2298,7 +2311,7 @@ glusterd_get_volopt_content (dict_t * ctx, gf_boolean_t xml_out) int ret = -1; char *def_val = NULL; char *descr = NULL; - char output_string[25600] = {0, }; + char output_string[51200] = {0, }; char *output = NULL; char tmp_str[2048] = {0, }; #if (HAVE_LIB_XML) @@ -2854,16 +2867,18 @@ client_graph_builder (volgen_graph_t *graph, glusterd_volinfo_t *volinfo, goto out; /* Check for compress volume option, and add it to the graph on client side */ - if (dict_get_str_boolean (set_dict, "network.compression", 0)) { + ret = dict_get_str_boolean (set_dict, "network.compression", 0); + if (ret == -1) + goto out; + if (ret) { xl = volgen_graph_add (graph, "features/cdc", volname); if (!xl) { ret = -1; goto out; } - ret = dict_set_str (set_dict, "network.compression.mode", "client"); + ret = xlator_set_option (xl, "mode", "client"); if (ret) goto out; - } ret = glusterd_volinfo_get_boolean (volinfo, "features.encryption"); diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c index 4e3162f01..39bbe0a13 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c @@ -1033,39 +1033,30 @@ struct volopt_map_entry glusterd_volopt_map[] = { */ { .key = "network.compression", .voltype = "features/cdc", + .option = "!feat", .value = "off", - .type = NO_DOC, .op_version = 3, - .description = "enable/disable network compression translator" - }, - { .key = "network.compression.mode", - .voltype = "features/cdc", - .option = "mode", - .type = NO_DOC, - .op_version = 3 + .description = "enable/disable network compression translator", + .flags = OPT_FLAG_XLATOR_OPT }, { .key = "network.compression.window-size", .voltype = "features/cdc", .option = "window-size", - .type = NO_DOC, .op_version = 3 }, { .key = "network.compression.mem-level", .voltype = "features/cdc", .option = "mem-level", - .type = NO_DOC, .op_version = 3 }, { .key = "network.compression.min-size", .voltype = "features/cdc", .option = "min-size", - .type = NO_DOC, .op_version = 3 }, { .key = "network.compression.compression-level", .voltype = "features/cdc", .option = "compression-level", - .type = NO_DOC, .op_version = 3 }, { .key = "network.compression.debug", @@ -1452,6 +1443,11 @@ struct volopt_map_entry glusterd_volopt_map[] = { .voltype = "storage/posix", .op_version = 3 }, + { .option = "update-link-count-parent", + .key = "storage.build-pgfid", + .voltype = "storage/posix", + .op_version = 4 + }, { .key = "storage.bd-aio", .voltype = "storage/bd", .op_version = 3 diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c index 1b04143be..bb2800683 100644 --- a/xlators/mgmt/glusterd/src/glusterd.c +++ b/xlators/mgmt/glusterd/src/glusterd.c @@ -937,6 +937,14 @@ _install_mount_spec (dict_t *opts, char *key, data_t *value, void *data) "adding %smount spec failed: label: %s desc: %s", georep ? GEOREP" " : "", label, pdesc); + if (mspec) { + if (mspec->patterns) { + GF_FREE (mspec->patterns->components); + GF_FREE (mspec->patterns); + } + GF_FREE (mspec); + } + return -1; } @@ -1306,8 +1314,6 @@ init (xlator_t *this) glusterd_friend_sm_init (); glusterd_op_sm_init (); glusterd_opinfo_init (); - glusterd_vol_lock_init (); - glusterd_txn_opinfo_dict_init (); ret = glusterd_sm_tr_log_init (&conf->op_sm_log, glusterd_op_sm_state_name_get, glusterd_op_sm_event_name_get, @@ -1336,6 +1342,8 @@ init (xlator_t *this) } this->private = conf; + glusterd_vol_lock_init (); + glusterd_txn_opinfo_dict_init (); (void) glusterd_nodesvc_set_online_status ("glustershd", _gf_false); GLUSTERD_GET_HOOKS_DIR (hooks_dir, GLUSTERD_HOOK_VER, conf); diff --git a/xlators/mgmt/glusterd/src/glusterd.h b/xlators/mgmt/glusterd/src/glusterd.h index d041be4a2..4a0be5c65 100644 --- a/xlators/mgmt/glusterd/src/glusterd.h +++ b/xlators/mgmt/glusterd/src/glusterd.h @@ -143,6 +143,13 @@ typedef struct { gf_timer_t *timer; glusterd_sm_tr_log_t op_sm_log; struct rpc_clnt_program *gfs_mgmt; + dict_t *vol_lock; /* Dict for saving vol locks */ + dict_t *glusterd_txn_opinfo; /* Dict for saving + * transaction opinfos */ + uuid_t global_txn_id; /* To be used in + * heterogeneous + * cluster with no + * transaction ids */ struct list_head mount_specs; gf_boolean_t valgrind; diff --git a/xlators/mount/fuse/src/fuse-resolve.c b/xlators/mount/fuse/src/fuse-resolve.c index 8565ce0e4..17d76d46b 100644 --- a/xlators/mount/fuse/src/fuse-resolve.c +++ b/xlators/mount/fuse/src/fuse-resolve.c @@ -381,6 +381,8 @@ fuse_migrate_fd_task (void *data) basefd = state->fd; basefd_ctx = fuse_fd_ctx_get (state->this, basefd); + if (!basefd_ctx) + goto out; LOCK (&basefd->lock); { diff --git a/xlators/mount/fuse/utils/mount.glusterfs.in b/xlators/mount/fuse/utils/mount.glusterfs.in index d22f6a69b..b7718b35f 100755 --- a/xlators/mount/fuse/utils/mount.glusterfs.in +++ b/xlators/mount/fuse/utils/mount.glusterfs.in @@ -446,6 +446,13 @@ with_options() "use-readdirp") use_readdirp=$value ;; + "no-root-squash") + if [ $value == "yes" ] || + [ $value == "on" ] || + [ $value == "enable" ] || + [ $value == "true" ] ; then + no_root_squash=1; + fi ;; "root-squash") if [ $value == "no" ] || [ $value == "off" ] || diff --git a/xlators/nfs/server/src/nfs-fops.c b/xlators/nfs/server/src/nfs-fops.c index 60a5a9a84..14bc0f33b 100644 --- a/xlators/nfs/server/src/nfs-fops.c +++ b/xlators/nfs/server/src/nfs-fops.c @@ -317,6 +317,9 @@ nfs_gfid_dict (inode_t *inode) uuid_t rootgfid = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}; dyngfid = GF_CALLOC (1, sizeof (uuid_t), gf_common_mt_char); + if (dyngfid == NULL) + return (NULL); + uuid_generate (newgfid); if (uuid_compare (inode->gfid, rootgfid) == 0) @@ -327,16 +330,17 @@ nfs_gfid_dict (inode_t *inode) dictgfid = dict_new (); if (!dictgfid) { gf_log (GF_NFS, GF_LOG_ERROR, "Failed to create gfid dict"); - goto out; + GF_FREE (dyngfid); + return (NULL); } ret = dict_set_bin (dictgfid, "gfid-req", dyngfid, sizeof (uuid_t)); if (ret < 0) { + GF_FREE (dyngfid); dict_unref (dictgfid); - dictgfid = NULL; + return (NULL); } -out: return dictgfid; } diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c index 054d28c03..8febfc8fb 100644 --- a/xlators/performance/io-cache/src/io-cache.c +++ b/xlators/performance/io-cache/src/io-cache.c @@ -991,6 +991,7 @@ ioc_dispatch_requests (call_frame_t *frame, ioc_inode_t *ioc_inode, fd_t *fd, "out of memory"); local->op_ret = -1; local->op_errno = ENOMEM; + ioc_inode_unlock (ioc_inode); goto out; } } diff --git a/xlators/performance/io-cache/src/page.c b/xlators/performance/io-cache/src/page.c index a21b31816..416cd5fe4 100644 --- a/xlators/performance/io-cache/src/page.c +++ b/xlators/performance/io-cache/src/page.c @@ -136,6 +136,7 @@ int64_t ioc_page_destroy (ioc_page_t *page) { int64_t ret = 0; + struct ioc_inode *inode = NULL; if (page == NULL) { goto out; @@ -143,9 +144,10 @@ ioc_page_destroy (ioc_page_t *page) ioc_inode_lock (page->inode); { + inode = page->inode; ret = __ioc_page_destroy (page); } - ioc_inode_unlock (page->inode); + ioc_inode_unlock (inode); out: return ret; @@ -1032,6 +1034,7 @@ ioc_waitq_t * ioc_page_error (ioc_page_t *page, int32_t op_ret, int32_t op_errno) { ioc_waitq_t *waitq = NULL; + struct ioc_inode *inode = NULL; if (page == NULL) { goto out; @@ -1039,9 +1042,10 @@ ioc_page_error (ioc_page_t *page, int32_t op_ret, int32_t op_errno) ioc_inode_lock (page->inode); { + inode = page->inode; waitq = __ioc_page_error (page, op_ret, op_errno); } - ioc_inode_unlock (page->inode); + ioc_inode_unlock (inode); out: return waitq; diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c index 4dd7a9973..8201a95a4 100644 --- a/xlators/performance/io-threads/src/io-threads.c +++ b/xlators/performance/io-threads/src/io-threads.c @@ -14,6 +14,7 @@ #endif #include "call-stub.h" +#include "defaults.h" #include "glusterfs.h" #include "logging.h" #include "dict.h" @@ -29,6 +30,28 @@ int iot_workers_scale (iot_conf_t *conf); int __iot_workers_scale (iot_conf_t *conf); struct volume_options options[]; +#define IOT_FOP(name, frame, this, args ...) \ + do { \ + call_stub_t *__stub = NULL; \ + int __ret = -1; \ + \ + __stub = fop_##name##_stub(frame, default_##name##_resume, args); \ + if (!__stub) { \ + __ret = -ENOMEM; \ + goto out; \ + } \ + \ + __ret = iot_schedule (frame, this, __stub); \ + \ + out: \ + if (__ret < 0) { \ + default_##name##_failure_cbk (frame, -__ret); \ + if (__stub != NULL) { \ + call_stub_destroy (__stub); \ + } \ + } \ + } while (0) + call_stub_t * __iot_dequeue (iot_conf_t *conf, int *pri, struct timespec *sleep) { @@ -331,77 +354,9 @@ out: } int -iot_lookup_cbk (call_frame_t *frame, void * cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, - inode_t *inode, struct iatt *buf, dict_t *xdata, - struct iatt *postparent) -{ - STACK_UNWIND_STRICT (lookup, frame, op_ret, op_errno, inode, buf, xdata, - postparent); - return 0; -} - - -int -iot_lookup_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *xdata) -{ - STACK_WIND (frame, iot_lookup_cbk, - FIRST_CHILD (this), - FIRST_CHILD (this)->fops->lookup, - loc, xdata); - return 0; -} - - -int iot_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_lookup_stub (frame, iot_lookup_wrapper, loc, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, - "cannot create lookup stub (out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - if (stub != NULL) { - call_stub_destroy (stub); - } - STACK_UNWIND_STRICT (lookup, frame, -1, -ret, NULL, NULL, NULL, - NULL); - } - - return 0; -} - - -int -iot_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, - struct iatt *preop, struct iatt *postop, dict_t *xdata) -{ - STACK_UNWIND_STRICT (setattr, frame, op_ret, op_errno, preop, postop, - xdata); - return 0; -} - - -int -iot_setattr_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, - struct iatt *stbuf, int32_t valid, dict_t *xdata) -{ - STACK_WIND (frame, iot_setattr_cbk, - FIRST_CHILD (this), - FIRST_CHILD (this)->fops->setattr, - loc, stbuf, valid, xdata); + IOT_FOP (lookup, frame, this, loc, xdata); return 0; } @@ -410,51 +365,7 @@ int iot_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, struct iatt *stbuf, int32_t valid, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_setattr_stub (frame, iot_setattr_wrapper, loc, stbuf, valid, - xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "Cannot create setattr stub" - "(Out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - if (stub != NULL) { - call_stub_destroy (stub); - } - - STACK_UNWIND_STRICT (setattr, frame, -1, -ret, NULL, NULL, NULL); - } - - return 0; -} - - -int -iot_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, - struct iatt *preop, struct iatt *postop, dict_t *xdata) -{ - STACK_UNWIND_STRICT (fsetattr, frame, op_ret, op_errno, preop, postop, - xdata); - return 0; -} - - -int -iot_fsetattr_wrapper (call_frame_t *frame, xlator_t *this, - fd_t *fd, struct iatt *stbuf, int32_t valid, dict_t *xdata) -{ - STACK_WIND (frame, iot_fsetattr_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->fsetattr, fd, stbuf, valid, - xdata); + IOT_FOP (setattr, frame, this, loc, stbuf, valid, xdata); return 0; } @@ -463,47 +374,7 @@ int iot_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iatt *stbuf, int32_t valid, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_fsetattr_stub (frame, iot_fsetattr_wrapper, fd, stbuf, - valid, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create fsetattr stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (fsetattr, frame, -1, -ret, NULL, NULL, - NULL); - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (access, frame, op_ret, op_errno, xdata); - return 0; -} - - -int -iot_access_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t mask, dict_t *xdata) -{ - STACK_WIND (frame, iot_access_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->access, loc, mask, xdata); + IOT_FOP (fsetattr, frame, this, fd, stbuf, valid, xdata); return 0; } @@ -512,49 +383,7 @@ int iot_access (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_access_stub (frame, iot_access_wrapper, loc, mask, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create access stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (access, frame, -1, -ret, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, const char *path, - struct iatt *stbuf, dict_t *xdata) -{ - STACK_UNWIND_STRICT (readlink, frame, op_ret, op_errno, path, stbuf, - xdata); - return 0; -} - - -int -iot_readlink_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, - size_t size, dict_t *xdata) -{ - STACK_WIND (frame, iot_readlink_cbk, - FIRST_CHILD (this), - FIRST_CHILD (this)->fops->readlink, - loc, size, xdata); + IOT_FOP (access, frame, this, loc, mask, xdata); return 0; } @@ -562,51 +391,7 @@ iot_readlink_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, int iot_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_readlink_stub (frame, iot_readlink_wrapper, loc, size, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create readlink stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (readlink, frame, -1, -ret, NULL, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - - return 0; -} - - -int -iot_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, inode_t *inode, - struct iatt *buf, struct iatt *preparent, - struct iatt *postparent, dict_t *xdata) -{ - STACK_UNWIND_STRICT (mknod, frame, op_ret, op_errno, inode, buf, - preparent, postparent, xdata); - return 0; -} - - -int -iot_mknod_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, - dev_t rdev, mode_t umask, dict_t *xdata) -{ - STACK_WIND (frame, iot_mknod_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->mknod, loc, mode, rdev, umask, - xdata); + IOT_FOP (readlink, frame, this, loc, size, xdata); return 0; } @@ -615,51 +400,7 @@ int iot_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, dev_t rdev, mode_t umask, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_mknod_stub (frame, iot_mknod_wrapper, loc, mode, rdev, - umask, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create mknod stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (mknod, frame, -1, -ret, NULL, NULL, NULL, - NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_mkdir_cbk (call_frame_t *frame, void * cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, inode_t *inode, - struct iatt *buf, struct iatt *preparent, - struct iatt *postparent, dict_t *xdata) -{ - STACK_UNWIND_STRICT (mkdir, frame, op_ret, op_errno, inode, buf, - preparent, postparent, xdata); - return 0; -} - - -int -iot_mkdir_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, - mode_t umask, dict_t *xdata) -{ - STACK_WIND (frame, iot_mkdir_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->mkdir, loc, mode, umask, xdata); + IOT_FOP (mknod, frame, this, loc, mode, rdev, umask, xdata); return 0; } @@ -668,49 +409,7 @@ int iot_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, mode_t umask, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_mkdir_stub (frame, iot_mkdir_wrapper, loc, mode, umask, - xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create mkdir stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (mkdir, frame, -1, -ret, NULL, NULL, NULL, - NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct iatt *preparent, - struct iatt *postparent, dict_t *xdata) -{ - STACK_UNWIND_STRICT (rmdir, frame, op_ret, op_errno, preparent, - postparent, xdata); - return 0; -} - - -int -iot_rmdir_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, dict_t *xdata) -{ - STACK_WIND (frame, iot_rmdir_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->rmdir, loc, flags, xdata); + IOT_FOP (mkdir, frame, this, loc, mode, umask, xdata); return 0; } @@ -718,49 +417,7 @@ iot_rmdir_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, d int iot_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_rmdir_stub (frame, iot_rmdir_wrapper, loc, flags, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create rmdir stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (rmdir, frame, -1, -ret, NULL, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_symlink_cbk (call_frame_t *frame, void * cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, inode_t *inode, - struct iatt *buf, struct iatt *preparent, - struct iatt *postparent, dict_t *xdata) -{ - STACK_UNWIND_STRICT (symlink, frame, op_ret, op_errno, inode, buf, - preparent, postparent, xdata); - return 0; -} - - -int -iot_symlink_wrapper (call_frame_t *frame, xlator_t *this, const char *linkname, - loc_t *loc, mode_t umask, dict_t *xdata) -{ - STACK_WIND (frame, iot_symlink_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->symlink, linkname, loc, umask, - xdata); + IOT_FOP (rmdir, frame, this, loc, flags, xdata); return 0; } @@ -769,52 +426,7 @@ int iot_symlink (call_frame_t *frame, xlator_t *this, const char *linkname, loc_t *loc, mode_t umask, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_symlink_stub (frame, iot_symlink_wrapper, linkname, loc, - umask, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create symlink stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (symlink, frame, -1, -ret, NULL, NULL, NULL, - NULL, NULL); - if (stub != NULL) { - call_stub_destroy (stub); - } - } - - return 0; -} - - -int -iot_rename_cbk (call_frame_t *frame, void * cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct iatt *buf, - struct iatt *preoldparent, struct iatt *postoldparent, - struct iatt *prenewparent, struct iatt *postnewparent, - dict_t *xdata) -{ - STACK_UNWIND_STRICT (rename, frame, op_ret, op_errno, buf, preoldparent, - postoldparent, prenewparent, postnewparent, xdata); - return 0; -} - - -int -iot_rename_wrapper (call_frame_t *frame, xlator_t *this, loc_t *oldloc, - loc_t *newloc, dict_t *xdata) -{ - STACK_WIND (frame, iot_rename_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->rename, oldloc, newloc, xdata); + IOT_FOP (symlink, frame, this, linkname, loc, umask, xdata); return 0; } @@ -823,106 +435,17 @@ int iot_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_rename_stub (frame, iot_rename_wrapper, oldloc, newloc, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_DEBUG, "cannot create rename stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (rename, frame, -1, -ret, NULL, NULL, NULL, - NULL, NULL, NULL); - if (stub != NULL) { - call_stub_destroy (stub); - } - } - + IOT_FOP (rename, frame, this, oldloc, newloc, xdata); return 0; } int -iot_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, - int32_t op_errno, fd_t *fd, dict_t *xdata) -{ - STACK_UNWIND_STRICT (open, frame, op_ret, op_errno, fd, xdata); - return 0; -} - - -int -iot_open_wrapper (call_frame_t * frame, xlator_t * this, loc_t *loc, - int32_t flags, fd_t * fd, dict_t *xdata) -{ - STACK_WIND (frame, iot_open_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->open, loc, flags, fd, - xdata); - return 0; -} - - -int iot_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, fd_t *fd, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_open_stub (frame, iot_open_wrapper, loc, flags, fd, - xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, - "cannot create open call stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (open, frame, -1, -ret, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - - return 0; -} - - -int -iot_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, fd_t *fd, inode_t *inode, - struct iatt *stbuf, struct iatt *preparent, - struct iatt *postparent, dict_t *xdata) -{ - STACK_UNWIND_STRICT (create, frame, op_ret, op_errno, fd, inode, stbuf, - preparent, postparent, xdata); - return 0; -} - - -int -iot_create_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t flags, mode_t mode, mode_t umask, fd_t *fd, - dict_t *xdata) -{ - STACK_WIND (frame, iot_create_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->create, - loc, flags, mode, umask, fd, xdata); - return 0; + IOT_FOP (open, frame, this, loc, flags, fd, xdata); + return 0; } @@ -930,159 +453,25 @@ int iot_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, mode_t mode, mode_t umask, fd_t *fd, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_create_stub (frame, iot_create_wrapper, loc, flags, mode, - umask, fd, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, - "cannot create \"create\" call stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (create, frame, -1, -ret, NULL, NULL, NULL, - NULL, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - + IOT_FOP (create, frame, this, loc, flags, mode, umask, fd, xdata); return 0; } int -iot_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct iovec *vector, - int32_t count, struct iatt *stbuf, struct iobref *iobref, - dict_t *xdata) -{ - STACK_UNWIND_STRICT (readv, frame, op_ret, op_errno, vector, count, - stbuf, iobref, xdata); - - return 0; -} - - -int -iot_readv_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, - off_t offset, uint32_t flags, dict_t *xdata) -{ - STACK_WIND (frame, iot_readv_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->readv, - fd, size, offset, flags, xdata); - return 0; -} - - -int iot_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, off_t offset, uint32_t flags, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_readv_stub (frame, iot_readv_wrapper, fd, size, offset, - flags, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, - "cannot create readv call stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (readv, frame, -1, -ret, NULL, -1, NULL, - NULL, NULL); - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (flush, frame, op_ret, op_errno, xdata); - return 0; -} - - -int -iot_flush_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) -{ - STACK_WIND (frame, iot_flush_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->flush, - fd, xdata); - return 0; + IOT_FOP (readv, frame, this, fd, size, offset, flags, xdata); + return 0; } int iot_flush (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_flush_stub (frame, iot_flush_wrapper, fd, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, - "cannot create flush_cbk call stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (flush, frame, -1, -ret, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct iatt *prebuf, - struct iatt *postbuf, dict_t *xdata) -{ - STACK_UNWIND_STRICT (fsync, frame, op_ret, op_errno, prebuf, postbuf, - xdata); - return 0; -} - - -int -iot_fsync_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, - int32_t datasync, dict_t *xdata) -{ - STACK_WIND (frame, iot_fsync_cbk, - FIRST_CHILD (this), - FIRST_CHILD (this)->fops->fsync, - fd, datasync, xdata); - return 0; + IOT_FOP (flush, frame, this, fd, xdata); + return 0; } @@ -1090,54 +479,8 @@ int iot_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t datasync, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_fsync_stub (frame, iot_fsync_wrapper, fd, datasync, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, - "cannot create fsync_cbk call stub" - "(out of memory)"); - ret = -1; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (fsync, frame, -1, -ret, NULL, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct iatt *prebuf, - struct iatt *postbuf, dict_t *xdata) -{ - STACK_UNWIND_STRICT (writev, frame, op_ret, op_errno, prebuf, postbuf, - xdata); - return 0; -} - - -int -iot_writev_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, - struct iovec *vector, int32_t count, - off_t offset, uint32_t flags, struct iobref *iobref, - dict_t *xdata) -{ - STACK_WIND (frame, iot_writev_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->writev, - fd, vector, count, offset, flags, iobref, xdata); - return 0; + IOT_FOP (fsync, frame, this, fd, datasync, xdata); + return 0; } @@ -1146,53 +489,9 @@ iot_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector, int32_t count, off_t offset, uint32_t flags, struct iobref *iobref, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_writev_stub (frame, iot_writev_wrapper, fd, vector, - count, offset, flags, iobref, xdata); - - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, - "cannot create writev call stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (writev, frame, -1, -ret, NULL, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - - return 0; -} - - -int32_t -iot_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct gf_flock *flock, - dict_t *xdata) -{ - STACK_UNWIND_STRICT (lk, frame, op_ret, op_errno, flock, xdata); - return 0; -} - - -int -iot_lk_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, - int32_t cmd, struct gf_flock *flock, dict_t *xdata) -{ - STACK_WIND (frame, iot_lk_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->lk, - fd, cmd, flock, xdata); - return 0; + IOT_FOP (writev, frame, this, fd, vector, count, offset, + flags, iobref, xdata); + return 0; } @@ -1200,149 +499,24 @@ int iot_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd, struct gf_flock *flock, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_lk_stub (frame, iot_lk_wrapper, fd, cmd, flock, xdata); - - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, - "cannot create fop_lk call stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (lk, frame, -1, -ret, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct iatt *buf, dict_t *xdata) -{ - STACK_UNWIND_STRICT (stat, frame, op_ret, op_errno, buf, xdata); - return 0; -} - - -int -iot_stat_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) -{ - STACK_WIND (frame, iot_stat_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->stat, - loc, xdata); - return 0; + IOT_FOP (lk, frame, this, fd, cmd, flock, xdata); + return 0; } int iot_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_stat_stub (frame, iot_stat_wrapper, loc, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, - "cannot create fop_stat call stub" - "(out of memory)"); - ret = -1; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (stat, frame, -1, -ret, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct iatt *buf, dict_t *xdata) -{ - STACK_UNWIND_STRICT (fstat, frame, op_ret, op_errno, buf, xdata); - return 0; -} - - -int -iot_fstat_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) -{ - STACK_WIND (frame, iot_fstat_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->fstat, - fd, xdata); - return 0; + IOT_FOP (stat, frame, this, loc, xdata); + return 0; } int iot_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_fstat_stub (frame, iot_fstat_wrapper, fd, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, - "cannot create fop_fstat call stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (fstat, frame, -1, -ret, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct iatt *prebuf, - struct iatt *postbuf, dict_t *xdata) -{ - STACK_UNWIND_STRICT (truncate, frame, op_ret, op_errno, prebuf, - postbuf, xdata); - return 0; -} - - -int -iot_truncate_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, - off_t offset, dict_t *xdata) -{ - STACK_WIND (frame, iot_truncate_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->truncate, - loc, offset, xdata); - return 0; + IOT_FOP (fstat, frame, this, fd, xdata); + return 0; } @@ -1350,55 +524,8 @@ int iot_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset, dict_t *xdata) { - call_stub_t *stub; - int ret = -1; - - stub = fop_truncate_stub (frame, iot_truncate_wrapper, loc, offset, - xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, - "cannot create fop_stat call stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (truncate, frame, -1, -ret, NULL, NULL, - NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - - return 0; -} - - -int -iot_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct iatt *prebuf, - struct iatt *postbuf, dict_t *xdata) -{ - STACK_UNWIND_STRICT (ftruncate, frame, op_ret, op_errno, prebuf, - postbuf, xdata); - return 0; -} - - -int -iot_ftruncate_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, - off_t offset, dict_t *xdata) -{ - STACK_WIND (frame, iot_ftruncate_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->ftruncate, - fd, offset, xdata); - return 0; + IOT_FOP (truncate, frame, this, loc, offset, xdata); + return 0; } @@ -1406,106 +533,17 @@ int iot_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_ftruncate_stub (frame, iot_ftruncate_wrapper, fd, offset, - xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, - "cannot create fop_ftruncate call stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (ftruncate, frame, -1, -ret, NULL, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - - -int -iot_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct iatt *preparent, - struct iatt *postparent, dict_t *xdata) -{ - STACK_UNWIND_STRICT (unlink, frame, op_ret, op_errno, preparent, - postparent, xdata); - return 0; + IOT_FOP (ftruncate, frame, this, fd, offset, xdata); + return 0; } -int -iot_unlink_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, - int32_t xflag, dict_t *xdata) -{ - STACK_WIND (frame, iot_unlink_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->unlink, - loc, xflag, xdata); - return 0; -} - int iot_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t xflag, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_unlink_stub (frame, iot_unlink_wrapper, loc, xflag, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, - "cannot create fop_unlink call stub" - "(out of memory)"); - ret = -1; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (unlink, frame, -1, -ret, NULL, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - - return 0; -} - - -int -iot_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, inode_t *inode, - struct iatt *buf, struct iatt *preparent, struct iatt *postparent, - dict_t *xdata) -{ - STACK_UNWIND_STRICT (link, frame, op_ret, op_errno, inode, buf, - preparent, postparent, xdata); - return 0; -} - - -int -iot_link_wrapper (call_frame_t *frame, xlator_t *this, loc_t *old, loc_t *new, - dict_t *xdata) -{ - STACK_WIND (frame, iot_link_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->link, old, new, xdata); - + IOT_FOP (unlink, frame, this, loc, xflag, xdata); return 0; } @@ -1514,46 +552,7 @@ int iot_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_link_stub (frame, iot_link_wrapper, oldloc, newloc, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create link stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (link, frame, -1, -ret, NULL, NULL, NULL, - NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata) -{ - STACK_UNWIND_STRICT (opendir, frame, op_ret, op_errno, fd, xdata); - return 0; -} - - -int -iot_opendir_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd, - dict_t *xdata) -{ - STACK_WIND (frame, iot_opendir_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->opendir, loc, fd, xdata); + IOT_FOP (link, frame, this, oldloc, newloc, xdata); return 0; } @@ -1562,45 +561,7 @@ int iot_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_opendir_stub (frame, iot_opendir_wrapper, loc, fd, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create opendir stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (opendir, frame, -1, -ret, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_fsyncdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (fsyncdir, frame, op_ret, op_errno, xdata); - return 0; -} - - -int -iot_fsyncdir_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, - int datasync, dict_t *xdata) -{ - STACK_WIND (frame, iot_fsyncdir_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->fsyncdir, fd, datasync, xdata); + IOT_FOP (opendir, frame, this, loc, fd, xdata); return 0; } @@ -1609,47 +570,7 @@ int iot_fsyncdir (call_frame_t *frame, xlator_t *this, fd_t *fd, int datasync, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_fsyncdir_stub (frame, iot_fsyncdir_wrapper, fd, datasync, - xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create fsyncdir stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (fsyncdir, frame, -1, -ret, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct statvfs *buf, - dict_t *xdata) -{ - STACK_UNWIND_STRICT (statfs, frame, op_ret, op_errno, buf, xdata); - return 0; -} - - -int -iot_statfs_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *xdata) -{ - STACK_WIND (frame, iot_statfs_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->statfs, loc, xdata); + IOT_FOP (fsyncdir, frame, this, fd, datasync, xdata); return 0; } @@ -1657,45 +578,7 @@ iot_statfs_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, int iot_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_statfs_stub (frame, iot_statfs_wrapper, loc, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create statfs stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (statfs, frame, -1, -ret, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (setxattr, frame, op_ret, op_errno, xdata); - return 0; -} - - -int -iot_setxattr_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, - dict_t *dict, int32_t flags, dict_t *xdata) -{ - STACK_WIND (frame, iot_setxattr_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->setxattr, loc, dict, flags, xdata); + IOT_FOP (statfs, frame, this, loc, xdata); return 0; } @@ -1704,47 +587,7 @@ int iot_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict, int32_t flags, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_setxattr_stub (frame, iot_setxattr_wrapper, loc, dict, - flags, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create setxattr stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (setxattr, frame, -1, -ret, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *dict, dict_t *xdata) -{ - STACK_UNWIND_STRICT (getxattr, frame, op_ret, op_errno, dict, xdata); - return 0; -} - - -int -iot_getxattr_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, - const char *name, dict_t *xdata) -{ - STACK_WIND (frame, iot_getxattr_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->getxattr, loc, name, xdata); + IOT_FOP (setxattr, frame, this, loc, dict, flags, xdata); return 0; } @@ -1753,47 +596,7 @@ int iot_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, const char *name, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_getxattr_stub (frame, iot_getxattr_wrapper, loc, name, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create getxattr stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (getxattr, frame, -1, -ret, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_fgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *dict, - dict_t *xdata) -{ - STACK_UNWIND_STRICT (fgetxattr, frame, op_ret, op_errno, dict, xdata); - return 0; -} - - -int -iot_fgetxattr_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, - const char *name, dict_t *xdata) -{ - STACK_WIND (frame, iot_fgetxattr_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->fgetxattr, fd, name, xdata); + IOT_FOP (getxattr, frame, this, loc, name, xdata); return 0; } @@ -1802,46 +605,7 @@ int iot_fgetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, const char *name, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_fgetxattr_stub (frame, iot_fgetxattr_wrapper, fd, name, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create fgetxattr stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (fgetxattr, frame, -1, -ret, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (fsetxattr, frame, op_ret, op_errno, xdata); - return 0; -} - - -int -iot_fsetxattr_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, - dict_t *dict, int32_t flags, dict_t *xdata) -{ - STACK_WIND (frame, iot_fsetxattr_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->fsetxattr, fd, dict, flags, - xdata); + IOT_FOP (fgetxattr, frame, this, fd, name, xdata); return 0; } @@ -1850,46 +614,7 @@ int iot_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *dict, int32_t flags, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_fsetxattr_stub (frame, iot_fsetxattr_wrapper, fd, dict, - flags, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create fsetxattr stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (fsetxattr, frame, -1, -ret, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (removexattr, frame, op_ret, op_errno, xdata); - return 0; -} - - -int -iot_removexattr_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, - const char *name, dict_t *xdata) -{ - STACK_WIND (frame, iot_removexattr_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->removexattr, loc, name, xdata); + IOT_FOP (fsetxattr, frame, this, fd, dict, flags, xdata); return 0; } @@ -1898,94 +623,15 @@ int iot_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc, const char *name, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_removexattr_stub (frame, iot_removexattr_wrapper, loc, - name, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR,"cannot get removexattr fop" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (removexattr, frame, -1, -ret, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - -int -iot_fremovexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (fremovexattr, frame, op_ret, op_errno, xdata); - return 0; -} - - -int -iot_fremovexattr_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, - const char *name, dict_t *xdata) -{ - STACK_WIND (frame, iot_fremovexattr_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->fremovexattr, fd, name, xdata); + IOT_FOP (removexattr, frame, this, loc, name, xdata); return 0; } - int iot_fremovexattr (call_frame_t *frame, xlator_t *this, fd_t *fd, const char *name, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_fremovexattr_stub (frame, iot_fremovexattr_wrapper, fd, - name, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR,"cannot get fremovexattr fop" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (fremovexattr, frame, -1, -ret, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, gf_dirent_t *entries, - dict_t *xdata) -{ - STACK_UNWIND_STRICT (readdirp, frame, op_ret, op_errno, entries, xdata); - return 0; -} - - -int -iot_readdirp_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, - size_t size, off_t offset, dict_t *xdata) -{ - STACK_WIND (frame, iot_readdirp_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->readdirp, fd, size, offset, xdata); + IOT_FOP (fremovexattr, frame, this, fd, name, xdata); return 0; } @@ -1994,47 +640,7 @@ int iot_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, off_t offset, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_readdirp_stub (frame, iot_readdirp_wrapper, fd, size, - offset, xdata); - if (!stub) { - gf_log (this->private, GF_LOG_ERROR,"cannot get readdir stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (readdirp, frame, -1, -ret, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, gf_dirent_t *entries, - dict_t *xdata) -{ - STACK_UNWIND_STRICT (readdir, frame, op_ret, op_errno, entries, xdata); - return 0; -} - - -int -iot_readdir_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, - size_t size, off_t offset, dict_t *xdata) -{ - STACK_WIND (frame, iot_readdir_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->readdir, fd, size, offset, xdata); + IOT_FOP (readdirp, frame, this, fd, size, offset, xdata); return 0; } @@ -2043,244 +649,43 @@ int iot_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, off_t offset, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_readdir_stub (frame, iot_readdir_wrapper, fd, size, offset, - xdata); - if (!stub) { - gf_log (this->private, GF_LOG_ERROR,"cannot get readdir stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (readdir, frame, -1, -ret, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } + IOT_FOP (readdir, frame, this, fd, size, offset, xdata); return 0; } int -iot_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (inodelk, frame, op_ret, op_errno, xdata); - return 0; -} - - -int -iot_inodelk_wrapper (call_frame_t *frame, xlator_t *this, const char *volume, - loc_t *loc, int32_t cmd, struct gf_flock *lock, - dict_t *xdata) -{ - STACK_WIND (frame, iot_inodelk_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->inodelk, volume, loc, cmd, lock, - xdata); - return 0; -} - - -int iot_inodelk (call_frame_t *frame, xlator_t *this, const char *volume, loc_t *loc, int32_t cmd, struct gf_flock *lock, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_inodelk_stub (frame, iot_inodelk_wrapper, - volume, loc, cmd, lock, xdata); - if (!stub) { - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (inodelk, frame, -1, -ret, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - -int -iot_finodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (finodelk, frame, op_ret, op_errno, xdata); + IOT_FOP (inodelk, frame, this, volume, loc, cmd, lock, xdata); return 0; } - -int -iot_finodelk_wrapper (call_frame_t *frame, xlator_t *this, - const char *volume, fd_t *fd, int32_t cmd, - struct gf_flock *lock, dict_t *xdata) -{ - STACK_WIND (frame, iot_finodelk_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->finodelk, volume, fd, cmd, lock, - xdata); - return 0; -} - - int iot_finodelk (call_frame_t *frame, xlator_t *this, const char *volume, fd_t *fd, int32_t cmd, struct gf_flock *lock, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_finodelk_stub (frame, iot_finodelk_wrapper, - volume, fd, cmd, lock, xdata); - if (!stub) { - gf_log (this->private, GF_LOG_ERROR,"cannot get finodelk stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (finodelk, frame, -1, -ret, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - -int -iot_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (entrylk, frame, op_ret, op_errno, xdata); - return 0; -} - - -int -iot_entrylk_wrapper (call_frame_t *frame, xlator_t *this, - const char *volume, loc_t *loc, const char *basename, - entrylk_cmd cmd, entrylk_type type, dict_t *xdata) -{ - STACK_WIND (frame, iot_entrylk_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->entrylk, - volume, loc, basename, cmd, type, xdata); + IOT_FOP (finodelk, frame, this, volume, fd, cmd, lock, xdata); return 0; } - int iot_entrylk (call_frame_t *frame, xlator_t *this, const char *volume, loc_t *loc, const char *basename, entrylk_cmd cmd, entrylk_type type, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_entrylk_stub (frame, iot_entrylk_wrapper, - volume, loc, basename, cmd, type, xdata); - if (!stub) { - gf_log (this->private, GF_LOG_ERROR,"cannot get entrylk stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (entrylk, frame, -1, -ret, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - -int -iot_fentrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (fentrylk, frame, op_ret, op_errno, xdata); - return 0; -} - - -int -iot_fentrylk_wrapper (call_frame_t *frame, xlator_t *this, - const char *volume, fd_t *fd, const char *basename, - entrylk_cmd cmd, entrylk_type type, dict_t *xdata) -{ - STACK_WIND (frame, iot_fentrylk_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->fentrylk, - volume, fd, basename, cmd, type, xdata); + IOT_FOP (entrylk, frame, this, volume, loc, basename, cmd, type, xdata); return 0; } - int iot_fentrylk (call_frame_t *frame, xlator_t *this, const char *volume, fd_t *fd, const char *basename, entrylk_cmd cmd, entrylk_type type, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_fentrylk_stub (frame, iot_fentrylk_wrapper, - volume, fd, basename, cmd, type, xdata); - if (!stub) { - gf_log (this->private, GF_LOG_ERROR,"cannot get fentrylk stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (fentrylk, frame, -1, -ret, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xattr, dict_t *xdata) -{ - STACK_UNWIND_STRICT (xattrop, frame, op_ret, op_errno, xattr, xdata); - return 0; -} - - -int -iot_xattrop_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, - gf_xattrop_flags_t optype, dict_t *xattr, dict_t *xdata) -{ - STACK_WIND (frame, iot_xattrop_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->xattrop, loc, optype, xattr, xdata); + IOT_FOP (fentrylk, frame, this, volume, fd, basename, cmd, type, xdata); return 0; } @@ -2289,45 +694,7 @@ int iot_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc, gf_xattrop_flags_t optype, dict_t *xattr, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_xattrop_stub (frame, iot_xattrop_wrapper, loc, optype, - xattr, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create xattrop stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (xattrop, frame, -1, -ret, NULL, NULL); - - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int -iot_fxattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xattr, dict_t *xdata) -{ - STACK_UNWIND_STRICT (fxattrop, frame, op_ret, op_errno, xattr, xdata); - return 0; -} - -int -iot_fxattrop_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, - gf_xattrop_flags_t optype, dict_t *xattr, dict_t *xdata) -{ - STACK_WIND (frame, iot_fxattrop_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->fxattrop, fd, optype, xattr, xdata); + IOT_FOP (xattrop, frame, this, loc, optype, xattr, xdata); return 0; } @@ -2336,47 +703,7 @@ int iot_fxattrop (call_frame_t *frame, xlator_t *this, fd_t *fd, gf_xattrop_flags_t optype, dict_t *xattr, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_fxattrop_stub (frame, iot_fxattrop_wrapper, fd, optype, - xattr, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create fxattrop stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (fxattrop, frame, -1, -ret, NULL, NULL); - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - - -int32_t -iot_rchecksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, uint32_t weak_checksum, - uint8_t *strong_checksum, dict_t *xdata) -{ - STACK_UNWIND_STRICT (rchecksum, frame, op_ret, op_errno, weak_checksum, - strong_checksum, xdata); - return 0; -} - - -int32_t -iot_rchecksum_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd, - off_t offset, int32_t len, dict_t *xdata) -{ - STACK_WIND (frame, iot_rchecksum_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->rchecksum, fd, offset, len, xdata); + IOT_FOP (fxattrop, frame, this, fd, optype, xattr, xdata); return 0; } @@ -2385,147 +712,23 @@ int32_t iot_rchecksum (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, int32_t len, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_rchecksum_stub (frame, iot_rchecksum_wrapper, fd, offset, - len, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create rchecksum stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); -out: - if (ret < 0) { - STACK_UNWIND_STRICT (rchecksum, frame, -1, -ret, -1, NULL, NULL); - if (stub != NULL) { - call_stub_destroy (stub); - } - } - - return 0; -} - -int -iot_fallocate_cbk(call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, - struct iatt *preop, struct iatt *postop, dict_t *xdata) -{ - STACK_UNWIND_STRICT (fallocate, frame, op_ret, op_errno, preop, postop, - xdata); - return 0; -} - - -int -iot_fallocate_wrapper(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode, - off_t offset, size_t len, dict_t *xdata) -{ - STACK_WIND (frame, iot_fallocate_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->fallocate, fd, mode, offset, len, - xdata); + IOT_FOP (rchecksum, frame, this, fd, offset, len, xdata); return 0; } - int iot_fallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t mode, off_t offset, size_t len, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_fallocate_stub(frame, iot_fallocate_wrapper, fd, mode, offset, - len, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create fallocate stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (fallocate, frame, -1, -ret, NULL, NULL, - NULL); - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - -int -iot_discard_cbk(call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, - struct iatt *preop, struct iatt *postop, dict_t *xdata) -{ - STACK_UNWIND_STRICT (discard, frame, op_ret, op_errno, preop, postop, - xdata); - return 0; -} - - -int -iot_discard_wrapper(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, - size_t len, dict_t *xdata) -{ - STACK_WIND (frame, iot_discard_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->discard, fd, offset, len, xdata); + IOT_FOP (fallocate, frame, this, fd, mode, offset, len, xdata); return 0; } - int iot_discard(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, size_t len, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_discard_stub(frame, iot_discard_wrapper, fd, offset, len, - xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create discard stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (discard, frame, -1, -ret, NULL, NULL, - NULL); - if (stub != NULL) { - call_stub_destroy (stub); - } - } - return 0; -} - -int -iot_zerofill_cbk(call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, - struct iatt *preop, struct iatt *postop, dict_t *xdata) -{ - STACK_UNWIND_STRICT (zerofill, frame, op_ret, op_errno, preop, postop, - xdata); - return 0; -} - -int -iot_zerofill_wrapper(call_frame_t *frame, xlator_t *this, fd_t *fd, - off_t offset, off_t len, dict_t *xdata) -{ - STACK_WIND (frame, iot_zerofill_cbk, FIRST_CHILD (this), - FIRST_CHILD (this)->fops->zerofill, fd, offset, len, xdata); + IOT_FOP (discard, frame, this, fd, offset, len, xdata); return 0; } @@ -2533,28 +736,7 @@ int iot_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, off_t len, dict_t *xdata) { - call_stub_t *stub = NULL; - int ret = -1; - - stub = fop_zerofill_stub(frame, iot_zerofill_wrapper, fd, - offset, len, xdata); - if (!stub) { - gf_log (this->name, GF_LOG_ERROR, "cannot create zerofill stub" - "(out of memory)"); - ret = -ENOMEM; - goto out; - } - - ret = iot_schedule (frame, this, stub); - -out: - if (ret < 0) { - STACK_UNWIND_STRICT (zerofill, frame, -1, -ret, NULL, NULL, - NULL); - if (stub != NULL) { - call_stub_destroy (stub); - } - } + IOT_FOP (zerofill, frame, this, fd, offset, len, xdata); return 0; } diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c index b9cef1152..00457338d 100644 --- a/xlators/performance/write-behind/src/write-behind.c +++ b/xlators/performance/write-behind/src/write-behind.c @@ -108,6 +108,7 @@ typedef struct wb_inode { after it arrived (i.e, those that have a liability generation higher than itself) */ + size_t size; /* Size of the file to catch write after EOF. */ gf_lock_t lock; xlator_t *this; } wb_inode_t; @@ -503,8 +504,23 @@ wb_enqueue_common (wb_inode_t *wb_inode, call_stub_t *stub, int tempted) switch (stub->fop) { case GF_FOP_WRITE: - req->ordering.off = stub->args.offset; - req->ordering.size = req->write_size; + LOCK (&wb_inode->lock); + { + if (wb_inode->size < stub->args.offset) { + req->ordering.off = wb_inode->size; + req->ordering.size = stub->args.offset + + req->write_size + - wb_inode->size; + } else { + req->ordering.off = stub->args.offset; + req->ordering.size = req->write_size; + } + + if (wb_inode->size < stub->args.offset + req->write_size) + wb_inode->size = stub->args.offset + + req->write_size; + } + UNLOCK (&wb_inode->lock); req->fd = fd_ref (stub->args.fd); @@ -519,10 +535,20 @@ wb_enqueue_common (wb_inode_t *wb_inode, call_stub_t *stub, int tempted) case GF_FOP_TRUNCATE: req->ordering.off = stub->args.offset; req->ordering.size = 0; /* till infinity */ + LOCK (&wb_inode->lock); + { + wb_inode->size = req->ordering.off; + } + UNLOCK (&wb_inode->lock); break; case GF_FOP_FTRUNCATE: req->ordering.off = stub->args.offset; req->ordering.size = 0; /* till infinity */ + LOCK (&wb_inode->lock); + { + wb_inode->size = req->ordering.off; + } + UNLOCK (&wb_inode->lock); req->fd = fd_ref (stub->args.fd); @@ -1196,6 +1222,20 @@ wb_process_queue (wb_inode_t *wb_inode) } +void +wb_set_inode_size(wb_inode_t *wb_inode, struct iatt *postbuf) +{ + GF_ASSERT (wb_inode); + GF_ASSERT (postbuf); + + LOCK (&wb_inode->lock); + { + wb_inode->size = postbuf->ia_size; + } + UNLOCK (&wb_inode->lock); +} + + int wb_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, @@ -1576,11 +1616,29 @@ noqueue: } +int32_t +wb_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct iatt *prebuf, + struct iatt *postbuf, dict_t *xdata) +{ + GF_ASSERT (frame->local); + + if (op_ret == 0) + wb_set_inode_size (frame->local, postbuf); + + frame->local = NULL; + + STACK_UNWIND_STRICT (truncate, frame, op_ret, op_errno, prebuf, + postbuf, xdata); + return 0; +} + + int wb_truncate_helper (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset, dict_t *xdata) { - STACK_WIND (frame, default_truncate_cbk, FIRST_CHILD(this), + STACK_WIND (frame, wb_truncate_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->truncate, loc, offset, xdata); return 0; } @@ -1597,6 +1655,8 @@ wb_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset, if (!wb_inode) goto unwind; + frame->local = wb_inode; + stub = fop_truncate_stub (frame, wb_truncate_helper, loc, offset, xdata); if (!stub) @@ -1619,11 +1679,29 @@ unwind: } +int32_t +wb_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, struct iatt *prebuf, + struct iatt *postbuf, dict_t *xdata) +{ + GF_ASSERT (frame->local); + + if (op_ret == 0) + wb_set_inode_size (frame->local, postbuf); + + frame->local = NULL; + + STACK_UNWIND_STRICT (ftruncate, frame, op_ret, op_errno, prebuf, + postbuf, xdata); + return 0; +} + + int wb_ftruncate_helper (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, dict_t *xdata) { - STACK_WIND (frame, default_ftruncate_cbk, FIRST_CHILD(this), + STACK_WIND (frame, wb_ftruncate_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->ftruncate, fd, offset, xdata); return 0; } @@ -1646,6 +1724,8 @@ wb_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, if (wb_fd_err (fd, this, &op_errno)) goto unwind; + frame->local = wb_inode; + stub = fop_ftruncate_stub (frame, wb_ftruncate_helper, fd, offset, xdata); if (!stub) { @@ -1663,6 +1743,8 @@ wb_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, return 0; unwind: + frame->local = NULL; + STACK_UNWIND_STRICT (ftruncate, frame, -1, op_errno, NULL, NULL, NULL); if (stub) @@ -1763,6 +1845,81 @@ noqueue: } +int32_t +wb_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, + mode_t mode, mode_t umask, fd_t *fd, dict_t *xdata) +{ + wb_inode_t *wb_inode = NULL; + + wb_inode = wb_inode_create (this, fd->inode); + if (!wb_inode) + goto unwind; + + if (((flags & O_RDWR) || (flags & O_WRONLY)) && (flags & O_TRUNC)) + wb_inode->size = 0; + + STACK_WIND_TAIL (frame, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->create, loc, flags, mode, + umask, fd, xdata); + return 0; + +unwind: + STACK_UNWIND_STRICT (create, frame, -1, ENOMEM, NULL, NULL, NULL, NULL, + NULL, NULL); + return 0; +} + + +int32_t +wb_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, + fd_t *fd, dict_t *xdata) +{ + wb_inode_t *wb_inode = NULL; + + wb_inode = wb_inode_create (this, fd->inode); + if (!wb_inode) + goto unwind; + + if (((flags & O_RDWR) || (flags & O_WRONLY)) && (flags & O_TRUNC)) + wb_inode->size = 0; + + STACK_WIND_TAIL (frame, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->open, loc, flags, fd, xdata); + return 0; + +unwind: + STACK_UNWIND_STRICT (open, frame, -1, ENOMEM, NULL, NULL); + return 0; +} + + +int32_t +wb_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno, inode_t *inode, + struct iatt *buf, dict_t *xdata, struct iatt *postparent) +{ + if (op_ret == 0) { + wb_inode_t *wb_inode = wb_inode_ctx_get (this, inode); + if (wb_inode) + wb_set_inode_size (wb_inode, buf); + } + + STACK_UNWIND_STRICT (lookup, frame, op_ret, op_errno, inode, buf, + xdata, postparent); + return 0; +} + + +int32_t +wb_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, + dict_t *xdata) +{ + STACK_WIND (frame, wb_lookup_cbk, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->lookup, loc, xdata); + return 0; +} + + int wb_forget (xlator_t *this, inode_t *inode) { diff --git a/xlators/protocol/auth/addr/src/addr.c b/xlators/protocol/auth/addr/src/addr.c index 64e8d0fc6..181d091bd 100644 --- a/xlators/protocol/auth/addr/src/addr.c +++ b/xlators/protocol/auth/addr/src/addr.c @@ -181,6 +181,7 @@ gf_auth (dict_t *input_params, dict_t *config_params) addr_str = strtok_r (NULL, ADDR_DELIMITER, &tmp); } GF_FREE (addr_cpy); + addr_cpy = NULL; } if (allow_addr) { diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c index b2aa66422..7c8be42ed 100644 --- a/xlators/protocol/client/src/client-handshake.c +++ b/xlators/protocol/client/src/client-handshake.c @@ -465,17 +465,23 @@ client_set_lk_version (xlator_t *this) clnt_conf_t *conf = NULL; call_frame_t *frame = NULL; gf_set_lk_ver_req req = {0, }; + char *process_uuid = NULL; GF_VALIDATE_OR_GOTO ("client", this, err); conf = (clnt_conf_t *) this->private; req.lk_ver = client_get_lk_ver (conf); - ret = gf_asprintf (&req.uid, "%s-%s-%d", - this->ctx->process_uuid, this->name, - this->graph->id); - if (ret == -1) + ret = dict_get_str (this->options, "process-uuid", &process_uuid); + if (!process_uuid) { + ret = -1; goto err; + } + req.uid = gf_strdup (process_uuid); + if (!req.uid) { + ret = -1; + goto err; + } frame = create_frame (this, this->ctx->pool); if (!frame) { @@ -1524,6 +1530,7 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc) char *process_uuid_xl = NULL; clnt_conf_t *conf = NULL; dict_t *options = NULL; + char counter_str[32] = {0}; options = this->options; conf = this->private; @@ -1549,13 +1556,24 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc) } } - /* With multiple graphs possible in the same process, we need a + /* When lock-heal is enabled: + * With multiple graphs possible in the same process, we need a field to bring the uniqueness. Graph-ID should be enough to get the - job done + job done. + * When lock-heal is disabled, connection-id should always be unique so + * that server never gets to reuse the previous connection resources + * so it cleans up the resources on every disconnect. Otherwise + * it may lead to stale resources, i.e. leaked file desciptors, + * inode/entry locks */ - ret = gf_asprintf (&process_uuid_xl, "%s-%s-%d", + if (!conf->lk_heal) { + snprintf (counter_str, sizeof (counter_str), + "-%"PRIu64, conf->setvol_count); + conf->setvol_count++; + } + ret = gf_asprintf (&process_uuid_xl, "%s-%s-%d%s", this->ctx->process_uuid, this->name, - this->graph->id); + this->graph->id, counter_str); if (-1 == ret) { gf_log (this->name, GF_LOG_ERROR, "asprintf failed while setting process_uuid"); diff --git a/xlators/protocol/client/src/client-rpc-fops.c b/xlators/protocol/client/src/client-rpc-fops.c index 01590d73a..99a6f6d74 100644 --- a/xlators/protocol/client/src/client-rpc-fops.c +++ b/xlators/protocol/client/src/client-rpc-fops.c @@ -3068,13 +3068,13 @@ client3_3_lookup (call_frame_t *frame, xlator_t *this, op_errno = ENOMEM; goto unwind; } + frame->local = local; if (!(args->loc && args->loc->inode)) goto unwind; loc_copy (&local->loc, args->loc); loc_path (&local->loc, NULL); - frame->local = local; if (args->loc->parent) { if (!uuid_is_null (args->loc->parent->gfid)) @@ -3792,13 +3792,13 @@ client3_3_mknod (call_frame_t *frame, xlator_t *this, op_errno = ENOMEM; goto unwind; } + frame->local = local; if (!(args->loc && args->loc->parent)) goto unwind; loc_copy (&local->loc, args->loc); loc_path (&local->loc, NULL); - frame->local = local; if (!uuid_is_null (args->loc->parent->gfid)) memcpy (req.pargfid, args->loc->parent->gfid, 16); @@ -3860,13 +3860,13 @@ client3_3_mkdir (call_frame_t *frame, xlator_t *this, op_errno = ENOMEM; goto unwind; } + frame->local = local; if (!(args->loc && args->loc->parent)) goto unwind; loc_copy (&local->loc, args->loc); loc_path (&local->loc, NULL); - frame->local = local; if (!uuid_is_null (args->loc->parent->gfid)) memcpy (req.pargfid, args->loc->parent->gfid, 16); @@ -3927,6 +3927,8 @@ client3_3_create (call_frame_t *frame, xlator_t *this, op_errno = ENOMEM; goto unwind; } + frame->local = local; + if (!(args->loc && args->loc->parent)) goto unwind; @@ -3935,7 +3937,6 @@ client3_3_create (call_frame_t *frame, xlator_t *this, loc_copy (&local->loc, args->loc); loc_path (&local->loc, NULL); - frame->local = local; if (!uuid_is_null (args->loc->parent->gfid)) memcpy (req.pargfid, args->loc->parent->gfid, 16); @@ -3998,6 +3999,8 @@ client3_3_open (call_frame_t *frame, xlator_t *this, op_errno = ENOMEM; goto unwind; } + frame->local = local; + if (!(args->loc && args->loc->inode)) goto unwind; @@ -4005,7 +4008,6 @@ client3_3_open (call_frame_t *frame, xlator_t *this, local->flags = args->flags; loc_copy (&local->loc, args->loc); loc_path (&local->loc, NULL); - frame->local = local; if (!uuid_is_null (args->loc->inode->gfid)) memcpy (req.gfid, args->loc->inode->gfid, 16); @@ -4388,13 +4390,14 @@ client3_3_opendir (call_frame_t *frame, xlator_t *this, op_errno = ENOMEM; goto unwind; } + frame->local = local; + if (!(args->loc && args->loc->inode)) goto unwind; local->fd = fd_ref (args->fd); loc_copy (&local->loc, args->loc); loc_path (&local->loc, NULL); - frame->local = local; if (!uuid_is_null (args->loc->inode->gfid)) memcpy (req.gfid, args->loc->inode->gfid, 16); @@ -5251,6 +5254,7 @@ client3_3_lk (call_frame_t *frame, xlator_t *this, op_errno = ENOMEM; goto unwind; } + frame->local = local; CLIENT_GET_REMOTE_FD (this, args->fd, DEFAULT_REMOTE_FD, remote_fd, op_errno, unwind); @@ -5278,7 +5282,6 @@ client3_3_lk (call_frame_t *frame, xlator_t *this, local->owner = frame->root->lk_owner; local->cmd = args->cmd; local->fd = fd_ref (args->fd); - frame->local = local; req.fd = remote_fd; req.cmd = gf_cmd; diff --git a/xlators/protocol/client/src/client.h b/xlators/protocol/client/src/client.h index afab2d74f..bc0f5d0e9 100644 --- a/xlators/protocol/client/src/client.h +++ b/xlators/protocol/client/src/client.h @@ -120,6 +120,11 @@ typedef struct clnt_conf { */ gf_boolean_t filter_o_direct; /* if set, filter O_DIRECT from the flags list of open() */ + /* set volume is the op which results in creating/re-using + * the conn-id and is called once per connection, this remembers + * how manytimes set_volume is called + */ + uint64_t setvol_count; } clnt_conf_t; typedef struct _client_fd_ctx { diff --git a/xlators/protocol/server/src/server-rpc-fops.c b/xlators/protocol/server/src/server-rpc-fops.c index c56da30a7..8bdadec6b 100644 --- a/xlators/protocol/server/src/server-rpc-fops.c +++ b/xlators/protocol/server/src/server-rpc-fops.c @@ -810,7 +810,9 @@ server_fgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, if (op_ret == -1) { state = CALL_STATE (frame); - gf_log (this->name, ((op_errno == ENOTSUP) ? + gf_log (this->name, (((op_errno == ENOTSUP) || + (op_errno == ENODATA) || + (op_errno == ENOENT)) ? GF_LOG_DEBUG : GF_LOG_INFO), "%"PRId64": FGETXATTR %"PRId64" (%s) (%s) ==> (%s)", frame->root->unique, state->resolve.fd_no, diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c index 3a66ecfc2..2cf46669e 100644 --- a/xlators/storage/posix/src/posix-helpers.c +++ b/xlators/storage/posix/src/posix-helpers.c @@ -59,6 +59,8 @@ static char* posix_ignore_xattrs[] = { GLUSTERFS_ENTRYLK_COUNT, GLUSTERFS_INODELK_COUNT, GLUSTERFS_POSIXLK_COUNT, + GLUSTERFS_PARENT_ENTRYLK, + GF_GFIDLESS_LOOKUP, NULL }; @@ -391,7 +393,7 @@ posix_fill_ino_from_gfid (xlator_t *this, struct iatt *buf) goto out; } for (i = 15; i > (15 - 8); i--) { - temp_ino += (uint64_t)(buf->ia_gfid[i]) << j; + temp_ino += (uint64_t)(buf->ia_gfid[i]) << j; j += 8; } buf->ia_ino = temp_ino; @@ -1015,7 +1017,7 @@ posix_spawn_janitor_thread (xlator_t *this) { if (!priv->janitor_present) { ret = gf_thread_create (&priv->janitor, NULL, - posix_janitor_thread_proc, this); + posix_janitor_thread_proc, this); if (ret < 0) { gf_log (this->name, GF_LOG_ERROR, @@ -1358,7 +1360,7 @@ posix_spawn_health_check_thread (xlator_t *xl) goto unlock; ret = gf_thread_create (&priv->health_check, NULL, - posix_health_check_thread_proc, xl); + posix_health_check_thread_proc, xl); if (ret < 0) { priv->health_check_interval = 0; priv->health_check_active = _gf_false; @@ -1379,89 +1381,89 @@ unlock: int posix_fsyncer_pick (xlator_t *this, struct list_head *head) { - struct posix_private *priv = NULL; - int count = 0; - - priv = this->private; - pthread_mutex_lock (&priv->fsync_mutex); - { - while (list_empty (&priv->fsyncs)) - pthread_cond_wait (&priv->fsync_cond, - &priv->fsync_mutex); - - count = priv->fsync_queue_count; - priv->fsync_queue_count = 0; - list_splice_init (&priv->fsyncs, head); - } - pthread_mutex_unlock (&priv->fsync_mutex); - - return count; + struct posix_private *priv = NULL; + int count = 0; + + priv = this->private; + pthread_mutex_lock (&priv->fsync_mutex); + { + while (list_empty (&priv->fsyncs)) + pthread_cond_wait (&priv->fsync_cond, + &priv->fsync_mutex); + + count = priv->fsync_queue_count; + priv->fsync_queue_count = 0; + list_splice_init (&priv->fsyncs, head); + } + pthread_mutex_unlock (&priv->fsync_mutex); + + return count; } void posix_fsyncer_process (xlator_t *this, call_stub_t *stub, gf_boolean_t do_fsync) { - struct posix_fd *pfd = NULL; - int ret = -1; - struct posix_private *priv = NULL; - - priv = this->private; - - ret = posix_fd_ctx_get (stub->args.fd, this, &pfd); - if (ret < 0) { - gf_log (this->name, GF_LOG_ERROR, - "could not get fdctx for fd(%s)", - uuid_utoa (stub->args.fd->inode->gfid)); - call_unwind_error (stub, -1, EINVAL); - return; - } - - if (do_fsync) { + struct posix_fd *pfd = NULL; + int ret = -1; + struct posix_private *priv = NULL; + + priv = this->private; + + ret = posix_fd_ctx_get (stub->args.fd, this, &pfd); + if (ret < 0) { + gf_log (this->name, GF_LOG_ERROR, + "could not get fdctx for fd(%s)", + uuid_utoa (stub->args.fd->inode->gfid)); + call_unwind_error (stub, -1, EINVAL); + return; + } + + if (do_fsync) { #ifdef HAVE_FDATASYNC - if (stub->args.datasync) - ret = fdatasync (pfd->fd); - else + if (stub->args.datasync) + ret = fdatasync (pfd->fd); + else #endif - ret = fsync (pfd->fd); - } else { - ret = 0; - } - - if (ret) { - gf_log (this->name, GF_LOG_ERROR, - "could not fstat fd(%s)", - uuid_utoa (stub->args.fd->inode->gfid)); - call_unwind_error (stub, -1, errno); - return; - } - - call_unwind_error (stub, 0, 0); + ret = fsync (pfd->fd); + } else { + ret = 0; + } + + if (ret) { + gf_log (this->name, GF_LOG_ERROR, + "could not fstat fd(%s)", + uuid_utoa (stub->args.fd->inode->gfid)); + call_unwind_error (stub, -1, errno); + return; + } + + call_unwind_error (stub, 0, 0); } static void posix_fsyncer_syncfs (xlator_t *this, struct list_head *head) { - call_stub_t *stub = NULL; - struct posix_fd *pfd = NULL; - int ret = -1; + call_stub_t *stub = NULL; + struct posix_fd *pfd = NULL; + int ret = -1; - stub = list_entry (head->prev, call_stub_t, list); - ret = posix_fd_ctx_get (stub->args.fd, this, &pfd); - if (ret) - return; + stub = list_entry (head->prev, call_stub_t, list); + ret = posix_fd_ctx_get (stub->args.fd, this, &pfd); + if (ret) + return; #ifdef GF_LINUX_HOST_OS - /* syncfs() is not "declared" in RHEL's glibc even though - the kernel has support. - */ + /* syncfs() is not "declared" in RHEL's glibc even though + the kernel has support. + */ #include <sys/syscall.h> #include <unistd.h> #ifdef SYS_syncfs - syscall (SYS_syncfs, pfd->fd); + syscall (SYS_syncfs, pfd->fd); #else - sync(); + sync(); #endif #else sync(); @@ -1472,49 +1474,49 @@ posix_fsyncer_syncfs (xlator_t *this, struct list_head *head) void * posix_fsyncer (void *d) { - xlator_t *this = d; - struct posix_private *priv = NULL; - call_stub_t *stub = NULL; - call_stub_t *tmp = NULL; - struct list_head list; - int count = 0; - gf_boolean_t do_fsync = _gf_true; - - priv = this->private; - - for (;;) { - INIT_LIST_HEAD (&list); - - count = posix_fsyncer_pick (this, &list); - - usleep (priv->batch_fsync_delay_usec); - - gf_log (this->name, GF_LOG_DEBUG, - "picked %d fsyncs", count); - - switch (priv->batch_fsync_mode) { - case BATCH_NONE: - case BATCH_REVERSE_FSYNC: - break; - case BATCH_SYNCFS: - case BATCH_SYNCFS_SINGLE_FSYNC: - case BATCH_SYNCFS_REVERSE_FSYNC: - posix_fsyncer_syncfs (this, &list); - break; - } - - if (priv->batch_fsync_mode == BATCH_SYNCFS) - do_fsync = _gf_false; - else - do_fsync = _gf_true; - - list_for_each_entry_safe_reverse (stub, tmp, &list, list) { - list_del_init (&stub->list); - - posix_fsyncer_process (this, stub, do_fsync); - - if (priv->batch_fsync_mode == BATCH_SYNCFS_SINGLE_FSYNC) - do_fsync = _gf_false; - } - } + xlator_t *this = d; + struct posix_private *priv = NULL; + call_stub_t *stub = NULL; + call_stub_t *tmp = NULL; + struct list_head list; + int count = 0; + gf_boolean_t do_fsync = _gf_true; + + priv = this->private; + + for (;;) { + INIT_LIST_HEAD (&list); + + count = posix_fsyncer_pick (this, &list); + + usleep (priv->batch_fsync_delay_usec); + + gf_log (this->name, GF_LOG_DEBUG, + "picked %d fsyncs", count); + + switch (priv->batch_fsync_mode) { + case BATCH_NONE: + case BATCH_REVERSE_FSYNC: + break; + case BATCH_SYNCFS: + case BATCH_SYNCFS_SINGLE_FSYNC: + case BATCH_SYNCFS_REVERSE_FSYNC: + posix_fsyncer_syncfs (this, &list); + break; + } + + if (priv->batch_fsync_mode == BATCH_SYNCFS) + do_fsync = _gf_false; + else + do_fsync = _gf_true; + + list_for_each_entry_safe_reverse (stub, tmp, &list, list) { + list_del_init (&stub->list); + + posix_fsyncer_process (this, stub, do_fsync); + + if (priv->batch_fsync_mode == BATCH_SYNCFS_SINGLE_FSYNC) + do_fsync = _gf_false; + } + } } diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index fde322099..588079d92 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -362,23 +362,23 @@ posix_setattr (call_frame_t *frame, xlator_t *this, goto out; } - if (valid & GF_SET_ATTR_MODE) { - op_ret = posix_do_chmod (this, real_path, stbuf); + if (valid & (GF_SET_ATTR_UID | GF_SET_ATTR_GID)){ + op_ret = posix_do_chown (this, real_path, stbuf, valid); if (op_ret == -1) { op_errno = errno; gf_log (this->name, GF_LOG_ERROR, - "setattr (chmod) on %s failed: %s", real_path, + "setattr (chown) on %s failed: %s", real_path, strerror (op_errno)); goto out; } } - if (valid & (GF_SET_ATTR_UID | GF_SET_ATTR_GID)){ - op_ret = posix_do_chown (this, real_path, stbuf, valid); + if (valid & GF_SET_ATTR_MODE) { + op_ret = posix_do_chmod (this, real_path, stbuf); if (op_ret == -1) { op_errno = errno; gf_log (this->name, GF_LOG_ERROR, - "setattr (chown) on %s failed: %s", real_path, + "setattr (chmod) on %s failed: %s", real_path, strerror (op_errno)); goto out; } @@ -3733,8 +3733,10 @@ posix_fgetxattr (call_frame_t *frame, xlator_t *this, size = sys_fgetxattr (_fd, key, NULL, 0); if (size <= 0) { op_errno = errno; - gf_log (this->name, GF_LOG_ERROR, "fgetxattr failed on " - "key %s (%s)", key, strerror (op_errno)); + gf_log (this->name, ((errno == ENODATA) ? + GF_LOG_DEBUG : GF_LOG_ERROR), + "fgetxattr failed on key %s (%s)", key, + strerror (op_errno)); goto done; } @@ -5026,8 +5028,8 @@ posix_rchecksum (call_frame_t *frame, xlator_t *this, if (ret < 0) goto out; - weak_checksum = gf_rsync_weak_checksum ((unsigned char *) buf, (size_t) len); - gf_rsync_strong_checksum ((unsigned char *) buf, (size_t) len, (unsigned char *) strong_checksum); + weak_checksum = gf_rsync_weak_checksum ((unsigned char *) buf, (size_t) ret); + gf_rsync_strong_checksum ((unsigned char *) buf, (size_t) ret, (unsigned char *) strong_checksum); op_ret = 0; out: @@ -5764,7 +5766,7 @@ struct volume_options options[] = { }, { .key = {"update-link-count-parent"}, .type = GF_OPTION_TYPE_BOOL, - .default_value = "false", + .default_value = "off", .description = "Enable placeholders for gfid to path conversion" }, { .key = {NULL} } |