diff options
| author | Kaushal M <kaushal@redhat.com> | 2016-11-18 15:32:08 +0530 | 
|---|---|---|
| committer | Kaushal M <kaushal@redhat.com> | 2016-11-18 15:32:08 +0530 | 
| commit | 94ba6c9995d3122f31cad2f4993ab07cd6ae7063 (patch) | |
| tree | 6d5612c63e43da29ac19ff8c28377bd99a8ff9a4 | |
| parent | c11131fcdf47c4f0144b0ee1709e8c4bb05dac08 (diff) | |
| parent | a4ecc73a5cd7029dd5ad4a8545a4ec41365ffce9 (diff) | |
Merge remote-tracking branch 'origin/release-3.7' into release-3.7
Due to a mistake done when tagging and pushing v3.7.17, v3.7.17 and
release-3.7 divereged, leaving the release-3.7 branch without the
v3.7.17 commit and tag. This merge resolves the divergence.
More information can about this is available in [1].
[1]: https://www.gluster.org/pipermail/maintainers/2016-November/001746.html
| -rw-r--r-- | api/src/glfs-fops.c | 30 | ||||
| -rw-r--r-- | api/src/glfs.c | 6 | ||||
| -rw-r--r-- | cli/src/cli-rpc-ops.c | 10 | ||||
| -rw-r--r-- | libglusterfs/src/xlator.c | 17 | ||||
| -rw-r--r-- | libglusterfs/src/xlator.h | 1 | ||||
| -rw-r--r-- | rpc/xdr/src/cli1-xdr.x | 1 | ||||
| -rw-r--r-- | xlators/cluster/afr/src/afr-common.c | 6 | ||||
| -rw-r--r-- | xlators/cluster/afr/src/afr-transaction.c | 23 | ||||
| -rw-r--r-- | xlators/features/shard/src/shard.c | 1 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/Makefile.am | 2 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 44 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-quota.c | 13 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-quota.h | 17 | ||||
| -rw-r--r-- | xlators/performance/md-cache/src/md-cache.c | 48 | ||||
| -rw-r--r-- | xlators/system/posix-acl/src/posix-acl.c | 3 | 
15 files changed, 168 insertions, 54 deletions
diff --git a/api/src/glfs-fops.c b/api/src/glfs-fops.c index be1077a2760..ec2fbb2c264 100644 --- a/api/src/glfs-fops.c +++ b/api/src/glfs-fops.c @@ -869,10 +869,9 @@ pub_glfs_preadv_async (struct glfs_fd *glfd, const struct iovec *iovec,  			   offset, flags, NULL);  out: -        if (fd) -                fd_unref (fd); -          if (ret) { +                if (fd) +                        fd_unref (fd);                  if (glfd)                          GF_REF_PUT (glfd);                  if (gio) { @@ -1187,10 +1186,9 @@ pub_glfs_pwritev_async (struct glfs_fd *glfd, const struct iovec *iovec,          ret = 0;  out: -        if (fd) -                fd_unref (fd); -          if (ret) { +                if (fd) +                        fd_unref (fd);                  if (glfd)                          GF_REF_PUT (glfd);                  GF_FREE (gio); @@ -1374,10 +1372,9 @@ glfs_fsync_async_common (struct glfs_fd *glfd, glfs_io_cbk fn, void *data,                             subvol->fops->fsync, fd, dataonly, NULL);  out: -        if (fd) -                fd_unref (fd); -          if (ret) { +                if (fd) +                        fd_unref (fd);                  if (glfd)                          GF_REF_PUT (glfd);                  GF_FREE (gio); @@ -1628,10 +1625,9 @@ pub_glfs_ftruncate_async (struct glfs_fd *glfd, off_t offset, glfs_io_cbk fn,          ret = 0;  out: -        if (fd) -                fd_unref (fd); -          if (ret) { +                if (fd) +                        fd_unref (fd);                  if (glfd)                          GF_REF_PUT (glfd);                  GF_FREE (gio); @@ -2487,10 +2483,9 @@ pub_glfs_discard_async (struct glfs_fd *glfd, off_t offset, size_t len,          ret = 0;  out: -        if (fd) -                fd_unref (fd); -          if (ret) { +                if (fd) +                        fd_unref (fd);                  if (glfd)                          GF_REF_PUT (glfd);                  GF_FREE (gio); @@ -2575,10 +2570,9 @@ pub_glfs_zerofill_async (struct glfs_fd *glfd, off_t offset, off_t len,                             subvol->fops->zerofill, fd, offset, len, NULL);          ret = 0;  out: -        if (fd) -                fd_unref (fd); -          if (ret) { +                if (fd) +                        fd_unref (fd);                  if (glfd)                          GF_REF_PUT (glfd);                  GF_FREE (gio); diff --git a/api/src/glfs.c b/api/src/glfs.c index 096e6aec2cf..9a92fa97c3d 100644 --- a/api/src/glfs.c +++ b/api/src/glfs.c @@ -1370,18 +1370,18 @@ pub_glfs_upcall_inode_get_pstat (struct glfs_upcall_inode *arg)  {          return &arg->p_buf;  } -GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_upcall_get_pstat, 3.7.16); +GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_upcall_inode_get_pstat, 3.7.16);  struct glfs_object*  pub_glfs_upcall_inode_get_oldpobject (struct glfs_upcall_inode *arg)  {          return arg->oldp_object;  } -GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_upcall_get_oldpobject, 3.7.16); +GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_upcall_inode_get_oldpobject, 3.7.16);  struct stat*  pub_glfs_upcall_inode_get_oldpstat (struct glfs_upcall_inode *arg)  {          return &arg->oldp_buf;  } -GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_upcall_get_oldpstat, 3.7.16); +GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_upcall_inode_get_oldpstat, 3.7.16); diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 3a5b8e67b08..703026a9adc 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -7765,7 +7765,7 @@ gf_cli_status_cbk (struct rpc_req *req, struct iovec *iov,                          if (ret) {                                  gf_log ("cli", GF_LOG_ERROR,                                          "Error outputting to xml"); -                                goto out; +                                goto xml_end;                          }                  }                  if (cmd & GF_CLI_STATUS_TASKS) { @@ -7774,17 +7774,18 @@ gf_cli_status_cbk (struct rpc_req *req, struct iovec *iov,                          if (ret) {                                  gf_log ("cli", GF_LOG_ERROR,"Error outputting "                                          "to xml"); -                                goto out; +                                goto xml_end;                          }                  } else {                          ret = cli_xml_output_vol_status (local, dict);                          if (ret) {                                  gf_log ("cli", GF_LOG_ERROR,                                          "Error outputting to xml"); -                                goto out; +                                goto xml_end;                          }                  } +xml_end:                  if (!local->all) {                          ret = cli_xml_output_vol_status_end (local);                          if (ret) { @@ -8029,7 +8030,7 @@ gf_cli_status_volume_all (call_frame_t *frame, xlator_t *this, void *data)                  if (ret) {                          gf_log ("cli", GF_LOG_ERROR,                                  "Error outputting to xml"); -                        goto out; +                        goto xml_end;                  }          } @@ -8066,6 +8067,7 @@ gf_cli_status_volume_all (call_frame_t *frame, xlator_t *this, void *data)                  dict_unref (dict);          } +xml_end:          if (global_state->mode & GLUSTER_MODE_XML) {                  ret = cli_xml_output_vol_status_end (local);          } diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index 22a494d01a5..5c91380be15 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -762,6 +762,23 @@ out:          return;  } +void +loc_pargfid (loc_t *loc, uuid_t gfid) +{ +        if (!gfid) +                goto out; +        gf_uuid_clear (gfid); + +        if (!loc) +                goto out; +        else if (!gf_uuid_is_null (loc->pargfid)) +                gf_uuid_copy (gfid, loc->pargfid); +        else if (loc->parent && (!gf_uuid_is_null (loc->parent->gfid))) +                gf_uuid_copy (gfid, loc->parent->gfid); +out: +        return; +} +  char*  loc_gfid_utoa (loc_t *loc)  { diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h index ca30f99650e..61d904f4d58 100644 --- a/libglusterfs/src/xlator.h +++ b/libglusterfs/src/xlator.h @@ -963,6 +963,7 @@ int loc_copy_overload_parent (loc_t *dst,  void loc_wipe (loc_t *loc);  int loc_path (loc_t *loc, const char *bname);  void loc_gfid (loc_t *loc, uuid_t gfid); +void loc_pargfid (loc_t *loc, uuid_t pargfid);  char* loc_gfid_utoa (loc_t *loc);  gf_boolean_t loc_is_root (loc_t *loc);  int32_t loc_build_child (loc_t *child, loc_t *parent, char *name); diff --git a/rpc/xdr/src/cli1-xdr.x b/rpc/xdr/src/cli1-xdr.x index 66d399bfaf8..77fd10012d6 100644 --- a/rpc/xdr/src/cli1-xdr.x +++ b/rpc/xdr/src/cli1-xdr.x @@ -78,6 +78,7 @@ enum gf_quota_type {          GF_QUOTA_OPTION_TYPE_LIST_OBJECTS,          GF_QUOTA_OPTION_TYPE_REMOVE_OBJECTS,          GF_QUOTA_OPTION_TYPE_ENABLE_OBJECTS, +        GF_QUOTA_OPTION_TYPE_UPGRADE,          GF_QUOTA_OPTION_TYPE_MAX  }; diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index 24366d17ac1..923afc804be 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -2235,12 +2235,14 @@ afr_lookup_selfheal_wrap (void *opaque)  	afr_local_t *local = NULL;  	xlator_t *this = NULL;  	inode_t *inode = NULL; +        uuid_t pargfid = {0,};  	local = frame->local;  	this = frame->this; +        loc_pargfid (&local->loc, pargfid); -	ret = afr_selfheal_name (frame->this, local->loc.pargfid, -                                 local->loc.name, &local->cont.lookup.gfid_req); +	ret = afr_selfheal_name (frame->this, pargfid, local->loc.name, +                                 &local->cont.lookup.gfid_req);          if (ret == -EIO)                  goto unwind; diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c index be388abc93c..b4641043c38 100644 --- a/xlators/cluster/afr/src/afr-transaction.c +++ b/xlators/cluster/afr/src/afr-transaction.c @@ -776,6 +776,16 @@ afr_handle_quorum (call_frame_t *frame)          if (afr_has_fop_cbk_quorum (frame))                  return; +        for (i = 0; i < priv->child_count; i++) { +                if (local->transaction.pre_op[i]) +                        afr_transaction_fop_failed (frame, frame->this, i); +        } + +        local->op_ret = -1; +        local->op_errno = afr_final_errno (local, priv); +        if (local->op_errno == 0) +                local->op_errno = afr_quorum_errno (priv); +          if (local->fd) {                  gf_uuid_copy (gfid, local->fd->inode->gfid);                  file = uuid_utoa (gfid); @@ -784,19 +794,10 @@ afr_handle_quorum (call_frame_t *frame)                  file = local->loc.path;          } -        gf_msg (frame->this->name, GF_LOG_WARNING, 0, AFR_MSG_QUORUM_FAIL, -                "%s: Failing %s as quorum is not met", +        gf_msg (frame->this->name, GF_LOG_WARNING, local->op_errno, +                AFR_MSG_QUORUM_FAIL, "%s: Failing %s as quorum is not met",                  file, gf_fop_list[local->op]); -        for (i = 0; i < priv->child_count; i++) { -                if (local->transaction.pre_op[i]) -                        afr_transaction_fop_failed (frame, frame->this, i); -        } - -        local->op_ret = -1; -        local->op_errno = afr_final_errno (local, priv); -        if (local->op_errno == 0) -                local->op_errno = afr_quorum_errno (priv);          switch (local->transaction.type) {          case AFR_ENTRY_TRANSACTION:          case AFR_ENTRY_RENAME_TRANSACTION: diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c index b8dc5bbf249..2a06f5b901b 100644 --- a/xlators/features/shard/src/shard.c +++ b/xlators/features/shard/src/shard.c @@ -1678,6 +1678,7 @@ shard_common_lookup_shards (call_frame_t *frame, xlator_t *this, inode_t *inode,                  bname = strrchr (path, '/') + 1;                  loc.inode = inode_new (this->itable);                  loc.parent = inode_ref (priv->dot_shard_inode); +                gf_uuid_copy (loc.pargfid, priv->dot_shard_gfid);                  ret = inode_path (loc.parent, bname, (char **) &(loc.path));                  if (ret < 0 || !(loc.inode)) {                          gf_msg (this->name, GF_LOG_ERROR, 0, diff --git a/xlators/mgmt/glusterd/src/Makefile.am b/xlators/mgmt/glusterd/src/Makefile.am index 57a85d554e9..2cd1d85a7c5 100644 --- a/xlators/mgmt/glusterd/src/Makefile.am +++ b/xlators/mgmt/glusterd/src/Makefile.am @@ -30,7 +30,7 @@ endif  noinst_HEADERS = glusterd.h glusterd-utils.h glusterd-op-sm.h \  	glusterd-sm.h glusterd-store.h glusterd-mem-types.h \  	glusterd-pmap.h glusterd-volgen.h glusterd-mountbroker.h \ -	glusterd-syncop.h glusterd-hooks.h glusterd-locks.h \ +	glusterd-syncop.h glusterd-hooks.h glusterd-locks.h glusterd-quota.h \  	glusterd-mgmt.h glusterd-messages.h glusterd-peer-utils.h \  	glusterd-statedump.h glusterd-snapshot-utils.h glusterd-geo-rep.h \  	glusterd-conn-mgmt.h glusterd-conn-helper.h glusterd-proc-mgmt.h \ diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index b5cc301c916..4345286cacc 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -40,6 +40,7 @@  #include "glusterd-locks.h"  #include "glusterd-messages.h"  #include "glusterd-utils.h" +#include "glusterd-quota.h"  #include "syscall.h"  #include "cli1-xdr.h"  #include "common-utils.h" @@ -2235,17 +2236,19 @@ static int  glusterd_op_set_all_volume_options (xlator_t *this, dict_t *dict,                                      char **op_errstr)  { -        char            *key            = NULL; -        char            *key_fixed      = NULL; -        char            *value          = NULL; -        char            *dup_value      = NULL; -        int             ret             = -1; -        glusterd_conf_t *conf           = NULL; -        dict_t          *dup_opt        = NULL; -        char            *next_version   = NULL; -        gf_boolean_t    quorum_action   = _gf_false; -        uint32_t        op_version      = 0; -        glusterd_volinfo_t  *volinfo    = NULL; +        char            *key                    = NULL; +        char            *key_fixed              = NULL; +        char            *value                  = NULL; +        char            *dup_value              = NULL; +        int             ret                     = -1; +        glusterd_conf_t *conf                   = NULL; +        dict_t          *dup_opt                = NULL; +        char            *next_version           = NULL; +        gf_boolean_t    quorum_action           = _gf_false; +        uint32_t        op_version              = 0; +        glusterd_volinfo_t  *volinfo            = NULL; +        glusterd_volinfo_t  *tmp_volinfo        = NULL; +        glusterd_volinfo_t  *voliter            = NULL;          conf = this->private;          ret = dict_get_str (dict, "key1", &key); @@ -2291,6 +2294,25 @@ glusterd_op_set_all_volume_options (xlator_t *this, dict_t *dict,                  if (op_version >= conf->op_version) {                          conf->op_version = op_version; + +                        /* When a bump up happens, update the quota.conf file +                         * as well. This is because, till 3.7 we had a quota +                         * conf version v1.1 in quota.conf. When inode-quota +                         * feature is introduced, this needs to be changed to +                         * v1.2 in quota.conf and 16 bytes uuid in quota.conf +                         * needs to be changed to 17 bytes. Look +                         * glusterd_store_quota_config for more details. +                         */ +                        cds_list_for_each_entry (voliter, &conf->volumes, vol_list) { +                                tmp_volinfo = voliter; +                                ret = glusterd_store_quota_config (tmp_volinfo, +                                                                   NULL, NULL, +                                                                   GF_QUOTA_OPTION_TYPE_UPGRADE, +                                                                   NULL); +                                if (ret) +                                        goto out; +                        } +                          ret = glusterd_store_global_info (this);                          if (ret) {                                  gf_msg (this->name, GF_LOG_ERROR, 0, diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c index 294ade7fd96..ec7f13bc250 100644 --- a/xlators/mgmt/glusterd/src/glusterd-quota.c +++ b/xlators/mgmt/glusterd/src/glusterd-quota.c @@ -28,6 +28,7 @@  #include "byte-order.h"  #include "compat-errno.h"  #include "quota-common-utils.h" +#include "glusterd-quota.h"  #include <sys/wait.h>  #include <dlfcn.h> @@ -60,12 +61,10 @@ const char *gd_quota_op_list[GF_QUOTA_OPTION_TYPE_MAX + 1] = {          [GF_QUOTA_OPTION_TYPE_LIST_OBJECTS]       = "list-objects",          [GF_QUOTA_OPTION_TYPE_REMOVE_OBJECTS]     = "remove-objects",          [GF_QUOTA_OPTION_TYPE_ENABLE_OBJECTS]     = "enable-objects", +        [GF_QUOTA_OPTION_TYPE_UPGRADE]            = "upgrade",          [GF_QUOTA_OPTION_TYPE_MAX]                = NULL  }; -int -glusterd_store_quota_config (glusterd_volinfo_t *volinfo, char *path, -                             char *gfid_str, int opcode, char **op_errstr);  gf_boolean_t  glusterd_is_quota_supported (int32_t type, char **op_errstr) @@ -958,9 +957,15 @@ glusterd_store_quota_config (glusterd_volinfo_t *volinfo, char *path,          if (ret)                  goto out; +          /* Just create empty quota.conf file if create */          if (GF_QUOTA_OPTION_TYPE_ENABLE == opcode || -            GF_QUOTA_OPTION_TYPE_ENABLE_OBJECTS == opcode) { +            GF_QUOTA_OPTION_TYPE_ENABLE_OBJECTS == opcode || +            GF_QUOTA_OPTION_TYPE_UPGRADE == opcode) { +                /* Opcode will be GF_QUOTA_OPTION_TYPE_UPGRADE when there is +                 * an upgrade from 3.6 to 3.7. Just upgrade the quota.conf +                 * file even during an op-version bumpup and exit. +                 */                  modified = _gf_true;                  goto out;          } diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.h b/xlators/mgmt/glusterd/src/glusterd-quota.h new file mode 100644 index 00000000000..9efff41b436 --- /dev/null +++ b/xlators/mgmt/glusterd/src/glusterd-quota.h @@ -0,0 +1,17 @@ +/* +   Copyright (c) 2016 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. +*/ +#ifndef _GLUSTERD_QUOTA_ +#define _GLUSTERD_QUOTA_ + +int +glusterd_store_quota_config (glusterd_volinfo_t *volinfo, char *path, +                             char *gfid_str, int opcode, char **op_errstr); + +#endif diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c index 74aafdbd8d0..5f3cc0141f7 100644 --- a/xlators/performance/md-cache/src/md-cache.c +++ b/xlators/performance/md-cache/src/md-cache.c @@ -1511,6 +1511,53 @@ mdc_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags,  } +static int +mdc_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) +{ +        mdc_local_t *local = NULL; + +        local = frame->local; + +        if (op_ret || !local) +                goto out; + +        if (local->fd->flags & O_TRUNC) { +                /* O_TRUNC modifies file size. Hence invalidate the +                 * cache entry to fetch latest attributes. */ +                mdc_inode_iatt_invalidate (this, local->fd->inode); +        } + +out: +        MDC_STACK_UNWIND (open, frame, op_ret, op_errno, fd, xdata); +        return 0; +} + + +static int +mdc_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, +          fd_t *fd, dict_t *xdata) +{ +        mdc_local_t  *local = NULL; + +        if (!fd || !IA_ISREG(fd->inode->ia_type) || +            !(fd->flags & O_TRUNC)) { +                goto out; +        } + +        local = mdc_local_get (frame); + +        local->fd = fd_ref (fd); + +out: +        STACK_WIND (frame, mdc_open_cbk, +                    FIRST_CHILD(this), FIRST_CHILD(this)->fops->open, +                    loc, flags, fd, xdata); +        return 0; +} + +  int  mdc_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this,                 int32_t op_ret, int32_t op_errno, @@ -2390,6 +2437,7 @@ struct xlator_fops fops = {          .rename      = mdc_rename,          .link        = mdc_link,          .create      = mdc_create, +        .open        = mdc_open,          .readv       = mdc_readv,          .writev      = mdc_writev,          .setattr     = mdc_setattr, diff --git a/xlators/system/posix-acl/src/posix-acl.c b/xlators/system/posix-acl/src/posix-acl.c index 4841c7cb939..80cbbef09db 100644 --- a/xlators/system/posix-acl/src/posix-acl.c +++ b/xlators/system/posix-acl/src/posix-acl.c @@ -874,6 +874,9 @@ posix_acl_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,          ret = posix_acl_get (inode, this, &old_access, &old_default); +        if (xattr == NULL) +                goto acl_set; +          data = dict_get (xattr, POSIX_ACL_ACCESS_XATTR);          if (!data)                  goto acl_default;  | 
