#define OBD_FL_NO_USRQUOTA (0x00000100) /* the object's owner is over quota */
#define OBD_FL_NO_GRPQUOTA (0x00000200) /* the object's group is over quota */
#define OBD_FL_CREATE_CROW (0x00000400) /* object should be created with crow */
-#define OBD_FL_CREATE_URGENT (0x00000800) /* object should be created asap (echo, llog) */
/* this should be not smaller than sizeof(struct lustre_handle) + sizeof(struct
* llog_cookie) + sizeof(ll_fid). Nevertheless struct ll_fid is not longer
#define o_dropped o_misc
#define o_cksum o_nlink
+#define OBDO_URGENT_CREATE(oa) \
+ (!((oa)->o_valid & OBD_MD_FLFLAGS) || \
+ !((oa)->o_flags & OBD_FL_CREATE_CROW) || \
+ ((oa)->o_flags & OBD_FL_RECREATE_OBJS))
+
extern void lustre_swab_obdo (struct obdo *o);
#define LOV_MAGIC_V1 0x0BD10BD0
oa->o_id = ucreatp.lrc_id;
oa->o_nlink = ucreatp.lrc_ost_idx;
+ oa->o_flags |= OBD_FL_RECREATE_OBJS;
oa->o_valid = OBD_MD_FLID | OBD_MD_FLFLAGS;
- oa->o_flags |= OBD_FL_RECREATE_OBJS | OBD_FL_CREATE_URGENT;
obdo_from_inode(oa, inode, OBD_MD_FLTYPE | OBD_MD_FLATIME |
- OBD_MD_FLMTIME | OBD_MD_FLCTIME);
+ OBD_MD_FLMTIME | OBD_MD_FLCTIME);
oti.oti_objid = NULL;
memcpy(lsm2, lsm, lsm_size);
LASSERT(ergo(src_oa->o_valid & OBD_MD_FLFLAGS,
!!(src_oa->o_flags & OBD_FL_CREATE_CROW) !=
- !!(src_oa->o_flags & OBD_FL_CREATE_URGENT)));
+ !!(src_oa->o_flags & OBD_FL_RECREATE_OBJS)));
lov = &exp->exp_obd->u.lov;
if (!lov->desc.ld_active_tgt_count)
oa->o_generation = body->fid1.generation;
oa->o_valid |= OBD_MD_FLFID | OBD_MD_FLGENER;
+ /* do not set CROW flag in setattr path as it is not needed
+ * there and only confuses setattr code in filter. */
+ oa->o_flags &= ~OBD_FL_CREATE_CROW;
+ if (!oa->o_flags)
+ oa->o_valid &= ~OBD_MD_FLFLAGS;
+
rc = obd_setattr(mds->mds_osc_exp, oa, lsm, &oti);
if (rc) {
CERROR("error setting attrs for inode %lu: rc %d\n",
GOTO(cleanup, rc = -ENOMEM);
oa->o_gr = FILTER_GROUP_LLOG;
- oa->o_flags = OBD_FL_CREATE_URGENT;
- oa->o_valid = OBD_MD_FLGENER | OBD_MD_FLGROUP | OBD_MD_FLFLAGS;
+ oa->o_valid = OBD_MD_FLGENER | OBD_MD_FLGROUP;
rc = obd_create(ctxt->loc_exp, oa, NULL, NULL);
if (rc)
attr->ia_valid |= ATTR_GID;
}
- /* do not set CROW into flags, as it realy does not belong to attributes
- * and only confuses filter_setattr_internal(). */
if (valid & OBD_MD_FLFLAGS) {
- obd_flag o_flags = (oa->o_flags & ~OBD_FL_CREATE_CROW);
- if (o_flags) {
- attr->ia_attr_flags = o_flags;
- attr->ia_valid |= ATTR_ATTR_FLAG;
- }
+ attr->ia_attr_flags = oa->o_flags;
+ attr->ia_valid |= ATTR_ATTR_FLAG;
}
}
EXPORT_SYMBOL(iattr_from_obdo);
if (on_target) {
oa->o_gr = FILTER_GROUP_ECHO;
- oa->o_flags = OBD_FL_CREATE_URGENT;
- oa->o_valid |= OBD_MD_FLGROUP | OBD_MD_FLFLAGS;
+ oa->o_valid |= OBD_MD_FLGROUP;
rc = obd_create(ec->ec_exp, oa, &lsm, oti);
if (rc != 0)
if (IS_ERR(handle))
GOTO(out_unlock, rc = PTR_ERR(handle));
- if (iattr.ia_valid & ATTR_ATTR_FLAG) {
- rc = fsfilt_iocontrol(exp->exp_obd, dentry->d_inode, NULL,
- EXT3_IOC_SETFLAGS,
+ if (oa->o_valid & OBD_MD_FLFLAGS) {
+ rc = fsfilt_iocontrol(exp->exp_obd, dentry->d_inode,
+ NULL, EXT3_IOC_SETFLAGS,
(long)&iattr.ia_attr_flags);
} else {
rc = fsfilt_setattr(exp->exp_obd, dentry, handle, &iattr, 1);
CDEBUG(D_INFO, "filter_create(od->o_gr="LPU64",od->o_id="LPU64")\n",
group, oa->o_id);
+ if (oa->o_valid & OBD_MD_FLFLAGS && oa->o_flags == OBD_FL_DELORPHAN) {
+ push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
+
+ rc = filter_clear_orphans(exp, oa);
+ if (rc) {
+ CERROR("cannot clear orphans starting from "
+ LPU64", err = %d\n", oa->o_id, rc);
+ }
+ pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
+ RETURN(rc);
+ }
+
+ LASSERT(ergo(oa->o_valid & OBD_MD_FLFLAGS,
+ !!(oa->o_flags & OBD_FL_CREATE_CROW) !=
+ !!(oa->o_flags & OBD_FL_RECREATE_OBJS)));
+
/* echo, llog and other "create asap" cases. */
- if (oa->o_valid & OBD_MD_FLFLAGS &&
- (oa->o_flags & OBD_FL_CREATE_URGENT ||
- oa->o_flags & OBD_FL_RECREATE_OBJS)) {
+ if (OBDO_URGENT_CREATE(oa)) {
struct obd_statfs *osfs;
struct dentry *dentry;
rc = 0;
}
}
-
- RETURN(rc);
- }
-
- push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-
- LASSERT(oa->o_valid & OBD_MD_FLFLAGS &&
- oa->o_flags == OBD_FL_DELORPHAN);
-
- rc = filter_clear_orphans(exp, oa);
- if (rc) {
- CERROR("cannot clear orphans starting from "
- LPU64", err = %d\n", oa->o_id, rc);
+ } else {
+ CERROR("wrong @oa flags detected 0x%lx. Not an urgent "
+ "create and not recovery\n", oa->o_flags);
+ LBUG();
}
-
- pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
RETURN(rc);
}
struct lov_stripe_md **ea, struct obd_trans_info *oti)
{
struct osc_creator *oscc = &exp->exp_obd->u.cli.cl_oscc;
+ struct obd_connect_data *ocd;
int try_again = 1, rc = 0;
ENTRY;
LASSERT(ea != NULL);
/* this is the special case where create removes orphans */
- if ((oa->o_valid & OBD_MD_FLFLAGS) &&
- oa->o_flags == OBD_FL_DELORPHAN) {
+ if (oa->o_valid & OBD_MD_FLFLAGS && oa->o_flags == OBD_FL_DELORPHAN) {
spin_lock(&oscc->oscc_lock);
if (oscc->oscc_flags & OSCC_FLAG_SYNC_IN_PROGRESS) {
spin_unlock(&oscc->oscc_lock);
}
spin_unlock(&oscc->oscc_lock);
RETURN(rc);
- } else {
- struct obd_connect_data *ocd;
- int urgent;
-
- ocd = &class_exp2cliimp(exp)->imp_connect_data;
-
- urgent = oa->o_valid & OBD_MD_FLFLAGS &&
- (oa->o_flags & OBD_FL_CREATE_URGENT ||
- oa->o_flags & OBD_FL_RECREATE_OBJS);
-
- /* perform urgent create if asked or import is not crow capable
- * or ENOSPC case if detected. */
- if (urgent || !OCD_CROW_ABLE(ocd) || osc_check_nospc(exp)) {
- /* make sure that all needed flags are set in case of
- * real create on enospc case. This is needed to let
- * filter know that this is not recovery case.*/
- if (osc_check_nospc(exp)) {
- oa->o_valid |= OBD_MD_FLFLAGS;
- oa->o_flags |= OBD_FL_CREATE_URGENT;
- }
- CDEBUG(D_HA, "perform urgent create\n");
- rc = osc_real_create(exp, oa, ea, oti);
- RETURN(rc);
- }
+ }
+
+ LASSERT(ergo(oa->o_valid & OBD_MD_FLFLAGS,
+ !!(oa->o_flags & OBD_FL_CREATE_CROW) !=
+ !!(oa->o_flags & OBD_FL_RECREATE_OBJS)));
+
+ ocd = &class_exp2cliimp(exp)->imp_connect_data;
+
+ /* perform urgent create if asked or import is not crow capable or
+ * ENOSPC case if detected. */
+ if (OBDO_URGENT_CREATE(oa) || !OCD_CROW_ABLE(ocd) ||
+ osc_check_nospc(exp)) {
+ CDEBUG(D_HA, "perform urgent create\n");
+ rc = osc_real_create(exp, oa, ea, oti);
+ RETURN(rc);
}
/* check OST fs state. */