cb8e9e
From a7243a35ee2f6f1c891ebd12bd38dadb22d4709b Mon Sep 17 00:00:00 2001
cb8e9e
From: vmallika <vmallika@redhat.com>
cb8e9e
Date: Thu, 13 Aug 2015 14:16:45 +0530
cb8e9e
Subject: [PATCH 262/279] quota/marker: set log-level to debug for ESTALE/ENOENT for marker txn
cb8e9e
cb8e9e
This is a backport of http://review.gluster.org/11736
cb8e9e
cb8e9e
For all marker txn, it is possible that while the txn in progress
cb8e9e
file can be removed.
cb8e9e
cb8e9e
So log all ENOENT/ESTALE error in debug level
cb8e9e
cb8e9e
> Change-Id: I776ba3cda33fe992f9dcc7baede7206c4ce19553
cb8e9e
> BUG: 1245544
cb8e9e
> Signed-off-by: vmallika <vmallika@redhat.com>
cb8e9e
> Reviewed-on: http://review.gluster.org/11736
cb8e9e
> Tested-by: Gluster Build System <jenkins@build.gluster.com>
cb8e9e
> Tested-by: NetBSD Build System <jenkins@build.gluster.org>
cb8e9e
> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
cb8e9e
cb8e9e
BUG: 1245542
cb8e9e
Change-Id: I44fdb860fb941f877e6ed12e8e9690369f45b9fa
cb8e9e
Signed-off-by: vmallika <vmallika@redhat.com>
cb8e9e
Reviewed-on: https://code.engineering.redhat.com/gerrit/55063
cb8e9e
Reviewed-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
cb8e9e
Tested-by: Raghavendra Gowdappa <rgowdapp@redhat.com>
cb8e9e
---
cb8e9e
 xlators/features/marker/src/marker-quota.c |   91 ++++++++++------------------
cb8e9e
 1 files changed, 33 insertions(+), 58 deletions(-)
cb8e9e
cb8e9e
diff --git a/xlators/features/marker/src/marker-quota.c b/xlators/features/marker/src/marker-quota.c
cb8e9e
index f65ed77..6ccd974 100644
cb8e9e
--- a/xlators/features/marker/src/marker-quota.c
cb8e9e
+++ b/xlators/features/marker/src/marker-quota.c
cb8e9e
@@ -2183,9 +2183,9 @@ mq_are_xattrs_set (xlator_t *this, loc_t *loc, gf_boolean_t *result,
cb8e9e
         ret = syncop_lookup (FIRST_CHILD(this), loc, &stbuf, NULL,
cb8e9e
                              dict, &rsp_dict);
cb8e9e
         if (ret < 0) {
cb8e9e
-                gf_log (this->name, (-ret == ENOENT || -ret == ESTALE)
cb8e9e
-                        ? GF_LOG_DEBUG:GF_LOG_ERROR, "lookup failed "
cb8e9e
-                        "for %s: %s", loc->path, strerror (-ret));
cb8e9e
+                gf_log_callingfn (this->name, (-ret == ENOENT || -ret == ESTALE)
cb8e9e
+                                  ? GF_LOG_DEBUG:GF_LOG_ERROR, "lookup failed "
cb8e9e
+                                  "for %s: %s", loc->path, strerror (-ret));
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -2272,13 +2272,13 @@ mq_create_xattrs (xlator_t *this, quota_inode_ctx_t *ctx, loc_t *loc,
cb8e9e
                         goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
-        ret = syncop_xattrop(FIRST_CHILD(this), loc, GF_XATTROP_ADD_ARRAY64,
cb8e9e
-                             dict, NULL, NULL);
cb8e9e
+        ret = syncop_xattrop (FIRST_CHILD(this), loc, GF_XATTROP_ADD_ARRAY64,
cb8e9e
+                              dict, NULL, NULL);
cb8e9e
 
cb8e9e
         if (ret < 0) {
cb8e9e
-                gf_log (this->name, (-ret == ENOENT || -ret == ESTALE)
cb8e9e
-                        ? GF_LOG_DEBUG:GF_LOG_ERROR, "xattrop failed "
cb8e9e
-                        "for %s: %s", loc->path, strerror (-ret));
cb8e9e
+                gf_log_callingfn (this->name, (-ret == ENOENT || -ret == ESTALE)
cb8e9e
+                                  ? GF_LOG_DEBUG:GF_LOG_ERROR, "xattrop failed "
cb8e9e
+                                  "for %s: %s", loc->path, strerror (-ret));
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -2312,9 +2312,9 @@ mq_lock (xlator_t *this, loc_t *loc, short l_type)
cb8e9e
         ret = syncop_inodelk (FIRST_CHILD(this), this->name, loc, F_SETLKW,
cb8e9e
                               &lock, NULL, NULL);
cb8e9e
         if (ret < 0)
cb8e9e
-                gf_log (this->name, (-ret == ENOENT || -ret == ESTALE)
cb8e9e
-                        ? GF_LOG_DEBUG:GF_LOG_ERROR, "inodelk failed "
cb8e9e
-                        "for %s: %s", loc->path, strerror (-ret));
cb8e9e
+                gf_log_callingfn (this->name, (-ret == ENOENT || -ret == ESTALE)
cb8e9e
+                                  ? GF_LOG_DEBUG:GF_LOG_ERROR, "inodelk failed "
cb8e9e
+                                  "for %s: %s", loc->path, strerror (-ret));
cb8e9e
 
cb8e9e
 out:
cb8e9e
 
cb8e9e
@@ -2345,9 +2345,9 @@ mq_get_dirty (xlator_t *this, loc_t *loc, int32_t *dirty)
cb8e9e
         ret = syncop_lookup (FIRST_CHILD(this), loc, &stbuf, NULL,
cb8e9e
                              dict, &rsp_dict);
cb8e9e
         if (ret < 0) {
cb8e9e
-                gf_log (this->name, (-ret == ENOENT || -ret == ESTALE)
cb8e9e
-                        ? GF_LOG_DEBUG:GF_LOG_ERROR, "lookup failed "
cb8e9e
-                        "for %s: %s", loc->path, strerror (-ret));
cb8e9e
+                gf_log_callingfn (this->name, (-ret == ENOENT || -ret == ESTALE)
cb8e9e
+                                  ? GF_LOG_DEBUG:GF_LOG_ERROR, "lookup failed "
cb8e9e
+                                  "for %s: %s", loc->path, strerror (-ret));
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -2391,7 +2391,7 @@ mq_mark_dirty (xlator_t *this, loc_t *loc, int32_t dirty)
cb8e9e
 
cb8e9e
         ret = syncop_setxattr (FIRST_CHILD(this), loc, dict, 0, NULL, NULL);
cb8e9e
         if (ret < 0) {
cb8e9e
-                gf_log (this->name, (-ret == ENOENT || -ret == ESTALE)
cb8e9e
+                gf_log_callingfn (this->name, (-ret == ENOENT || -ret == ESTALE)
cb8e9e
                         ? GF_LOG_DEBUG:GF_LOG_ERROR, "setxattr dirty = %d "
cb8e9e
                         "failed for %s: %s", dirty, loc->path, strerror (-ret));
cb8e9e
                 goto out;
cb8e9e
@@ -2458,9 +2458,9 @@ _mq_get_metadata (xlator_t *this, loc_t *loc, quota_meta_t *contri,
cb8e9e
         ret = syncop_lookup (FIRST_CHILD(this), loc, &stbuf, NULL,
cb8e9e
                              dict, &rsp_dict);
cb8e9e
         if (ret < 0) {
cb8e9e
-                gf_log (this->name, (-ret == ENOENT || -ret == ESTALE)
cb8e9e
-                        ? GF_LOG_DEBUG:GF_LOG_ERROR, "lookup failed "
cb8e9e
-                        "for %s: %s", loc->path, strerror (-ret));
cb8e9e
+                gf_log_callingfn (this->name, (-ret == ENOENT || -ret == ESTALE)
cb8e9e
+                                  ? GF_LOG_DEBUG:GF_LOG_ERROR, "lookup failed "
cb8e9e
+                                  "for %s: %s", loc->path, strerror (-ret));
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -2527,11 +2527,8 @@ mq_get_metadata (xlator_t *this, loc_t *loc, quota_meta_t *contri,
cb8e9e
         }
cb8e9e
 
cb8e9e
         ret = _mq_get_metadata (this, loc, contri, size, contribution->gfid);
cb8e9e
-        if (ret < 0) {
cb8e9e
-                gf_log_callingfn (this->name, GF_LOG_ERROR, "Failed to get "
cb8e9e
-                                  "metadata for %s", loc->path);
cb8e9e
+        if (ret < 0)
cb8e9e
                 goto out;
cb8e9e
-        }
cb8e9e
 
cb8e9e
         if (size) {
cb8e9e
                 LOCK (&ctx->lock);
cb8e9e
@@ -2560,34 +2557,14 @@ out:
cb8e9e
 int32_t
cb8e9e
 mq_get_size (xlator_t *this, loc_t *loc, quota_meta_t *size)
cb8e9e
 {
cb8e9e
-        int32_t         ret      = -1;
cb8e9e
-
cb8e9e
-        ret = _mq_get_metadata (this, loc, NULL, size, 0);
cb8e9e
-        if (ret < 0) {
cb8e9e
-                gf_log_callingfn (this->name, GF_LOG_ERROR, "Failed to get "
cb8e9e
-                                  "metadata for %s", loc->path);
cb8e9e
-                goto out;
cb8e9e
-        }
cb8e9e
-
cb8e9e
-out:
cb8e9e
-        return ret;
cb8e9e
+        return _mq_get_metadata (this, loc, NULL, size, 0);
cb8e9e
 }
cb8e9e
 
cb8e9e
 int32_t
cb8e9e
 mq_get_contri (xlator_t *this, loc_t *loc, quota_meta_t *contri,
cb8e9e
                uuid_t contri_gfid)
cb8e9e
 {
cb8e9e
-        int32_t         ret      = -1;
cb8e9e
-
cb8e9e
-        ret = _mq_get_metadata (this, loc, contri, NULL, contri_gfid);
cb8e9e
-        if (ret < 0) {
cb8e9e
-                gf_log_callingfn (this->name, GF_LOG_ERROR, "Failed to get "
cb8e9e
-                                  "metadata for %s", loc->path);
cb8e9e
-                goto out;
cb8e9e
-        }
cb8e9e
-
cb8e9e
-out:
cb8e9e
-        return ret;
cb8e9e
+        return _mq_get_metadata (this, loc, contri, NULL, contri_gfid);
cb8e9e
 }
cb8e9e
 
cb8e9e
 int32_t
cb8e9e
@@ -2642,9 +2619,10 @@ mq_remove_contri (xlator_t *this, loc_t *loc, quota_inode_ctx_t *ctx,
cb8e9e
                          */
cb8e9e
                         ret = 0;
cb8e9e
                 } else {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR, "removexattr %s "
cb8e9e
-                                "failed for %s: %s", contri_key, loc->path,
cb8e9e
-                                strerror (-ret));
cb8e9e
+                        gf_log_callingfn (this->name, GF_LOG_ERROR,
cb8e9e
+                                          "removexattr %s failed for %s: %s",
cb8e9e
+                                          contri_key, loc->path,
cb8e9e
+                                          strerror (-ret));
cb8e9e
                         goto out;
cb8e9e
                 }
cb8e9e
         }
cb8e9e
@@ -2706,9 +2684,9 @@ mq_update_contri (xlator_t *this, loc_t *loc, inode_contribution_t *contri,
cb8e9e
         ret = syncop_xattrop(FIRST_CHILD(this), loc, GF_XATTROP_ADD_ARRAY64,
cb8e9e
                              dict, NULL, NULL);
cb8e9e
         if (ret < 0) {
cb8e9e
-                gf_log (this->name, (-ret == ENOENT || -ret == ESTALE)
cb8e9e
-                        ? GF_LOG_DEBUG:GF_LOG_ERROR, "xattrop failed "
cb8e9e
-                        "for %s: %s", loc->path, strerror (-ret));
cb8e9e
+                gf_log_callingfn (this->name, (-ret == ENOENT || -ret == ESTALE)
cb8e9e
+                                  ? GF_LOG_DEBUG:GF_LOG_ERROR, "xattrop failed "
cb8e9e
+                                  "for %s: %s", loc->path, strerror (-ret));
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -2765,9 +2743,9 @@ mq_update_size (xlator_t *this, loc_t *loc, quota_meta_t *delta)
cb8e9e
         ret = syncop_xattrop(FIRST_CHILD(this), loc, GF_XATTROP_ADD_ARRAY64,
cb8e9e
                              dict, NULL, NULL);
cb8e9e
         if (ret < 0) {
cb8e9e
-                gf_log (this->name, (-ret == ENOENT || -ret == ESTALE)
cb8e9e
-                        ? GF_LOG_DEBUG:GF_LOG_ERROR, "xattrop failed "
cb8e9e
-                        "for %s: %s", loc->path, strerror (-ret));
cb8e9e
+                gf_log_callingfn (this->name, (-ret == ENOENT || -ret == ESTALE)
cb8e9e
+                                  ? GF_LOG_DEBUG:GF_LOG_ERROR, "xattrop failed "
cb8e9e
+                                  "for %s: %s", loc->path, strerror (-ret));
cb8e9e
                 goto out;
cb8e9e
         }
cb8e9e
 
cb8e9e
@@ -2949,15 +2927,12 @@ mq_start_quota_txn_v2 (xlator_t *this, loc_t *loc, quota_inode_ctx_t *ctx,
cb8e9e
                 dirty = _gf_true;
cb8e9e
 
cb8e9e
                 ret = mq_update_contri (this, &child_loc, contri, &delta);
cb8e9e
-                if (ret < 0) {
cb8e9e
-                        gf_log (this->name, GF_LOG_ERROR, "contri "
cb8e9e
-                                "update failed for %s", child_loc.path);
cb8e9e
+                if (ret < 0)
cb8e9e
                         goto out;
cb8e9e
-                }
cb8e9e
 
cb8e9e
                 ret = mq_update_size (this, &parent_loc, &delta);
cb8e9e
                 if (ret < 0) {
cb8e9e
-                        gf_log (this->name, GF_LOG_WARNING, "rollback "
cb8e9e
+                        gf_log (this->name, GF_LOG_DEBUG, "rollback "
cb8e9e
                                 "contri updation");
cb8e9e
                         mq_sub_meta (&delta, NULL);
cb8e9e
                         mq_update_contri (this, &child_loc, contri, &delta);
cb8e9e
-- 
cb8e9e
1.7.1
cb8e9e