summaryrefslogtreecommitdiffstats
path: root/xlators/features/bit-rot/src/bitd
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendra@redhat.com>2015-05-27 17:00:36 +0530
committerVenky Shankar <vshankar@redhat.com>2015-06-15 20:07:18 -0700
commit60b6e5d2c3442ea0f7f85374d6613cd0dd76604c (patch)
tree33d298b9091869a4f3b68ec511bf4c23e48fe1bc /xlators/features/bit-rot/src/bitd
parent05a17a087ec8d50d1b5341ab1a7fbf18cdabcb92 (diff)
features/bit-rot: check for both inmemory and ondisk staleness
* Let bit-rot stub check both on disk ongoing version, signed version xattrs and the in memory flags in the inode and then decide whether the inode is stale or not. This information is used by one shot crawler in BitD to decide whether to trigger the sign for the object or skip it. NOTE: The above check should be done only for BitD. For scrubber its still the old way of comparing on disk ongoing version with signed version. * BitD's one shot crawler should not sign zero byte objects if they do not contain signature. (Means the object was just created and nothing was written to it). Change-Id: I6941aefc2981bf79a6aeb476e660f79908e165a8 BUG: 1224611 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-on: http://review.gluster.org/10947 Reviewed-by: Venky Shankar <vshankar@redhat.com> Tested-by: Venky Shankar <vshankar@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/features/bit-rot/src/bitd')
-rw-r--r--xlators/features/bit-rot/src/bitd/bit-rot.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.c b/xlators/features/bit-rot/src/bitd/bit-rot.c
index 651c42fcb82..03fd1c2f1ab 100644
--- a/xlators/features/bit-rot/src/bitd/bit-rot.c
+++ b/xlators/features/bit-rot/src/bitd/bit-rot.c
@@ -853,7 +853,6 @@ br_check_object_need_sign (xlator_t *this, dict_t *xattr, br_child_t *child)
{
int32_t ret = -1;
gf_boolean_t need_sign = _gf_false;
- struct timeval tv = {0,};
br_isignature_out_t *sign = NULL;
GF_VALIDATE_OR_GOTO ("bit-rot", this, out);
@@ -868,11 +867,8 @@ br_check_object_need_sign (xlator_t *this, dict_t *xattr, br_child_t *child)
goto out;
}
- tv.tv_sec = ntohl (sign->time[0]);
- tv.tv_usec = ntohl (sign->time[1]);
-
/* Object has been opened and hence dirty. Do not sign it */
- if (sign->stale && !br_time_equal (child, &tv))
+ if (sign->stale)
need_sign = _gf_true;
out:
@@ -1002,7 +998,11 @@ bitd_oneshot_crawl (xlator_t *subvol,
op_errno = -ret;
br_log_object (this, "getxattr", linked_inode->gfid, op_errno);
- if (op_errno == ENODATA)
+ /**
+ * No need to sign the zero byte objects as the signing
+ * happens upon first modification of the object.
+ */
+ if (op_errno == ENODATA && (iatt.ia_size != 0))
need_signing = _gf_true;
if (op_errno == EINVAL)
gf_log (this->name, GF_LOG_WARNING, "Partial version "
@@ -1231,7 +1231,7 @@ br_brick_connect (xlator_t *this, br_child_t *child)
memcpy (child->brick_path, stub->export, strlen (stub->export) + 1);
child->tv.tv_sec = ntohl (stub->timebuf[0]);
- child->tv.tv_usec = ntohl (stub->timebuf[0]);
+ child->tv.tv_usec = ntohl (stub->timebuf[1]);
if (priv->iamscrubber)
ret = br_enact_scrubber (this, child);