From 60b6e5d2c3442ea0f7f85374d6613cd0dd76604c Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Wed, 27 May 2015 17:00:36 +0530 Subject: 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 Reviewed-on: http://review.gluster.org/10947 Reviewed-by: Venky Shankar Tested-by: Venky Shankar Tested-by: Gluster Build System --- xlators/features/bit-rot/src/bitd/bit-rot.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'xlators/features/bit-rot/src/bitd') 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); -- cgit