- if (rc == 0) {
- th->th_sync = 1; /* sync IO is needed */
- rc = dt_trans_start_local(&env, ofd->ofd_osd, th);
- if (rc == 0)
- rc = dt_record_write(&env, ofd->ofd_health_check_file,
- &info->fti_buf, &info->fti_off,
- th);
- }
- dt_trans_stop(&env, ofd->ofd_osd, th);
+ if (rc)
+ goto out_stop;
+
+ th->th_sync = 1; /* sync IO is needed */
+ rc = dt_trans_start_local(&env, ofd->ofd_osd, th);
+
+ if (rc)
+ goto out_stop;
+
+ rc = dt_record_write(&env, ofd->ofd_health_check_file,
+ &info->fti_buf, &info->fti_off,
+ th);
+
+out_stop:
+ rc1 = dt_trans_stop(&env, ofd->ofd_osd, th);
+ rc = rc ? rc : rc1;