summaryrefslogtreecommitdiffstats
path: root/xlators/features/bit-rot/src/bitd/bit-rot.c
diff options
context:
space:
mode:
authorVenky Shankar <vshankar@redhat.com>2015-03-31 15:48:18 +0530
committerVijay Bellur <vbellur@redhat.com>2015-04-08 07:01:32 +0000
commitf0cd1d73c63001740cd7691a77df7631c9b8e8dc (patch)
tree336a8ee694dc71a2fde6927d8a40682bef6368ef /xlators/features/bit-rot/src/bitd/bit-rot.c
parent7fb55dbdabf73f9169b0f3021a42fa120d64b373 (diff)
bitrot/scrub: Scrubber fixes
This patch fixes a handful of problem with scrubber which are detailed below. Scrubber used to skip objects for verification due to missing fd iterface to fetch versioning extended attributes. Similar to the inode interface, an fd based interface in POSIX is now introduced. Moreover, this patch also fixes potential false reporting by scrubber due to: An object gets dirtied and signed when scrubber is busy calculatingobject checksum. This is fixed by caching the signed version when an object is first inspected for stalenes, i.e., during pre-compute stage. This version is used to verify checksum in the post-compute stage when the signatures are compared for possible corruption. Side effect of _not_ sending signature length during signing resulted in "truncated" signature to be set for an object. Now, at the time of signing, the signature length is sent and is used in place of invoking strlen() to get signature length (which could have possible 00s). The signature length itself is not persisted in the signature xattr, but is calculated on-the-fly by substracting the xattr length by the "structure" header size. Some of the log entries are made more meaningful (as and aid for debugging). Change-Id: I938bee5aea6688d5d99eb2640053613af86d6269 BUG: 1207624 Signed-off-by: Venky Shankar <vshankar@redhat.com> Reviewed-on: http://review.gluster.org/10118 Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/features/bit-rot/src/bitd/bit-rot.c')
-rw-r--r--xlators/features/bit-rot/src/bitd/bit-rot.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/xlators/features/bit-rot/src/bitd/bit-rot.c b/xlators/features/bit-rot/src/bitd/bit-rot.c
index d808c0d..6a4de70 100644
--- a/xlators/features/bit-rot/src/bitd/bit-rot.c
+++ b/xlators/features/bit-rot/src/bitd/bit-rot.c
@@ -139,8 +139,14 @@ br_prepare_signature (const unsigned char *sign,
if (!signature)
return NULL;
+ /* object version */
signature->signedversion = object->signedversion;
+
+ /* signature length & type */
+ signature->signaturelen = hashlen;
signature->signaturetype = hashtype;
+
+ /* signature itself */
memcpy (signature->signature, (char *)sign, hashlen);
signature->signature[hashlen+1] = '\0';
@@ -167,7 +173,7 @@ bitd_is_bad_file (xlator_t *this, br_child_t *child, loc_t *loc, fd_t *fd)
"trusted.glusterfs.bad-file", NULL);
if (!ret) {
- gf_log (this->name, GF_LOG_ERROR, "[GFID: %s] is marked "
+ gf_log (this->name, GF_LOG_DEBUG, "[GFID: %s] is marked "
"corrupted", uuid_utoa (inode->gfid));
bad_file = _gf_true;
}
@@ -918,8 +924,11 @@ bitd_oneshot_crawl (xlator_t *subvol,
* if there are any fds present for that inode) and handle properly.
*/
- if (bitd_is_bad_file (this, child, &loc, NULL))
+ if (bitd_is_bad_file (this, child, &loc, NULL)) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "Entry [%s] is marked corrupted.. skipping.", loc.path);
goto unref_inode;
+ }
ret = syncop_getxattr (child->xl, &loc, &xattr,
GLUSTERFS_GET_OBJECT_SIGNATURE, NULL);