summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2016-07-14 12:30:12 +0530
committerJeff Darcy <jdarcy@redhat.com>2016-07-21 04:46:50 -0700
commite1de869f168e4dadd68fb18a1be53b65cac39880 (patch)
treee123428ed1771d2130e2e008e7b0433fef952c08
parent301e4e8366759c45aaff03a7953ab5248b5f61de (diff)
feature/bitrot: Fix scrub status with sharded volume
Backport of http://review.gluster.org/14927 Bitrot scrubs each shard entries separately. Scrub statistics was counting each shard entry which is incorrect. This patch skips the statistics count for sharded entries. Change-Id: I184c315a4bc7f2cccabc506eef083ee926ec26d3 BUG: 1357973 Signed-off-by: Kotresh HR <khiremat@redhat.com> (cherry picked from commit 1929141da34d36f537e9798e3618e0e3bdc61eb6) Reviewed-on: http://review.gluster.org/14958 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
-rw-r--r--xlators/features/bit-rot/src/bitd/bit-rot-scrub.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c
index c09213880ab..95ad847bdec 100644
--- a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c
+++ b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c
@@ -94,7 +94,8 @@ bitd_scrub_post_compute_check (xlator_t *this,
br_child_t *child,
fd_t *fd, unsigned long version,
br_isignature_out_t **signature,
- br_scrub_stats_t *scrub_stat)
+ br_scrub_stats_t *scrub_stat,
+ gf_boolean_t skip_stat)
{
int32_t ret = 0;
size_t signlen = 0;
@@ -103,7 +104,8 @@ bitd_scrub_post_compute_check (xlator_t *this,
ret = bitd_fetch_signature (this, child, fd, &xattr, &signptr);
if (ret < 0) {
- br_inc_unsigned_file_count (scrub_stat);
+ if (!skip_stat)
+ br_inc_unsigned_file_count (scrub_stat);
goto out;
}
@@ -116,7 +118,8 @@ bitd_scrub_post_compute_check (xlator_t *this,
* The log entry looks pretty ugly, but helps in debugging..
*/
if (signptr->stale || (signptr->version != version)) {
- br_inc_unsigned_file_count (scrub_stat);
+ if (!skip_stat)
+ br_inc_unsigned_file_count (scrub_stat);
gf_msg_debug (this->name, 0, "<STAGE: POST> Object [GFID: %s] "
"either has a stale signature OR underwent "
"signing during checksumming {Stale: %d | "
@@ -145,7 +148,7 @@ static int32_t
bitd_signature_staleness (xlator_t *this,
br_child_t *child, fd_t *fd,
int *stale, unsigned long *version,
- br_scrub_stats_t *scrub_stat)
+ br_scrub_stats_t *scrub_stat, gf_boolean_t skip_stat)
{
int32_t ret = -1;
dict_t *xattr = NULL;
@@ -153,7 +156,8 @@ bitd_signature_staleness (xlator_t *this,
ret = bitd_fetch_signature (this, child, fd, &xattr, &signptr);
if (ret < 0) {
- br_inc_unsigned_file_count (scrub_stat);
+ if (!skip_stat)
+ br_inc_unsigned_file_count (scrub_stat);
goto out;
}
@@ -181,7 +185,8 @@ bitd_signature_staleness (xlator_t *this,
int32_t
bitd_scrub_pre_compute_check (xlator_t *this, br_child_t *child,
fd_t *fd, unsigned long *version,
- br_scrub_stats_t *scrub_stat)
+ br_scrub_stats_t *scrub_stat,
+ gf_boolean_t skip_stat)
{
int stale = 0;
int32_t ret = -1;
@@ -194,9 +199,10 @@ bitd_scrub_pre_compute_check (xlator_t *this, br_child_t *child,
}
ret = bitd_signature_staleness (this, child, fd, &stale, version,
- scrub_stat);
+ scrub_stat, skip_stat);
if (!ret && stale) {
- br_inc_unsigned_file_count (scrub_stat);
+ if (!skip_stat)
+ br_inc_unsigned_file_count (scrub_stat);
gf_msg_debug (this->name, 0, "<STAGE: PRE> Object [GFID: %s] "
"has stale signature",
uuid_utoa (fd->inode->gfid));
@@ -293,6 +299,9 @@ br_scrubber_scrub_begin (xlator_t *this, struct br_fsscan_entry *fsentry)
gf_dirent_t *entry = NULL;
br_private_t *priv = NULL;
loc_t *parent = NULL;
+ gf_boolean_t skip_stat = _gf_false;
+ uuid_t shard_root_gfid = {0,};
+
GF_VALIDATE_OR_GOTO ("bit-rot", fsentry, out);
@@ -335,6 +344,10 @@ br_scrubber_scrub_begin (xlator_t *this, struct br_fsscan_entry *fsentry)
goto unref_inode;
}
+ /* skip updating scrub statistics for shard entries */
+ gf_uuid_parse (SHARD_ROOT_GFID, shard_root_gfid);
+ if (gf_uuid_compare (loc.pargfid, shard_root_gfid) == 0)
+ skip_stat = _gf_true;
/**
* open() an fd for subsequent opertaions
*/
@@ -362,7 +375,7 @@ br_scrubber_scrub_begin (xlator_t *this, struct br_fsscan_entry *fsentry)
* - signature staleness
*/
ret = bitd_scrub_pre_compute_check (this, child, fd, &signedversion,
- &priv->scrub_stat);
+ &priv->scrub_stat, skip_stat);
if (ret)
goto unrefd; /* skip this object */
@@ -386,15 +399,16 @@ br_scrubber_scrub_begin (xlator_t *this, struct br_fsscan_entry *fsentry)
* become stale while scrubber calculated checksum.
*/
ret = bitd_scrub_post_compute_check (this, child, fd, signedversion,
- &sign, &priv->scrub_stat);
+ &sign, &priv->scrub_stat,
+ skip_stat);
if (ret)
goto free_md;
ret = bitd_compare_ckum (this, sign, md,
linked_inode, entry, fd, child, &loc);
- /* Increment of total number of scrubbed file counter */
- br_inc_scrubbed_file (&priv->scrub_stat);
+ if (!skip_stat)
+ br_inc_scrubbed_file (&priv->scrub_stat);
GF_FREE (sign); /* alloced on post-compute */