class_uuid_t uuid;
ENTRY;
- MOD_INC_USE_COUNT;
OBD_ALLOC(sbi, sizeof(*sbi));
- if (!sbi) {
- MOD_DEC_USE_COUNT;
+ if (!sbi)
RETURN(-ENOMEM);
- }
INIT_LIST_HEAD(&sbi->ll_conn_chain);
generate_random_uuid(uuid);
out_free:
OBD_FREE(sbi, sizeof(*sbi));
- MOD_DEC_USE_COUNT;
goto out_dev;
} /* ll_fill_super */
obd_disconnect(&sbi->ll_mdc_conn);
OBD_FREE(sbi, sizeof(*sbi));
- MOD_DEC_USE_COUNT;
EXIT;
} /* ll_put_super */
static void ll_clear_inode(struct inode *inode)
{
+ struct ll_sb_info *sbi = ll_i2sbi(inode);
+ struct ll_inode_info *lli = ll_i2info(inode);
+ int rc;
ENTRY;
- if (atomic_read(&inode->i_count) == 0) {
- struct ll_inode_info *lli = ll_i2info(inode);
- char *symlink_name = lli->lli_symlink_name;
+#warning "Is there a reason we don't do this in 2.5, but we do in 2.4?"
+#if 0
+ rc = mdc_cancel_unused(&sbi->ll_mdc_conn, inode, LDLM_FL_NO_CALLBACK);
+ if (rc < 0) {
+ CERROR("mdc_cancel_unused: %d\n", rc);
+ /* XXX FIXME do something dramatic */
+ }
- if (lli->lli_smd)
- obd_free_memmd(&sbi->ll_osc_conn, &lli->lli_smd);
- if (symlink_name) {
- OBD_FREE(symlink_name, strlen(symlink_name) + 1);
- lli->lli_symlink_name = NULL;
+ if (lli->lli_smd) {
+ rc = obd_cancel_unused(&sbi->ll_osc_conn, lli->lli_smd, 0);
+ if (rc < 0) {
+ CERROR("obd_cancel_unused: %d\n", rc);
+ /* XXX FIXME do something dramatic */
}
}
+#endif
+
+ if (atomic_read(&inode->i_count) != 0)
+ CERROR("clearing in-use inode %lu: count = %d\n",
+ inode->i_ino, atomic_read(&inode->i_count));
+
+ if (lli->lli_smd)
+ obd_free_memmd(&sbi->ll_osc_conn, &lli->lli_smd);
+
+ if (lli->lli_symlink_name) {
+ OBD_FREE(lli->lli_symlink_name,strlen(lli->lli_symlink_name)+1);
+ lli->lli_symlink_name = NULL;
+ }
+
EXIT;
}
struct obdo *oa;
struct lov_stripe_md *lsm = ll_i2info(inode)->lli_smd;
+ /* mcreate with no open */
if (!lsm)
- GOTO(out, -EINVAL);
+ GOTO(out, 0);
if (lsm->lsm_object_id == 0) {
CERROR("This really happens\n");
oa->o_id = lsm->lsm_object_id;
oa->o_mode = inode->i_mode;
- oa->o_valid = OBD_MD_FLID | OBD_MD_FLEASIZE | OBD_MD_FLTYPE;
+ oa->o_valid = OBD_MD_FLID | OBD_MD_FLTYPE;
err = obd_destroy(ll_i2obdconn(inode), oa, lsm);
obdo_free(oa);
- CDEBUG(D_SUPER, "obd destroy of objid "LPX64" error %d\n",
- lsm->lsm_object_id, err);
+ if (err)
+ CDEBUG(D_SUPER, "obd destroy objid "LPX64" error %d\n",
+ lsm->lsm_object_id, err);
}
out:
clear_inode(inode);
{
struct ptlrpc_request *request = NULL;
struct ll_sb_info *sbi = ll_i2sbi(inode);
- int err;
+ int err = 0;
ENTRY;
/* change incore inode */
ll_attr2inode(inode, attr, do_trunc);
- err = mdc_setattr(&sbi->ll_mdc_conn, inode, attr, &request);
- if (err)
- CERROR("mdc_setattr fails (%d)\n", err);
+ /* Don't send size changes to MDS to avoid "fast EA" problems, and
+ * also avoid a pointless RPC (we get file size from OST anyways).
+ */
+ attr->ia_valid &= ~ATTR_SIZE;
+ if (attr->ia_valid) {
+ err = mdc_setattr(&sbi->ll_mdc_conn, inode, attr, &request);
+ if (err)
+ CERROR("mdc_setattr fails (%d)\n", err);
- ptlrpc_req_finished(request);
+ ptlrpc_req_finished(request);
+ }
RETURN(err);
}
/* core attributes first */
ll_update_inode(inode, body);
- //if (body->valid & OBD_MD_FLEASIZE)
LASSERT(!lli->lli_smd);
if (lic && lic->lic_lmm)
obd_unpackmd(ll_i2obdconn(inode), &lli->lli_smd, lic->lic_lmm);
rc = ll_file_size(inode, lli->lli_smd);
if (rc) {
CERROR("ll_file_size: %d\n", rc);
- /* FIXME: need to somehow prevent inode creation */
- LBUG();
+ ll_clear_inode(inode);
make_bad_inode(inode);
+ RETURN(rc);
}
}