fellow_cache: Handle FCO write errors

parent 88296a05
......@@ -3421,6 +3421,7 @@ fellow_cache_async_write_complete(struct fellow_cache *fc,
struct fellow_busy *fbo;
struct fellow_cache_seg *fcs = NULL;
struct fellow_cache_obj *fco;
struct fellow_cache_res fcr;
struct fellow_disk_obj *fdo, *fdo2;
enum fcos_state fcos_next = FCOS_INVAL;
enum fellow_busy_io_e type;
......@@ -3455,20 +3456,11 @@ fellow_cache_async_write_complete(struct fellow_cache *fc,
assert(fcs->fco == fco);
assert(fcs->alloc.size <= INT32_MAX);
#ifdef TODO_WRITE_ERR
if (FC_INJ || result < (int32_t)fcs->alloc.size) {
if (fc->tune->ioerr_obj == 0)
FC_WRONG("write error result %d size %d",
result, (int32_t)fcs->alloc.size);
// XXX handle
INCOMPL();
}
#else
if (result < (int32_t)fcs->alloc.size) {
FC_WRONG("write error result %d size %d",
result, (int32_t)fcs->alloc.size);
}
#endif
if (FC_INJ || result < (int32_t)fcs->alloc.size)
fcr = FCR_IOFAIL("fcs write error");
else
fcr = FCR_OK(fco);
assert(FCOS(fcs->state) == FCOS_WRITING);
fcos_next = (typeof(fcos_next))
......@@ -3482,13 +3474,10 @@ fellow_cache_async_write_complete(struct fellow_cache *fc,
}
} else {
assert(type == FBIO_SEGLIST);
if (result < (int32_t)fbio->u.seglist.reg.size) {
if (fc->tune->ioerr_obj == 0)
FC_WRONG("write error result %d size %ld",
result, fbio->u.seglist.reg.size);
// XXX handle
INCOMPL();
}
if (result < (int32_t)fbio->u.seglist.reg.size)
fcr = FCR_IOFAIL("seglist write error");
else
fcr = FCR_OK(fco);
}
/* we keep the FCO writing until all else is written
......@@ -3513,13 +3502,16 @@ fellow_cache_async_write_complete(struct fellow_cache *fc,
AZ(pthread_cond_broadcast(&fco->cond));
}
}
/*
* We latch an error, but _still_ add the object to the log, such that
* fellow_cache_obj_delete() can do a thin delete
*/
(void) fellow_cache_obj_res(fc, fco, fcr);
//lint --e{456} Two execution paths are being combined...
//lint --e{454} A thread mutex has been locked...
if (io_outstanding == 0) {
/* XXX if error, make object mem only and
* free disk space
*/
switch (fco->logstate) {
case FCOL_WANTLOG:
/* fellow_cache_obj_delete() can not race
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment