diff options
Diffstat (limited to 'xlators/cluster/nsr-recon/src/recon_driver.c')
-rw-r--r-- | xlators/cluster/nsr-recon/src/recon_driver.c | 43 |
1 files changed, 4 insertions, 39 deletions
diff --git a/xlators/cluster/nsr-recon/src/recon_driver.c b/xlators/cluster/nsr-recon/src/recon_driver.c index 49ee465c5..1e68414ee 100644 --- a/xlators/cluster/nsr-recon/src/recon_driver.c +++ b/xlators/cluster/nsr-recon/src/recon_driver.c @@ -213,16 +213,18 @@ get_xattr_total_size( struct glfs_fd *fd, // First get the size of the keys s = glfs_flistxattr_with_xdata(fd, NULL,0, dict); - if (s == -1) + if (s == -1) { goto out; + } *key_size = s; // TBD - use the regular calloc (*b) = c = calloc(s+1,1); // get the keys themselves - if (glfs_flistxattr_with_xdata(fd, c, s+1, dict) == -1) + if (glfs_flistxattr_with_xdata(fd, c, s+1, dict) == -1) { goto out; + } do { int32_t r; uint32_t len = 0; @@ -1502,28 +1504,24 @@ apply_record(nsr_per_node_worker_t *ctx, fd = glfs_h_open_with_xdata(ctx->fs, obj, O_RDWR, dict); if (fd == NULL) { - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "open for file %s failed\n", ri->rec.gfid); return _gf_false; } if (glfs_lseek_with_xdata(fd, ri->rec.offset, SEEK_SET, dict) != ri->rec.offset) { - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "lseek for file %s failed at offset %d\n", ri->rec.gfid, ri->rec.offset); return _gf_false; } if (glfs_write_with_xdata(fd, ri->work.data, ri->rec.len, 0, dict) != ri->rec.len) { - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "write for file %s failed for bytes %d\n", ri->rec.gfid, ri->rec.len); return _gf_false; } if (glfs_close_with_xdata(fd, dict) == -1) { - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "close failed\n"); return _gf_false; @@ -1543,21 +1541,18 @@ apply_record(nsr_per_node_worker_t *ctx, fd = glfs_h_open_with_xdata(ctx->fs, obj, O_RDWR, dict); if (fd == NULL) { - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "open for file %s failed\n", ri->rec.gfid); return _gf_false; } if (glfs_ftruncate_with_xdata(fd, ri->rec.offset, dict) == -1) { - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "trunctae for file %s failed @offset %d\n", ri->rec.gfid,ri->rec.offset ); return _gf_false; } if (glfs_close_with_xdata(fd, dict) == -1) { - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "close failed\n"); return _gf_false; @@ -1594,7 +1589,6 @@ apply_record(nsr_per_node_worker_t *ctx, else fd = glfs_h_open_with_xdata(ctx->fs, obj, O_RDWR, dict); if (fd == NULL) { - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "open for file %s failed\n", ri->rec.gfid); @@ -1603,14 +1597,12 @@ apply_record(nsr_per_node_worker_t *ctx, if(get_xattr_total_size(fd, &t_b, &k_s, &v_s, &num, dict) == -1) { if (t_b) free(t_b); - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "list of xattr of %s failed\n", ri->rec.gfid); return _gf_false; } if (delete_xattr(fd, dict, t_b, num) == -1) { - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "deleting xattrs failed\n"); return _gf_false; @@ -1619,21 +1611,18 @@ apply_record(nsr_per_node_worker_t *ctx, // Set one special dict flag to indicate the opcode so that // the opcode gets set to this if (dict_set_int32(dict,"recon-xattr-opcode",ri->rec.op)) { - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "setting opcode to %d failed\n",ri->rec.op); return _gf_false; } if (fill_xattr(fd, dict, ri->work.data, ri->work.num) == -1) { - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "filling xattrs failed\n"); return _gf_false; } if (glfs_close_with_xdata(fd, dict) == -1) { - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "close failed\n"); return _gf_false; @@ -1658,7 +1647,6 @@ apply_record(nsr_per_node_worker_t *ctx, nsr_worker_log (this->name, GF_LOG_INFO, "creating with mode 0%o", ri->rec.mode); if (glfs_h_creat_with_xdata(ctx->fs, obj, ri->rec.entry, O_RDWR, ri->rec.mode, NULL, gfid, dict) == NULL) { - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "Failure for Doing create for file %s\n", ri->rec.entry); @@ -1682,7 +1670,6 @@ apply_record(nsr_per_node_worker_t *ctx, if ((obj = create_obj(ctx, ri->rec.pargfid)) == NULL) return _gf_false; if (glfs_h_mknod_with_xdata(ctx->fs, obj, ri->rec.entry, O_RDWR, 0777, NULL, gfid, dict) == NULL) { - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "Failure for Doing mknod for file %s\n", ri->rec.entry); @@ -1706,7 +1693,6 @@ apply_record(nsr_per_node_worker_t *ctx, if ((obj = create_obj(ctx, ri->rec.pargfid)) == NULL) return _gf_false; if (glfs_h_mkdir_with_xdata(ctx->fs, obj, ri->rec.entry, 0777, NULL, gfid, dict) != 0) { - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "Failure for Doing mkdir for file %s\n", ri->rec.entry); @@ -1725,7 +1711,6 @@ apply_record(nsr_per_node_worker_t *ctx, if ((obj = create_obj(ctx, ri->rec.pargfid)) == NULL) return _gf_false; if (glfs_h_unlink_with_xdata(ctx->fs, obj, ri->rec.entry, dict) != 0) { - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "Failure for Doing rmdir/unlink for file %s\n", ri->rec.entry); @@ -1748,7 +1733,6 @@ apply_record(nsr_per_node_worker_t *ctx, uuid_parse(ri->rec.gfid, gfid); if (glfs_h_symlink_with_xdata(ctx->fs, obj, ri->rec.entry, ri->rec.link_path, NULL, gfid, dict) == NULL) { - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "Failed to Doing symlink for file %s to file %s \n", ri->rec.entry, ri->rec.link_path); @@ -1771,7 +1755,6 @@ apply_record(nsr_per_node_worker_t *ctx, if ((to_obj = create_obj(ctx, ri->rec.gfid)) == NULL) return _gf_false; if (glfs_h_link_with_xdata(ctx->fs, to_obj, obj, ri->rec.entry, dict) == -1) { - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "Failed to Doing hard link for file %s to file %s \n", ri->rec.entry, ri->rec.gfid); @@ -1794,7 +1777,6 @@ apply_record(nsr_per_node_worker_t *ctx, if ((to_obj = create_obj(ctx, ri->rec.gfid)) == NULL) return _gf_false; if (glfs_h_rename_with_xdata(ctx->fs, obj, ri->rec.entry, to_obj, ri->rec.newloc, dict) == -1) { - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "Failed to Doing rename for file %s to file %s \n", ri->rec.entry, ri->rec.newloc); @@ -1826,7 +1808,6 @@ apply_record(nsr_per_node_worker_t *ctx, else fd = glfs_h_open_with_xdata(ctx->fs, obj, O_RDWR, dict); if (fd == NULL) { - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "open for file %s failed\n", ri->rec.gfid); @@ -1840,7 +1821,6 @@ apply_record(nsr_per_node_worker_t *ctx, // Set one special dict flag to indicate the opcode so that // the opcode gets set to this if (dict_set_int32(dict,"recon-attr-opcode",ri->rec.op)) { - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "setting opcode to %d failed\n",ri->rec.op); return _gf_false; @@ -1848,7 +1828,6 @@ apply_record(nsr_per_node_worker_t *ctx, ret = glfs_fsetattr_with_xdata(fd, &iatt, valid, dict); if (ret == -1) { - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_INFO, "failed Doing attr for file %s \n", ri->rec.gfid); @@ -1856,7 +1835,6 @@ apply_record(nsr_per_node_worker_t *ctx, } if (glfs_close_with_xdata(fd, dict) == -1) { - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "close failed\n"); return _gf_false; @@ -1950,21 +1928,18 @@ data_worker_func(nsr_per_node_worker_t *ctx, dict = dict_new (); if (!dict) { ctx->result = -1; - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "failed allocating for dictionary\n"); break; } if (dict_set_int32(dict,RECON_TERM_XATTR,ri->work.term)) { ctx->result = -1; - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "error setting term in dict\n"); break; } if (dict_set_int32(dict,RECON_INDEX_XATTR,ri->work.index)) { ctx->result = -1; - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "error setting term in dict\n"); break; @@ -2004,7 +1979,6 @@ data_worker_func(nsr_per_node_worker_t *ctx, if (glfs_lseek_with_xdata (fd, rd->offset, SEEK_SET, dict) != rd->offset) { - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "lseek of file failed to offset %d\n", rd->offset); @@ -2015,7 +1989,6 @@ data_worker_func(nsr_per_node_worker_t *ctx, gf_mt_recon_private_t); if (glfs_read_with_xdata (fd, ri->work.data, rd->len, 0, dict) != rd->len) { - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "read of file failed to offset %d for bytes %d\n", rd->offset, rd->len); @@ -2084,7 +2057,6 @@ data_worker_func(nsr_per_node_worker_t *ctx, if (get_xattr_total_size (fd, &t_b, &k_s, &v_s, &num, dict) == -1) { if (t_b) free(t_b); - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "list of xattr of gfid %s failed\n", rd->gfid); @@ -2093,7 +2065,6 @@ data_worker_func(nsr_per_node_worker_t *ctx, ri->work.data = GF_CALLOC ((k_s + v_s) , sizeof(char), gf_mt_recon_private_t); if (get_xattr(fd, t_b, ri->work.data, v_s, num, dict) == -1) { - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "get xattr of gfid %s failed\n", rd->gfid); break; @@ -2134,21 +2105,18 @@ data_worker_func(nsr_per_node_worker_t *ctx, dict = dict_new (); if (!dict) { ctx->result = -1; - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "failed allocating for dictionary\n"); break; } if (dict_set_int32(dict,RECON_TERM_XATTR,ri->work.term)) { ctx->result = -1; - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "error setting term in dict\n"); break; } if (dict_set_int32(dict,RECON_INDEX_XATTR,ri->work.index)) { ctx->result = -1; - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "error setting term in dict\n"); break; @@ -2167,21 +2135,18 @@ data_worker_func(nsr_per_node_worker_t *ctx, dict = dict_new (); if (!dict) { ctx->result = -1; - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "failed allocating for dictionary\n"); break; } if (dict_set_int32(dict,RECON_TERM_XATTR,ri->work.term)) { ctx->result = -1; - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "error setting term in dict\n"); break; } if (dict_set_int32(dict,RECON_INDEX_XATTR,ri->work.index)) { ctx->result = -1; - GF_ASSERT(0); nsr_worker_log(this->name, GF_LOG_ERROR, "error setting term in dict\n"); break; |