summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
Diffstat (limited to 'xlators')
-rw-r--r--xlators/bindings/Makefile.am1
-rw-r--r--xlators/bindings/python/Makefile.am1
-rw-r--r--xlators/bindings/python/src/Makefile.am19
-rw-r--r--xlators/bindings/python/src/gluster.py40
-rw-r--r--xlators/bindings/python/src/glusterstack.py48
-rw-r--r--xlators/bindings/python/src/glustertypes.py160
-rw-r--r--xlators/bindings/python/src/python.c222
-rw-r--r--xlators/bindings/python/src/testxlator.py49
-rw-r--r--xlators/cluster/afr/src/pump.c6
-rw-r--r--xlators/cluster/dht/src/dht-rebalance.c2
-rw-r--r--xlators/cluster/stripe/src/stripe-helpers.c2
-rw-r--r--xlators/cluster/stripe/src/stripe.c9
-rw-r--r--xlators/encryption/rot-13/src/rot-13.c2
-rw-r--r--xlators/features/compress/src/cdc.c78
-rw-r--r--xlators/features/gfid-access/src/gfid-access.c5
-rw-r--r--xlators/features/glupy/src/Makefile.am6
-rw-r--r--xlators/features/marker/src/marker.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-geo-rep.c118
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c46
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-locks.c82
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-locks.h5
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.c122
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-op-sm.h4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-replace-brick.c6
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rpc-ops.c62
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-syncop.c85
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c31
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-set.c20
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.c12
-rw-r--r--xlators/mgmt/glusterd/src/glusterd.h7
-rw-r--r--xlators/mount/fuse/src/fuse-resolve.c2
-rwxr-xr-xxlators/mount/fuse/utils/mount.glusterfs.in7
-rw-r--r--xlators/nfs/server/src/nfs-fops.c10
-rw-r--r--xlators/performance/io-cache/src/io-cache.c1
-rw-r--r--xlators/performance/io-cache/src/page.c8
-rw-r--r--xlators/performance/io-threads/src/io-threads.c1974
-rw-r--r--xlators/performance/write-behind/src/write-behind.c165
-rw-r--r--xlators/protocol/auth/addr/src/addr.c1
-rw-r--r--xlators/protocol/client/src/client-handshake.c34
-rw-r--r--xlators/protocol/client/src/client-rpc-fops.c17
-rw-r--r--xlators/protocol/client/src/client.h5
-rw-r--r--xlators/protocol/server/src/server-rpc-fops.c4
-rw-r--r--xlators/storage/posix/src/posix-helpers.c222
-rw-r--r--xlators/storage/posix/src/posix.c24
44 files changed, 954 insertions, 2772 deletions
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} }