X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=kernel%2Fdrivers%2Fstaging%2Flustre%2Flustre%2Fllite%2Fstatahead.c;fp=kernel%2Fdrivers%2Fstaging%2Flustre%2Flustre%2Fllite%2Fstatahead.c;h=18f5f2b7e90209e38a9e1a67fc8d54ce758654e3;hb=e09b41010ba33a20a87472ee821fa407a5b8da36;hp=7f8071242f23446b48d2e5d81df205302454f005;hpb=f93b97fd65072de626c074dbe099a1fff05ce060;p=kvmfornfv.git diff --git a/kernel/drivers/staging/lustre/lustre/llite/statahead.c b/kernel/drivers/staging/lustre/lustre/llite/statahead.c index 7f8071242..18f5f2b7e 100644 --- a/kernel/drivers/staging/lustre/lustre/llite/statahead.c +++ b/kernel/drivers/staging/lustre/lustre/llite/statahead.c @@ -312,7 +312,7 @@ static void ll_sa_entry_cleanup(struct ll_statahead_info *sai, entry->se_minfo = NULL; ll_intent_release(&minfo->mi_it); iput(minfo->mi_dir); - OBD_FREE_PTR(minfo); + kfree(minfo); } if (req) { @@ -336,7 +336,7 @@ static void ll_sa_entry_put(struct ll_statahead_info *sai, ll_sa_entry_cleanup(sai, entry); iput(entry->se_inode); - OBD_FREE(entry, entry->se_size); + kfree(entry); atomic_dec(&sai->sai_cache_count); } } @@ -544,7 +544,7 @@ static void ll_sai_put(struct ll_statahead_info *sai) LASSERT(agl_list_empty(sai)); iput(inode); - OBD_FREE_PTR(sai); + kfree(sai); } } @@ -659,7 +659,7 @@ static void ll_post_statahead(struct ll_statahead_info *sai) * revalidate. */ /* unlinked and re-created with the same name */ - if (unlikely(!lu_fid_eq(&minfo->mi_data.op_fid2, &body->fid1))){ + if (unlikely(!lu_fid_eq(&minfo->mi_data.op_fid2, &body->fid1))) { entry->se_inode = NULL; iput(child); child = NULL; @@ -772,7 +772,7 @@ out: if (rc != 0) { ll_intent_release(it); iput(dir); - OBD_FREE_PTR(minfo); + kfree(minfo); } if (sai != NULL) ll_sai_put(sai); @@ -784,25 +784,16 @@ static void sa_args_fini(struct md_enqueue_info *minfo, { LASSERT(minfo && einfo); iput(minfo->mi_dir); - capa_put(minfo->mi_data.op_capa1); - capa_put(minfo->mi_data.op_capa2); - OBD_FREE_PTR(minfo); - OBD_FREE_PTR(einfo); + kfree(minfo); + kfree(einfo); } /** - * There is race condition between "capa_put" and "ll_statahead_interpret" for - * accessing "op_data.op_capa[1,2]" as following: - * "capa_put" releases "op_data.op_capa[1,2]"'s reference count after calling - * "md_intent_getattr_async". But "ll_statahead_interpret" maybe run first, and - * fill "op_data.op_capa[1,2]" as POISON, then cause "capa_put" access invalid - * "ocapa". So here reserve "op_data.op_capa[1,2]" in "pcapa" before calling - * "md_intent_getattr_async". + * prepare arguments for async stat RPC. */ static int sa_args_init(struct inode *dir, struct inode *child, struct ll_sa_entry *entry, struct md_enqueue_info **pmi, - struct ldlm_enqueue_info **pei, - struct obd_capa **pcapa) + struct ldlm_enqueue_info **pei) { struct qstr *qstr = &entry->se_qstr; struct ll_inode_info *lli = ll_i2info(dir); @@ -816,15 +807,15 @@ static int sa_args_init(struct inode *dir, struct inode *child, minfo = kzalloc(sizeof(*minfo), GFP_NOFS); if (!minfo) { - OBD_FREE_PTR(einfo); + kfree(einfo); return -ENOMEM; } op_data = ll_prep_md_op_data(&minfo->mi_data, dir, child, qstr->name, qstr->len, 0, LUSTRE_OPC_ANY, NULL); if (IS_ERR(op_data)) { - OBD_FREE_PTR(einfo); - OBD_FREE_PTR(minfo); + kfree(einfo); + kfree(minfo); return PTR_ERR(op_data); } @@ -843,8 +834,6 @@ static int sa_args_init(struct inode *dir, struct inode *child, *pmi = minfo; *pei = einfo; - pcapa[0] = op_data->op_capa1; - pcapa[1] = op_data->op_capa2; return 0; } @@ -853,20 +842,15 @@ static int do_sa_lookup(struct inode *dir, struct ll_sa_entry *entry) { struct md_enqueue_info *minfo; struct ldlm_enqueue_info *einfo; - struct obd_capa *capas[2]; int rc; - rc = sa_args_init(dir, NULL, entry, &minfo, &einfo, capas); + rc = sa_args_init(dir, NULL, entry, &minfo, &einfo); if (rc) return rc; rc = md_intent_getattr_async(ll_i2mdexp(dir), minfo, einfo); - if (!rc) { - capa_put(capas[0]); - capa_put(capas[1]); - } else { + if (rc < 0) sa_args_fini(minfo, einfo); - } return rc; } @@ -885,7 +869,6 @@ static int do_sa_revalidate(struct inode *dir, struct ll_sa_entry *entry, .d.lustre.it_lock_handle = 0 }; struct md_enqueue_info *minfo; struct ldlm_enqueue_info *einfo; - struct obd_capa *capas[2]; int rc; if (unlikely(inode == NULL)) @@ -903,7 +886,7 @@ static int do_sa_revalidate(struct inode *dir, struct ll_sa_entry *entry, return 1; } - rc = sa_args_init(dir, inode, entry, &minfo, &einfo, capas); + rc = sa_args_init(dir, inode, entry, &minfo, &einfo); if (rc) { entry->se_inode = NULL; iput(inode); @@ -911,10 +894,7 @@ static int do_sa_revalidate(struct inode *dir, struct ll_sa_entry *entry, } rc = md_intent_getattr_async(ll_i2mdexp(dir), minfo, einfo); - if (!rc) { - capa_put(capas[0]); - capa_put(capas[1]); - } else { + if (rc < 0) { entry->se_inode = NULL; iput(inode); sa_args_fini(minfo, einfo); @@ -967,7 +947,7 @@ static void ll_statahead_one(struct dentry *parent, const char *entry_name, static int ll_agl_thread(void *arg) { - struct dentry *parent = (struct dentry *)arg; + struct dentry *parent = arg; struct inode *dir = d_inode(parent); struct ll_inode_info *plli = ll_i2info(dir); struct ll_inode_info *clli; @@ -1058,7 +1038,7 @@ static void ll_start_agl(struct dentry *parent, struct ll_statahead_info *sai) static int ll_statahead_thread(void *arg) { - struct dentry *parent = (struct dentry *)arg; + struct dentry *parent = arg; struct inode *dir = d_inode(parent); struct ll_inode_info *plli = ll_i2info(dir); struct ll_inode_info *clli; @@ -1215,7 +1195,7 @@ do_it: while (1) { l_wait_event(thread->t_ctl_waitq, !sa_received_empty(sai) || - sai->sai_sent == sai->sai_replied|| + sai->sai_sent == sai->sai_replied || !thread_is_running(thread), &lwi); @@ -1719,8 +1699,7 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp, return -EAGAIN; out: - if (sai != NULL) - OBD_FREE_PTR(sai); + kfree(sai); spin_lock(&lli->lli_sa_lock); lli->lli_opendir_key = NULL; lli->lli_opendir_pid = 0;