diff options
| author | Pranith Kumar K <pkarampu@redhat.com> | 2016-09-07 04:19:32 +0530 | 
|---|---|---|
| committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2016-09-14 20:58:48 -0700 | 
| commit | 613575ee7140e257d8f0265b719cbfc7c44a0297 (patch) | |
| tree | bc5bc111e7d2da260c4989061bdab29bb1290555 /xlators/storage/posix/src/posix.c | |
| parent | 73c6c2c307c8bcaac51aa94b1af518955f35d1b8 (diff) | |
storage/posix: Integrate important events with gf_event
BUG: 1371353
Change-Id: I9346ca16222caf9d97d999751577399ae6aacf72
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/15342
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Ravishankar N <ravishankar@redhat.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Smoke: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/storage/posix/src/posix.c')
| -rw-r--r-- | xlators/storage/posix/src/posix.c | 76 | 
1 files changed, 50 insertions, 26 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 8478e64683e..d7b175c9434 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -56,6 +56,7 @@  #include "posix-aio.h"  #include "glusterfs-acl.h"  #include "posix-messages.h" +#include "events.h"  extern char *marker_xattrs[];  #define ALIGN_SIZE 4096 @@ -1485,6 +1486,12 @@ posix_mkdir (call_frame_t *frame, xlator_t *this,                                  "and this can lead to inconsistencies.",                                  loc->path, uuid_utoa (uuid_req),                                  gfid_path ? gfid_path : "<NULL>"); + +                        gf_event (EVENT_POSIX_SAME_GFID, "gfid=%s;path=%s;" +                                  "newpath=%s;brick=%s:%s", +                                  uuid_utoa (uuid_req), +                                  gfid_path ? gfid_path : "<NULL>", loc->path, +                                  priv->hostname, priv->base_path);                  }          } else if (!uuid_req && frame->root->pid != GF_SERVER_PID_TRASH) {                  op_ret = -1; @@ -6844,6 +6851,31 @@ init (xlator_t *this)                  goto out;          } +        _private = GF_CALLOC (1, sizeof (*_private), +                              gf_posix_mt_posix_private); +        if (!_private) { +                ret = -1; +                goto out; +        } + +        _private->base_path = gf_strdup (dir_data->data); +        _private->base_path_length = strlen (_private->base_path); + +        ret = dict_get_str (this->options, "hostname", &_private->hostname); +        if (ret) { +                _private->hostname = GF_CALLOC (256, sizeof (char), +                                                gf_common_mt_char); +                if (!_private->hostname) { +                        goto out; +                } +                ret = gethostname (_private->hostname, 256); +                if (ret < 0) { +                        gf_msg (this->name, GF_LOG_WARNING, errno, +                                P_MSG_HOSTNAME_MISSING, +                                "could not find hostname "); +                } +        } +          /* Check for Extended attribute support, if not present, log it */          op_ret = sys_lsetxattr (dir_data->data,                                  "trusted.glusterfs.test", "working", 8, 0); @@ -6904,6 +6936,10 @@ init (xlator_t *this)                                          "mismatching volume-id (%s) received. "                                          "already is a part of volume %s ",                                          tmp_data->data, uuid_utoa (old_uuid)); +                                gf_event (EVENT_POSIX_ALREADY_PART_OF_VOLUME, +                                        "volume-id=%s;brick=%s:%s", +                                        uuid_utoa (old_uuid), +                                       _private->hostname, _private->base_path);                                  ret = -1;                                  goto out;                          } @@ -6913,12 +6949,18 @@ init (xlator_t *this)                                          P_MSG_VOLUME_ID_ABSENT,                                          "Extended attribute trusted.glusterfs."                                          "volume-id is absent"); +                                gf_event (EVENT_POSIX_BRICK_NOT_IN_VOLUME, +                                        "brick=%s:%s", +                                       _private->hostname, _private->base_path);                                  ret = -1;                                  goto out;                  }  else if ((size == -1) && (errno != ENODATA) &&                              (errno != ENOATTR)) {                          /* Wrong 'volume-id' is set, it should be error */ +                        gf_event (EVENT_POSIX_BRICK_VERIFICATION_FAILED, +                                "brick=%s:%s", +                                _private->hostname, _private->base_path);                          gf_msg (this->name, GF_LOG_WARNING, errno,                                  P_MSG_VOLUME_ID_FETCH_FAILED,                                  "%s: failed to fetch volume-id", @@ -6927,6 +6969,9 @@ init (xlator_t *this)                          goto out;                  } else {                          ret = -1; +                        gf_event (EVENT_POSIX_BRICK_VERIFICATION_FAILED, +                                "brick=%s:%s", +                                _private->hostname, _private->base_path);                          gf_msg (this->name, GF_LOG_ERROR, 0,                                  P_MSG_VOLUME_ID_FETCH_FAILED,                                  "failed to fetch proper volume id from export"); @@ -6977,24 +7022,18 @@ init (xlator_t *this)                  }          } +        ret = 0; +          size = sys_lgetxattr (dir_data->data, POSIX_ACL_ACCESS_XATTR,                                NULL, 0); -        if ((size < 0) && (errno == ENOTSUP)) +        if ((size < 0) && (errno == ENOTSUP)) {                  gf_msg (this->name, GF_LOG_WARNING, errno,                          P_MSG_ACL_NOTSUP,                          "Posix access control list is not supported."); - -        ret = 0; -        _private = GF_CALLOC (1, sizeof (*_private), -                              gf_posix_mt_posix_private); -        if (!_private) { -                ret = -1; -                goto out; +                gf_event (EVENT_POSIX_ACL_NOT_SUPPORTED, +                        "brick=%s:%s", _private->hostname, _private->base_path);          } -        _private->base_path = gf_strdup (dir_data->data); -        _private->base_path_length = strlen (_private->base_path); -          /*           * _XOPEN_PATH_MAX is the longest file path len we MUST           * support according to POSIX standard. When prepended @@ -7032,21 +7071,6 @@ init (xlator_t *this)          LOCK_INIT (&_private->lock); -        ret = dict_get_str (this->options, "hostname", &_private->hostname); -        if (ret) { -                _private->hostname = GF_CALLOC (256, sizeof (char), -                                                gf_common_mt_char); -                if (!_private->hostname) { -                        goto out; -                } -                ret = gethostname (_private->hostname, 256); -                if (ret < 0) { -                        gf_msg (this->name, GF_LOG_WARNING, errno, -                                P_MSG_HOSTNAME_MISSING, -                                "could not find hostname "); -                } -        } -          _private->export_statfs = 1;          tmp_data = dict_get (this->options, "export-statfs-size");          if (tmp_data) {  | 
