obd_set_info(md_obd->obd_self_export, strlen("async"), "async",
sizeof(async), &async);
+ if (mds_security == NULL)
+ mds_security = "null";
+
err = obd_set_info(md_obd->obd_self_export, strlen("sec"), "sec",
strlen(mds_security), mds_security);
out:
RETURN(err);
}
+
static int lustre_connect_ost(struct super_block *sb, char *lov,
struct obd_connect_data *data,
char *oss_security, int async, int pag)
RETURN(err);
}
- if (pag) {
+ /* FIXME Because of the async nature of file i/o, we never know
+ * who is actually dirty the pages; and any process have chance
+ * to trigger dirty-flushing within its own process context. So
+ * for simplicity we simply use root's credential, we suppose root
+ * always have credential.
+ */
+ if (pag)
sec_flags = PTLRPC_SEC_FL_PAG;
- err = obd_set_info(obd->obd_self_export,
- strlen("sec_flags"), "sec_flags",
- sizeof(sec_flags), &sec_flags);
- if (err) {
- OBD_FREE(data, sizeof(*data));
- RETURN(err);
- }
+ else
+ sec_flags = PTLRPC_SEC_FL_OSS;
+
+ err = obd_set_info(obd->obd_self_export,
+ strlen("sec_flags"), "sec_flags",
+ sizeof(sec_flags), &sec_flags);
+ if (err) {
+ OBD_FREE(data, sizeof(*data));
+ RETURN(err);
}
err = obd_connect(&dt_conn, obd, &sbi->ll_sb_uuid, data, 0);
/* make root inode */
err = md_getattr(sbi->ll_md_exp, &sbi->ll_rootid,
(OBD_MD_FLNOTOBD | OBD_MD_FLBLOCKS | OBD_MD_FID),
- NULL, NULL, 0, 0, &request);
+ NULL, NULL, 0, 0, NULL, &request);
if (err) {
CERROR("md_getattr failed for root: rc = %d\n", err);
GOTO(out, err);
if (err)
GOTO(out_lmv, err);
+ /*connect GSS*/
err = lustre_init_crypto(sb, gkc, data, async);
if (err) {
CERROR("Could not connect to GSS err %d\n", err);
err = 0;
}
- /*connect GSS*/
+
err = lustre_init_root_inode(sb);
if (err)
GOTO(out_gks, err);
ll_gns_del_timer(sbi);
ll_close_thread_stop(sbi->ll_lcq);
- lustre_destroy_crypto(sb);
-
list_del(&sbi->ll_conn_chain);
obd_disconnect(sbi->ll_dt_exp, 0);
+
+ lustre_destroy_crypto(sb);
lprocfs_unregister_mountpoint(sbi);
if (sbi->ll_proc_root) {
lli->lli_open_fd_exec_count = 0;
lli->lli_audit_mask = AUDIT_OFF;
lli->lli_key_info = NULL;
+ init_waitqueue_head(&lli->lli_dirty_wait);
+ lli->lli_io_epoch = 0;
+ INIT_LIST_HEAD(&lli->lli_capas);
}
int ll_fill_super(struct super_block *sb, void *data, int silent)
if (rc)
GOTO(out_cleanup, rc);
- rc = obd_connect(&md_conn, obd, &lmv_uuid, NULL, 0);
+ rc = obd_connect(&md_conn, obd, &lmv_uuid, NULL, OBD_OPT_REAL_CLIENT);
if (rc) {
CERROR("cannot connect to %s: rc = %d\n", lmd->lmd_mds, rc);
GOTO(out_cleanup, rc);
char **lov, char **lmv, char **gkc)
{
struct ll_sb_info *sbi = ll_s2sbi(sb);
- struct lustre_profile *lprof;
struct config_llog_instance cfg;
+ struct lustre_profile *lprof;
int len, err = 0;
-
ENTRY;
if (!lmd->lmd_profile)
GOTO(out, err = -ENOMEM);
memcpy(sbi->ll_lmd, lmd, sizeof(*lmd));
- /* generate a string unique to this super, let's try
- the address of the super itself.*/
+ /* generate a string unique to this super, let's try the address of the
+ * super itself. */
len = (sizeof(sb) * 2) + 1;
OBD_ALLOC(sbi->ll_instance, len);
if (sbi->ll_instance == NULL)
cfg.cfg_instance = sbi->ll_instance;
cfg.cfg_uuid = sbi->ll_sb_uuid;
cfg.cfg_local_nid = lmd->lmd_local_nid;
+ cfg.cfg_flags |= CFG_MODIFY_UUID_FL;
err = lustre_process_log(lmd, lmd->lmd_profile, &cfg, 0);
if (err < 0) {
CERROR("Unable to process log: %s\n", lmd->lmd_profile);
OBD_ALLOC(*lov, strlen(lprof->lp_lov) +
strlen(sbi->ll_instance) + 2);
+ if (*lov == NULL)
+ GOTO(out, err = -ENOMEM);
+
sprintf(*lov, "%s-%s", lprof->lp_lov, sbi->ll_instance);
OBD_ALLOC(*lmv, strlen(lprof->lp_lmv) +
strlen(sbi->ll_instance) + 2);
+ if (*lmv == NULL)
+ GOTO(out_free_lov, err = -ENOMEM);
+
sprintf(*lmv, "%s-%s", lprof->lp_lmv, sbi->ll_instance);
if (lprof->lp_gkc) {
OBD_ALLOC(*gkc, strlen(lprof->lp_gkc) +
- strlen(sbi->ll_instance) + 2);
+ strlen(sbi->ll_instance) + 2);
+ if (*gkc == NULL)
+ GOTO(out_free_lmv, err = -ENOMEM);
+
sprintf(*gkc, "%s-%s", lprof->lp_gkc, sbi->ll_instance);
}
+
+ RETURN(err);
+out_free_lmv:
+ OBD_FREE(*lmv, strlen(lprof->lp_lmv) +
+ strlen(sbi->ll_instance) + 2);
+out_free_lov:
+ OBD_FREE(*lov, strlen(lprof->lp_lov) +
+ strlen(sbi->ll_instance) + 2);
out:
- RETURN(err);
+ return err;
}
static int lustre_clean_profile(struct ll_sb_info *sbi, int force_umount)
}
if (sbi->ll_instance != NULL) {
+ cfg.cfg_flags |= CFG_MODIFY_UUID_FL;
cfg.cfg_instance = sbi->ll_instance;
cfg.cfg_uuid = sbi->ll_sb_uuid;
OBD_ALLOC(cl_prof, len);
+ if (!cl_prof) {
+ CERROR("can't allocate memory, "
+ "skipping processing cleanup profile.\n");
+ GOTO(free_lmd, err = -ENOMEM);
+ }
+
sprintf(cl_prof, "%s-clean", lmd->lmd_profile);
err = lustre_process_log(lmd, cl_prof, &cfg, 0);
if (err < 0) {
}
OBD_FREE(cl_prof, len);
}
+ EXIT;
free_lmd:
if (sbi->ll_instance)
OBD_FREE(sbi->ll_instance, strlen(sbi->ll_instance) + 1);
OBD_FREE(sbi->ll_lmd, sizeof(*sbi->ll_lmd));
- RETURN(err);
+ return err;
}
int lustre_fill_super(struct super_block *sb, void *data, int silent)
if (err)
GOTO(out_free, err);
-
+
+ EXIT;
out_dev:
if (lmv)
OBD_FREE(lmv, strlen(lmv) + 1);
if (gkc)
OBD_FREE(gkc, strlen(gkc) + 1);
- RETURN(err);
+ return err;
out_free:
lustre_clean_profile(sbi, 0);
lustre_free_sbi(sb);
- GOTO(out_dev, err);
+ goto out_dev;
} /* lustre_fill_super */
RETURN(0);
}
- rc = obd_cancel_unused(sbi->ll_md_exp, NULL,
- LDLM_FL_CONFIG_CHANGE, NULL);
- if (rc != 0)
- CWARN("obd_cancel_unused(mdc): %d\n", rc);
-
- rc = obd_cancel_unused(sbi->ll_dt_exp, NULL,
- LDLM_FL_CONFIG_CHANGE, NULL);
- if (rc != 0)
- CWARN("obd_cancel_unused(lov): %d\n", rc);
-
cfg.cfg_instance = sbi->ll_instance;
cfg.cfg_uuid = sbi->ll_sb_uuid;
cfg.cfg_local_nid = lmd->lmd_local_nid;
struct lustre_id id;
struct ll_inode_info *lli = ll_i2info(inode);
struct ll_sb_info *sbi = ll_i2sbi(inode);
+ struct obd_capa *ocapa, *tmp;
ENTRY;
CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p)\n", inode->i_ino,
inode->i_generation, inode);
+ LASSERT(ll_is_inode_dirty(inode) == 0);
ll_inode2id(&id, inode);
clear_bit(LLI_F_HAVE_MDS_SIZE_LOCK, &(ll_i2info(inode)->lli_flags));
(struct lov_stripe_md **) &lli->lli_mea);
lli->lli_mea = NULL;
}
+
+ LASSERT(sbi->ll_crypto_info != NULL);
ll_crypto_destroy_inode_key(inode);
+
if (lli->lli_symlink_name) {
OBD_FREE(lli->lli_symlink_name,
strlen(lli->lli_symlink_name) + 1);
lli->lli_remote_acl = NULL;
}
- lli->lli_inode_magic = LLI_INODE_DEAD;
+ list_for_each_entry_safe(ocapa, tmp, &lli->lli_capas, u.client.lli_list)
+ capa_put(ocapa);
+ LASSERT(!mapping_has_pages(inode->i_mapping));
+ lli->lli_inode_magic = LLI_INODE_DEAD;
+
EXIT;
}
LTIME_S(attr->ia_mtime), LTIME_S(attr->ia_ctime),
LTIME_S(CURRENT_TIME));
- if (lsm)
- attr->ia_valid &= ~ATTR_SIZE;
-
/* If only OST attributes being set on objects, don't do MDS RPC.
* In that case, we need to check permissions and update the local
* inode ourselves so we can call obdo_from_inode() always. */
OBD_ALLOC(op_data, sizeof(*op_data));
if (op_data == NULL)
RETURN(-ENOMEM);
- ll_prepare_mdc_data(op_data, inode, NULL, NULL, 0, 0);
+ ll_inode2mdc_data(op_data, inode, (OBD_MD_FLID | OBD_MD_MEA));
- if (ia_valid & (ATTR_UID | ATTR_GID)) {
+ if (ia_valid & (ATTR_UID | ATTR_GID | ATTR_MODE)) {
rc = ll_crypto_get_mac(inode, attr, NULL, 0, &key,
&key_size);
+ if (rc) {
+ CERROR("can not get right mac, rc=%d\n", rc);
+ if (key && key_size)
+ OBD_FREE(key, key_size);
+ RETURN(rc);
+ }
}
rc = md_setattr(sbi->ll_md_exp, op_data,
attr, key, key_size, NULL, 0, NULL,
RETURN(rc);
}
+ if (attr->ia_valid & ATTR_SIZE) {
+ rc = ll_set_trunc_capa(request, 0, inode);
+ if (rc) {
+ ptlrpc_req_finished(request);
+ RETURN(rc);
+ }
+ }
+
/* We call inode_setattr to adjust timestamps, but we first
* clear ATTR_SIZE to avoid invoking vmtruncate.
*
}
}
+ if (lsm)
+ attr->ia_valid &= ~ATTR_SIZE;
+
/* won't invoke vmtruncate, as we already cleared ATTR_SIZE */
err = inode_setattr(inode, attr);
/*
obdo_from_inode(oa, inode, OBD_MD_FLTYPE | OBD_MD_FLATIME |
OBD_MD_FLMTIME | OBD_MD_FLCTIME);
- rc = obd_setattr(sbi->ll_dt_exp, oa, lsm, NULL);
+ rc = obd_setattr(sbi->ll_dt_exp, oa, lsm, NULL, NULL);
obdo_free(oa);
if (rc)
CERROR("obd_setattr fails: rc = %d\n", rc);
struct mds_body *body;
ll_inode2id(&id, inode);
- rc = md_getattr(sbi->ll_md_exp, &id, valid, NULL, NULL, 0, 0,
- &req);
+ rc = md_getattr(sbi->ll_md_exp, &id, valid, NULL, NULL,
+ 0, 0, NULL, &req);
if (rc) {
CERROR("failure %d inode %lu\n", rc, inode->i_ino);
RETURN(-abs(rc));
obdo_free(oa);
RETURN(-ENOMEM);
}
- ll_prepare_mdc_data(op_data, inode, NULL, NULL, 0, 0);
+ ll_inode2mdc_data(op_data, inode, (OBD_MD_FLID | OBD_MD_MEA));
memset(&attr, 0x0, sizeof(attr));
attr.ia_attr_flags = flags;
oa->o_valid = OBD_MD_FLID | OBD_MD_FLFLAGS | OBD_MD_FLGROUP
| OBD_MD_FLIFID;
- rc = obd_setattr(sbi->ll_dt_exp, oa, lsm, NULL);
+ rc = obd_setattr(sbi->ll_dt_exp, oa, lsm, NULL, NULL);
obdo_free(oa);
if (rc) {
if (rc != -EPERM && rc != -EACCES)