RETURN(PTR_ERR(ls));
mutex_lock(&ls->ls_los_mutex);
- los = dt_los_find(ls, FID_SEQ_LLOG);
+ los = dt_los_find(ls, name != NULL ? FID_SEQ_LLOG_NAME : FID_SEQ_LLOG);
mutex_unlock(&ls->ls_los_mutex);
LASSERT(los);
ls_device_put(env, ls);
llog_dir = llog_osd_dir_get(env, res->lgh_ctxt);
if (IS_ERR(llog_dir))
RETURN(PTR_ERR(llog_dir));
- dt_declare_ref_add(env, o, th);
logid_to_fid(&res->lgh_id, &lgi->lgi_fid);
rc = dt_declare_insert(env, llog_dir,
(struct dt_rec *)&lgi->lgi_fid,
rc = llog_osd_create_new_object(env, los, o, th);
else
rc = -EEXIST;
- if (res->lgh_name)
- dt_ref_add(env, o, th);
+
dt_write_unlock(env, o);
if (rc)
RETURN(rc);
static int llog_osd_destroy(const struct lu_env *env,
struct llog_handle *loghandle)
{
- struct llog_thread_info *lgi = llog_info(env);
struct llog_ctxt *ctxt;
struct dt_object *o, *llog_dir = NULL;
struct dt_device *d;
if (IS_ERR(llog_dir))
GOTO(out_trans, rc = PTR_ERR(llog_dir));
- dt_declare_ref_del(env, o, th);
name = loghandle->lgh_name;
rc = dt_declare_delete(env, llog_dir,
(struct dt_key *)name, th);
dt_write_lock(env, o, 0);
if (dt_object_exists(o)) {
if (name) {
- dt_ref_del(env, o, th);
dt_read_lock(env, llog_dir, 0);
rc = dt_delete(env, llog_dir,
(struct dt_key *) name,
GOTO(out_unlock, rc);
}
}
- /*
- * XXX: compatibility bits
- * on old filesystems llogs are referenced by the name
- * on the new ones they are referenced by OI and by
- * the name
- */
- rc = dt_attr_get(env, o, &lgi->lgi_attr, NULL);
- if (rc)
- GOTO(out_unlock, rc);
- LASSERT(lgi->lgi_attr.la_nlink < 2);
- if (lgi->lgi_attr.la_nlink == 1)
- dt_ref_del(env, o, th);
+ dt_ref_del(env, o, th);
rc = dt_destroy(env, o, th);
if (rc)
GOTO(out_unlock, rc);
lgi->lgi_fid.f_ver = 0;
rc = local_oid_storage_init(env, disk_obd->obd_lvfs_ctxt.dt,
&lgi->lgi_fid, &los);
+ if (rc < 0)
+ return rc;
+
+ lgi->lgi_fid.f_seq = FID_SEQ_LLOG_NAME;
+ lgi->lgi_fid.f_oid = 1;
+ lgi->lgi_fid.f_ver = 0;
+ rc = local_oid_storage_init(env, disk_obd->obd_lvfs_ctxt.dt,
+ &lgi->lgi_fid, &los);
llog_ctxt_put(ctxt);
return rc;
}
{
struct dt_device *dt;
struct ls_device *ls;
- struct local_oid_storage *los;
+ struct local_oid_storage *los, *nlos;
LASSERT(ctxt->loc_exp->exp_obd);
dt = ctxt->loc_exp->exp_obd->obd_lvfs_ctxt.dt;
mutex_lock(&ls->ls_los_mutex);
los = dt_los_find(ls, FID_SEQ_LLOG);
+ nlos = dt_los_find(ls, FID_SEQ_LLOG_NAME);
mutex_unlock(&ls->ls_los_mutex);
if (los != NULL) {
dt_los_put(los);
local_oid_storage_fini(env, los);
}
+ if (nlos != NULL) {
+ dt_los_put(nlos);
+ local_oid_storage_fini(env, nlos);
+ }
ls_device_put(env, ls);
return 0;
}
rc = dt_record_write(env, o, &dti->dti_lb, &dti->dti_off, th);
if (rc)
GOTO(out_lock, rc);
-#if LUSTRE_VERSION_CODE >= OBD_OCD_VERSION(2, 3, 90, 0)
-#error "fix this before release"
-#endif
- /*
- * there is one technical debt left in Orion:
- * proper hanlding of named vs no-name objects.
- * Llog objects have name always as they are placed in O/d/...
- */
- if (fid_seq(&dti->dti_fid) != FID_SEQ_LLOG) {
- rc = dt_insert(env, root,
- (const struct dt_rec *)&dti->dti_fid,
- (const struct dt_key *)dti->dti_buf,
- th, BYPASS_CAPA, 1);
- if (rc)
- GOTO(out_lock, rc);
- }
+ rc = dt_insert(env, root,
+ (const struct dt_rec *)&dti->dti_fid,
+ (const struct dt_key *)dti->dti_buf,
+ th, BYPASS_CAPA, 1);
+ if (rc)
+ GOTO(out_lock, rc);
out_lock:
dt_write_unlock(env, o);
dt_write_unlock(env, root);
createmany -o $DIR/$tdir/$tfile-%d 100
# make sure that OSTs do not cancel llog cookies before we unmount the MDS
#define OBD_FAIL_OBD_LOG_CANCEL_NET 0x601
- do_facet mds "lctl set_param fail_loc=0x601"
+ do_facet $SINGLEMDS "lctl set_param fail_loc=0x601"
unlinkmany $DIR/$tdir/$tfile-%d 100
- stop mds
- local MNTDIR=$(facet_mntpt mds)
+ stop_mds
+
+ local MNTDIR=$(facet_mntpt $SINGLEMDS)
+ local devname=$(mdsdevname ${SINGLEMDS//mds/})
+ local opts=""
+ if ! do_facet $SINGLEMDS "test -b $devname"; then
+ opts="-o loop"
+ fi
+
# remove all files from the OBJECTS dir
- do_facet mds "mount -t ldiskfs $MDSDEV $MNTDIR"
- do_facet mds "find $MNTDIR/OBJECTS -type f -delete"
- do_facet mds "umount $MNTDIR"
+ do_facet $SINGLEMDS "mount -t ldiskfs $opts $devname $MNTDIR"
+ do_facet $SINGLEMDS "find $MNTDIR/O/1/d* -type f -delete"
+ do_facet $SINGLEMDS "umount $MNTDIR"
# restart MDS with missing llog files
start_mds
do_facet mds "lctl set_param fail_loc=0"