#define DEBUG_SUBSYSTEM S_LOG
+#include <linux/delay.h>
+
#include <dt_object.h>
#include <llog_swab.h>
#include <lustre_fid.h>
static int llog_osd_exist(struct llog_handle *handle)
{
LASSERT(handle->lgh_obj);
- return dt_object_exists(handle->lgh_obj) &&
- !lu_object_is_dying(handle->lgh_obj->do_lu.lo_header);
+ return dt_object_exists(handle->lgh_obj) && !handle->lgh_destroyed;
}
static void *rec_tail(struct llog_rec_hdr *rec)
RETURN(-ENOSPC);
}
+ down_write(&loghandle->lgh_last_sem);
/* increment the last_idx along with llh_tail index, they should
* be equal for a llog lifetime */
loghandle->lgh_last_idx++;
if (rc)
GOTO(out, rc);
+ if (OBD_FAIL_PRECHECK(OBD_FAIL_LLOG_PROCESS_TIMEOUT) &&
+ cfs_fail_val == (unsigned int)(loghandle->lgh_id.lgl_oi.oi.oi_id &
+ 0xFFFFFFFF)) {
+ OBD_RACE(OBD_FAIL_LLOG_PROCESS_TIMEOUT);
+ msleep(1 * MSEC_PER_SEC);
+ }
/* computed index can be used to determine offset for fixed-size
* records. This also allows to handle Catalog wrap around case */
if (llh->llh_flags & LLOG_F_IS_FIXSIZE) {
if (rc < 0)
GOTO(out, rc);
+ up_write(&loghandle->lgh_last_sem);
+
CDEBUG(D_HA, "added record "DFID".%u, %u off%llu\n",
PFID(lu_object_fid(&o->do_lu)), index, rec->lrh_len,
lgi->lgi_off);
}
LLOG_HDR_TAIL(llh)->lrt_index = loghandle->lgh_last_idx;
+ up_write(&loghandle->lgh_last_sem);
RETURN(rc);
}
o = loghandle->lgh_obj;
LASSERT(o);
- LASSERT(dt_object_exists(o));
+ LASSERT(llog_osd_exist(loghandle));
dt = lu2dt_dev(o->do_lu.lo_dev);
LASSERT(dt);
o = loghandle->lgh_obj;
LASSERT(o);
- LASSERT(dt_object_exists(o));
+ LASSERT(llog_osd_exist(loghandle));
dt = lu2dt_dev(o->do_lu.lo_dev);
LASSERT(dt);
(struct dt_key *)name, th);
} else {
rc = dt_insert(env, dir, (struct dt_rec *)rec,
- (struct dt_key *)name, th, 1);
+ (struct dt_key *)name, th);
}
dt_write_unlock(env, dir);
rec->rec_type = S_IFREG;
dt_read_lock(env, llog_dir, 0);
rc = dt_insert(env, llog_dir, (struct dt_rec *)rec,
- (struct dt_key *)res->lgh_name,
- th, 1);
+ (struct dt_key *)res->lgh_name, th);
dt_read_unlock(env, llog_dir);
dt_object_put(env, llog_dir);
if (rc)
LASSERT(o != NULL);
dt_write_lock(env, o, 0);
- if (!dt_object_exists(o))
+ if (!llog_osd_exist(loghandle))
GOTO(out_unlock, rc = 0);
if (loghandle->lgh_name) {
if (rc < 0)
GOTO(out_unlock, rc);
+ loghandle->lgh_destroyed = true;
if (loghandle->lgh_ctxt->loc_flags & LLOG_CTXT_FLAG_NORMAL_FID) {
rc = llog_osd_regular_fid_del_name_entry(env, o, th, false);
if (rc < 0)