diff options
author | Lai Siyao <lai.siyao@intel.com> | 2017-01-28 19:04:30 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-02-03 07:01:36 -0500 |
commit | 58ff698c9076be0bb8f62ea5febac7b8f3759e4b (patch) | |
tree | dce471f423771bb20100d3e4d0a45659d583786f | |
parent | 1ed32aedc83e43f7b93dc5ac156dc408eb06cc1d (diff) |
staging: lustre: statahead: drop support for remote entry
This patch dropped support for remote entry statahead, because it
needs 2 async RPCs to fetch both LOOKUP lock from parent MDT and
UPDATE lock from client MDT, which is complicated. Plus not
supporting remote entry statahead won't cause any issue.
* pack child fid in statahead request.
* lmv_intent_getattr_async() will compare parent and child MDT,
if child is remote, return -ENOTSUPP.
Signed-off-by: Lai Siyao <lai.siyao@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6578
Reviewed-on: http://review.whamcloud.com/15767
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: wangdi <di.wang@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/lustre/lustre/include/obd.h | 4 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/include/obd_class.h | 5 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/llite/statahead.c | 94 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/lmv/lmv_obd.c | 30 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/mdc/mdc_internal.h | 3 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/mdc/mdc_locks.c | 16 |
6 files changed, 68 insertions, 84 deletions
diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index 6f0f5dd1f617..7f0fc4479578 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h | |||
@@ -761,6 +761,7 @@ struct md_enqueue_info { | |||
761 | struct lookup_intent mi_it; | 761 | struct lookup_intent mi_it; |
762 | struct lustre_handle mi_lockh; | 762 | struct lustre_handle mi_lockh; |
763 | struct inode *mi_dir; | 763 | struct inode *mi_dir; |
764 | struct ldlm_enqueue_info mi_einfo; | ||
764 | int (*mi_cb)(struct ptlrpc_request *req, | 765 | int (*mi_cb)(struct ptlrpc_request *req, |
765 | struct md_enqueue_info *minfo, int rc); | 766 | struct md_enqueue_info *minfo, int rc); |
766 | void *mi_cbdata; | 767 | void *mi_cbdata; |
@@ -978,8 +979,7 @@ struct md_ops { | |||
978 | struct lu_fid *fid); | 979 | struct lu_fid *fid); |
979 | 980 | ||
980 | int (*intent_getattr_async)(struct obd_export *, | 981 | int (*intent_getattr_async)(struct obd_export *, |
981 | struct md_enqueue_info *, | 982 | struct md_enqueue_info *); |
982 | struct ldlm_enqueue_info *); | ||
983 | 983 | ||
984 | int (*revalidate_lock)(struct obd_export *, struct lookup_intent *, | 984 | int (*revalidate_lock)(struct obd_export *, struct lookup_intent *, |
985 | struct lu_fid *, __u64 *bits); | 985 | struct lu_fid *, __u64 *bits); |
diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h index 7ec25202cd22..083a6ff56a05 100644 --- a/drivers/staging/lustre/lustre/include/obd_class.h +++ b/drivers/staging/lustre/lustre/include/obd_class.h | |||
@@ -1444,14 +1444,13 @@ static inline int md_init_ea_size(struct obd_export *exp, u32 easize, | |||
1444 | } | 1444 | } |
1445 | 1445 | ||
1446 | static inline int md_intent_getattr_async(struct obd_export *exp, | 1446 | static inline int md_intent_getattr_async(struct obd_export *exp, |
1447 | struct md_enqueue_info *minfo, | 1447 | struct md_enqueue_info *minfo) |
1448 | struct ldlm_enqueue_info *einfo) | ||
1449 | { | 1448 | { |
1450 | int rc; | 1449 | int rc; |
1451 | 1450 | ||
1452 | EXP_CHECK_MD_OP(exp, intent_getattr_async); | 1451 | EXP_CHECK_MD_OP(exp, intent_getattr_async); |
1453 | EXP_MD_COUNTER_INCREMENT(exp, intent_getattr_async); | 1452 | EXP_MD_COUNTER_INCREMENT(exp, intent_getattr_async); |
1454 | rc = MDP(exp->exp_obd, intent_getattr_async)(exp, minfo, einfo); | 1453 | rc = MDP(exp->exp_obd, intent_getattr_async)(exp, minfo); |
1455 | return rc; | 1454 | return rc; |
1456 | } | 1455 | } |
1457 | 1456 | ||
diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c index f1ee17f9ec0d..fb7c315b33cb 100644 --- a/drivers/staging/lustre/lustre/llite/statahead.c +++ b/drivers/staging/lustre/lustre/llite/statahead.c | |||
@@ -79,6 +79,8 @@ struct sa_entry { | |||
79 | struct inode *se_inode; | 79 | struct inode *se_inode; |
80 | /* entry name */ | 80 | /* entry name */ |
81 | struct qstr se_qstr; | 81 | struct qstr se_qstr; |
82 | /* entry fid */ | ||
83 | struct lu_fid se_fid; | ||
82 | }; | 84 | }; |
83 | 85 | ||
84 | static unsigned int sai_generation; | 86 | static unsigned int sai_generation; |
@@ -169,7 +171,7 @@ static inline int is_omitted_entry(struct ll_statahead_info *sai, __u64 index) | |||
169 | /* allocate sa_entry and hash it to allow scanner process to find it */ | 171 | /* allocate sa_entry and hash it to allow scanner process to find it */ |
170 | static struct sa_entry * | 172 | static struct sa_entry * |
171 | sa_alloc(struct dentry *parent, struct ll_statahead_info *sai, __u64 index, | 173 | sa_alloc(struct dentry *parent, struct ll_statahead_info *sai, __u64 index, |
172 | const char *name, int len) | 174 | const char *name, int len, const struct lu_fid *fid) |
173 | { | 175 | { |
174 | struct ll_inode_info *lli; | 176 | struct ll_inode_info *lli; |
175 | struct sa_entry *entry; | 177 | struct sa_entry *entry; |
@@ -194,6 +196,7 @@ sa_alloc(struct dentry *parent, struct ll_statahead_info *sai, __u64 index, | |||
194 | entry->se_qstr.hash = full_name_hash(parent, name, len); | 196 | entry->se_qstr.hash = full_name_hash(parent, name, len); |
195 | entry->se_qstr.len = len; | 197 | entry->se_qstr.len = len; |
196 | entry->se_qstr.name = dname; | 198 | entry->se_qstr.name = dname; |
199 | entry->se_fid = *fid; | ||
197 | 200 | ||
198 | lli = ll_i2info(sai->sai_dentry->d_inode); | 201 | lli = ll_i2info(sai->sai_dentry->d_inode); |
199 | spin_lock(&lli->lli_sa_lock); | 202 | spin_lock(&lli->lli_sa_lock); |
@@ -566,24 +569,8 @@ static void sa_instantiate(struct ll_statahead_info *sai, | |||
566 | } | 569 | } |
567 | 570 | ||
568 | child = entry->se_inode; | 571 | child = entry->se_inode; |
569 | if (!child) { | 572 | if (child) { |
570 | /* | 573 | /* revalidate; unlinked and re-created with the same name */ |
571 | * lookup. | ||
572 | */ | ||
573 | LASSERT(fid_is_zero(&minfo->mi_data.op_fid2)); | ||
574 | |||
575 | /* XXX: No fid in reply, this is probably cross-ref case. | ||
576 | * SA can't handle it yet. | ||
577 | */ | ||
578 | if (body->mbo_valid & OBD_MD_MDS) { | ||
579 | rc = -EAGAIN; | ||
580 | goto out; | ||
581 | } | ||
582 | } else { | ||
583 | /* | ||
584 | * revalidate. | ||
585 | */ | ||
586 | /* unlinked and re-created with the same name */ | ||
587 | if (unlikely(!lu_fid_eq(&minfo->mi_data.op_fid2, &body->mbo_fid1))) { | 574 | if (unlikely(!lu_fid_eq(&minfo->mi_data.op_fid2, &body->mbo_fid1))) { |
588 | entry->se_inode = NULL; | 575 | entry->se_inode = NULL; |
589 | iput(child); | 576 | iput(child); |
@@ -720,50 +707,42 @@ static int ll_statahead_interpret(struct ptlrpc_request *req, | |||
720 | } | 707 | } |
721 | 708 | ||
722 | /* finish async stat RPC arguments */ | 709 | /* finish async stat RPC arguments */ |
723 | static void sa_fini_data(struct md_enqueue_info *minfo, | 710 | static void sa_fini_data(struct md_enqueue_info *minfo) |
724 | struct ldlm_enqueue_info *einfo) | ||
725 | { | 711 | { |
726 | LASSERT(minfo && einfo); | ||
727 | iput(minfo->mi_dir); | 712 | iput(minfo->mi_dir); |
728 | kfree(minfo); | 713 | kfree(minfo); |
729 | kfree(einfo); | ||
730 | } | 714 | } |
731 | 715 | ||
732 | /** | 716 | /** |
733 | * prepare arguments for async stat RPC. | 717 | * prepare arguments for async stat RPC. |
734 | */ | 718 | */ |
735 | static int sa_prep_data(struct inode *dir, struct inode *child, | 719 | static struct md_enqueue_info * |
736 | struct sa_entry *entry, struct md_enqueue_info **pmi, | 720 | sa_prep_data(struct inode *dir, struct inode *child, struct sa_entry *entry) |
737 | struct ldlm_enqueue_info **pei) | ||
738 | { | 721 | { |
739 | const struct qstr *qstr = &entry->se_qstr; | ||
740 | struct md_enqueue_info *minfo; | 722 | struct md_enqueue_info *minfo; |
741 | struct ldlm_enqueue_info *einfo; | 723 | struct ldlm_enqueue_info *einfo; |
742 | struct md_op_data *op_data; | 724 | struct md_op_data *op_data; |
743 | 725 | ||
744 | einfo = kzalloc(sizeof(*einfo), GFP_NOFS); | ||
745 | if (!einfo) | ||
746 | return -ENOMEM; | ||
747 | |||
748 | minfo = kzalloc(sizeof(*minfo), GFP_NOFS); | 726 | minfo = kzalloc(sizeof(*minfo), GFP_NOFS); |
749 | if (!minfo) { | 727 | if (!minfo) |
750 | kfree(einfo); | 728 | return ERR_PTR(-ENOMEM); |
751 | return -ENOMEM; | ||
752 | } | ||
753 | 729 | ||
754 | op_data = ll_prep_md_op_data(&minfo->mi_data, dir, child, qstr->name, | 730 | op_data = ll_prep_md_op_data(&minfo->mi_data, dir, child, NULL, 0, 0, |
755 | qstr->len, 0, LUSTRE_OPC_ANY, NULL); | 731 | LUSTRE_OPC_ANY, NULL); |
756 | if (IS_ERR(op_data)) { | 732 | if (IS_ERR(op_data)) { |
757 | kfree(einfo); | ||
758 | kfree(minfo); | 733 | kfree(minfo); |
759 | return PTR_ERR(op_data); | 734 | return (struct md_enqueue_info *)op_data; |
760 | } | 735 | } |
761 | 736 | ||
737 | if (!child) | ||
738 | op_data->op_fid2 = entry->se_fid; | ||
739 | |||
762 | minfo->mi_it.it_op = IT_GETATTR; | 740 | minfo->mi_it.it_op = IT_GETATTR; |
763 | minfo->mi_dir = igrab(dir); | 741 | minfo->mi_dir = igrab(dir); |
764 | minfo->mi_cb = ll_statahead_interpret; | 742 | minfo->mi_cb = ll_statahead_interpret; |
765 | minfo->mi_cbdata = entry; | 743 | minfo->mi_cbdata = entry; |
766 | 744 | ||
745 | einfo = &minfo->mi_einfo; | ||
767 | einfo->ei_type = LDLM_IBITS; | 746 | einfo->ei_type = LDLM_IBITS; |
768 | einfo->ei_mode = it_to_lock_mode(&minfo->mi_it); | 747 | einfo->ei_mode = it_to_lock_mode(&minfo->mi_it); |
769 | einfo->ei_cb_bl = ll_md_blocking_ast; | 748 | einfo->ei_cb_bl = ll_md_blocking_ast; |
@@ -771,26 +750,22 @@ static int sa_prep_data(struct inode *dir, struct inode *child, | |||
771 | einfo->ei_cb_gl = NULL; | 750 | einfo->ei_cb_gl = NULL; |
772 | einfo->ei_cbdata = NULL; | 751 | einfo->ei_cbdata = NULL; |
773 | 752 | ||
774 | *pmi = minfo; | 753 | return minfo; |
775 | *pei = einfo; | ||
776 | |||
777 | return 0; | ||
778 | } | 754 | } |
779 | 755 | ||
780 | /* async stat for file not found in dcache */ | 756 | /* async stat for file not found in dcache */ |
781 | static int sa_lookup(struct inode *dir, struct sa_entry *entry) | 757 | static int sa_lookup(struct inode *dir, struct sa_entry *entry) |
782 | { | 758 | { |
783 | struct md_enqueue_info *minfo; | 759 | struct md_enqueue_info *minfo; |
784 | struct ldlm_enqueue_info *einfo; | ||
785 | int rc; | 760 | int rc; |
786 | 761 | ||
787 | rc = sa_prep_data(dir, NULL, entry, &minfo, &einfo); | 762 | minfo = sa_prep_data(dir, NULL, entry); |
788 | if (rc) | 763 | if (IS_ERR(minfo)) |
789 | return rc; | 764 | return PTR_ERR(minfo); |
790 | 765 | ||
791 | rc = md_intent_getattr_async(ll_i2mdexp(dir), minfo, einfo); | 766 | rc = md_intent_getattr_async(ll_i2mdexp(dir), minfo); |
792 | if (rc) | 767 | if (rc) |
793 | sa_fini_data(minfo, einfo); | 768 | sa_fini_data(minfo); |
794 | 769 | ||
795 | return rc; | 770 | return rc; |
796 | } | 771 | } |
@@ -809,7 +784,6 @@ static int sa_revalidate(struct inode *dir, struct sa_entry *entry, | |||
809 | struct lookup_intent it = { .it_op = IT_GETATTR, | 784 | struct lookup_intent it = { .it_op = IT_GETATTR, |
810 | .it_lock_handle = 0 }; | 785 | .it_lock_handle = 0 }; |
811 | struct md_enqueue_info *minfo; | 786 | struct md_enqueue_info *minfo; |
812 | struct ldlm_enqueue_info *einfo; | ||
813 | int rc; | 787 | int rc; |
814 | 788 | ||
815 | if (unlikely(!inode)) | 789 | if (unlikely(!inode)) |
@@ -827,25 +801,26 @@ static int sa_revalidate(struct inode *dir, struct sa_entry *entry, | |||
827 | return 1; | 801 | return 1; |
828 | } | 802 | } |
829 | 803 | ||
830 | rc = sa_prep_data(dir, inode, entry, &minfo, &einfo); | 804 | minfo = sa_prep_data(dir, inode, entry); |
831 | if (rc) { | 805 | if (IS_ERR(minfo)) { |
832 | entry->se_inode = NULL; | 806 | entry->se_inode = NULL; |
833 | iput(inode); | 807 | iput(inode); |
834 | return rc; | 808 | return PTR_ERR(minfo); |
835 | } | 809 | } |
836 | 810 | ||
837 | rc = md_intent_getattr_async(ll_i2mdexp(dir), minfo, einfo); | 811 | rc = md_intent_getattr_async(ll_i2mdexp(dir), minfo); |
838 | if (rc) { | 812 | if (rc) { |
839 | entry->se_inode = NULL; | 813 | entry->se_inode = NULL; |
840 | iput(inode); | 814 | iput(inode); |
841 | sa_fini_data(minfo, einfo); | 815 | sa_fini_data(minfo); |
842 | } | 816 | } |
843 | 817 | ||
844 | return rc; | 818 | return rc; |
845 | } | 819 | } |
846 | 820 | ||
847 | /* async stat for file with @name */ | 821 | /* async stat for file with @name */ |
848 | static void sa_statahead(struct dentry *parent, const char *name, int len) | 822 | static void sa_statahead(struct dentry *parent, const char *name, int len, |
823 | const struct lu_fid *fid) | ||
849 | { | 824 | { |
850 | struct inode *dir = d_inode(parent); | 825 | struct inode *dir = d_inode(parent); |
851 | struct ll_inode_info *lli = ll_i2info(dir); | 826 | struct ll_inode_info *lli = ll_i2info(dir); |
@@ -854,7 +829,7 @@ static void sa_statahead(struct dentry *parent, const char *name, int len) | |||
854 | struct sa_entry *entry; | 829 | struct sa_entry *entry; |
855 | int rc; | 830 | int rc; |
856 | 831 | ||
857 | entry = sa_alloc(parent, sai, sai->sai_index, name, len); | 832 | entry = sa_alloc(parent, sai, sai->sai_index, name, len, fid); |
858 | if (IS_ERR(entry)) | 833 | if (IS_ERR(entry)) |
859 | return; | 834 | return; |
860 | 835 | ||
@@ -1043,6 +1018,7 @@ static int ll_statahead_thread(void *arg) | |||
1043 | for (ent = lu_dirent_start(dp); | 1018 | for (ent = lu_dirent_start(dp); |
1044 | ent && thread_is_running(sa_thread) && !sa_low_hit(sai); | 1019 | ent && thread_is_running(sa_thread) && !sa_low_hit(sai); |
1045 | ent = lu_dirent_next(ent)) { | 1020 | ent = lu_dirent_next(ent)) { |
1021 | struct lu_fid fid; | ||
1046 | __u64 hash; | 1022 | __u64 hash; |
1047 | int namelen; | 1023 | int namelen; |
1048 | char *name; | 1024 | char *name; |
@@ -1088,6 +1064,8 @@ static int ll_statahead_thread(void *arg) | |||
1088 | if (unlikely(++first == 1)) | 1064 | if (unlikely(++first == 1)) |
1089 | continue; | 1065 | continue; |
1090 | 1066 | ||
1067 | fid_le_to_cpu(&fid, &ent->lde_fid); | ||
1068 | |||
1091 | /* wait for spare statahead window */ | 1069 | /* wait for spare statahead window */ |
1092 | do { | 1070 | do { |
1093 | l_wait_event(sa_thread->t_ctl_waitq, | 1071 | l_wait_event(sa_thread->t_ctl_waitq, |
@@ -1117,7 +1095,7 @@ static int ll_statahead_thread(void *arg) | |||
1117 | } while (sa_sent_full(sai) && | 1095 | } while (sa_sent_full(sai) && |
1118 | thread_is_running(sa_thread)); | 1096 | thread_is_running(sa_thread)); |
1119 | 1097 | ||
1120 | sa_statahead(parent, name, namelen); | 1098 | sa_statahead(parent, name, namelen, &fid); |
1121 | } | 1099 | } |
1122 | 1100 | ||
1123 | pos = le64_to_cpu(dp->ldp_hash_end); | 1101 | pos = le64_to_cpu(dp->ldp_hash_end); |
diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 76a0306df5a6..6a3b83f7857c 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c | |||
@@ -3012,24 +3012,40 @@ static int lmv_clear_open_replay_data(struct obd_export *exp, | |||
3012 | } | 3012 | } |
3013 | 3013 | ||
3014 | static int lmv_intent_getattr_async(struct obd_export *exp, | 3014 | static int lmv_intent_getattr_async(struct obd_export *exp, |
3015 | struct md_enqueue_info *minfo, | 3015 | struct md_enqueue_info *minfo) |
3016 | struct ldlm_enqueue_info *einfo) | ||
3017 | { | 3016 | { |
3018 | struct md_op_data *op_data = &minfo->mi_data; | 3017 | struct md_op_data *op_data = &minfo->mi_data; |
3019 | struct obd_device *obd = exp->exp_obd; | 3018 | struct obd_device *obd = exp->exp_obd; |
3020 | struct lmv_obd *lmv = &obd->u.lmv; | 3019 | struct lmv_obd *lmv = &obd->u.lmv; |
3021 | struct lmv_tgt_desc *tgt = NULL; | 3020 | struct lmv_tgt_desc *ptgt = NULL; |
3021 | struct lmv_tgt_desc *ctgt = NULL; | ||
3022 | int rc; | 3022 | int rc; |
3023 | 3023 | ||
3024 | if (!fid_is_sane(&op_data->op_fid2)) | ||
3025 | return -EINVAL; | ||
3026 | |||
3024 | rc = lmv_check_connect(obd); | 3027 | rc = lmv_check_connect(obd); |
3025 | if (rc) | 3028 | if (rc) |
3026 | return rc; | 3029 | return rc; |
3027 | 3030 | ||
3028 | tgt = lmv_locate_mds(lmv, op_data, &op_data->op_fid1); | 3031 | ptgt = lmv_locate_mds(lmv, op_data, &op_data->op_fid1); |
3029 | if (IS_ERR(tgt)) | 3032 | if (IS_ERR(ptgt)) |
3030 | return PTR_ERR(tgt); | 3033 | return PTR_ERR(ptgt); |
3034 | |||
3035 | ctgt = lmv_locate_mds(lmv, op_data, &op_data->op_fid2); | ||
3036 | if (IS_ERR(ctgt)) | ||
3037 | return PTR_ERR(ctgt); | ||
3038 | |||
3039 | /* | ||
3040 | * if child is on remote MDT, we need 2 async RPCs to fetch both LOOKUP | ||
3041 | * lock on parent, and UPDATE lock on child MDT, which makes all | ||
3042 | * complicated. Considering remote dir is rare case, and not supporting | ||
3043 | * it in statahead won't cause any issue, drop its support for now. | ||
3044 | */ | ||
3045 | if (ptgt != ctgt) | ||
3046 | return -ENOTSUPP; | ||
3031 | 3047 | ||
3032 | return md_intent_getattr_async(tgt->ltd_exp, minfo, einfo); | 3048 | return md_intent_getattr_async(ptgt->ltd_exp, minfo); |
3033 | } | 3049 | } |
3034 | 3050 | ||
3035 | static int lmv_revalidate_lock(struct obd_export *exp, struct lookup_intent *it, | 3051 | static int lmv_revalidate_lock(struct obd_export *exp, struct lookup_intent *it, |
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_internal.h b/drivers/staging/lustre/lustre/mdc/mdc_internal.h index 881c6a0676a6..fecedc8819ed 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_internal.h +++ b/drivers/staging/lustre/lustre/mdc/mdc_internal.h | |||
@@ -116,8 +116,7 @@ int mdc_revalidate_lock(struct obd_export *exp, struct lookup_intent *it, | |||
116 | struct lu_fid *fid, __u64 *bits); | 116 | struct lu_fid *fid, __u64 *bits); |
117 | 117 | ||
118 | int mdc_intent_getattr_async(struct obd_export *exp, | 118 | int mdc_intent_getattr_async(struct obd_export *exp, |
119 | struct md_enqueue_info *minfo, | 119 | struct md_enqueue_info *minfo); |
120 | struct ldlm_enqueue_info *einfo); | ||
121 | 120 | ||
122 | enum ldlm_mode mdc_lock_match(struct obd_export *exp, __u64 flags, | 121 | enum ldlm_mode mdc_lock_match(struct obd_export *exp, __u64 flags, |
123 | const struct lu_fid *fid, enum ldlm_type type, | 122 | const struct lu_fid *fid, enum ldlm_type type, |
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c index 41165f4536d0..4c8f20a0c37d 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c | |||
@@ -49,7 +49,6 @@ | |||
49 | struct mdc_getattr_args { | 49 | struct mdc_getattr_args { |
50 | struct obd_export *ga_exp; | 50 | struct obd_export *ga_exp; |
51 | struct md_enqueue_info *ga_minfo; | 51 | struct md_enqueue_info *ga_minfo; |
52 | struct ldlm_enqueue_info *ga_einfo; | ||
53 | }; | 52 | }; |
54 | 53 | ||
55 | int it_open_error(int phase, struct lookup_intent *it) | 54 | int it_open_error(int phase, struct lookup_intent *it) |
@@ -1111,7 +1110,7 @@ static int mdc_intent_getattr_async_interpret(const struct lu_env *env, | |||
1111 | struct mdc_getattr_args *ga = args; | 1110 | struct mdc_getattr_args *ga = args; |
1112 | struct obd_export *exp = ga->ga_exp; | 1111 | struct obd_export *exp = ga->ga_exp; |
1113 | struct md_enqueue_info *minfo = ga->ga_minfo; | 1112 | struct md_enqueue_info *minfo = ga->ga_minfo; |
1114 | struct ldlm_enqueue_info *einfo = ga->ga_einfo; | 1113 | struct ldlm_enqueue_info *einfo = &minfo->mi_einfo; |
1115 | struct lookup_intent *it; | 1114 | struct lookup_intent *it; |
1116 | struct lustre_handle *lockh; | 1115 | struct lustre_handle *lockh; |
1117 | struct obd_device *obddev; | 1116 | struct obd_device *obddev; |
@@ -1147,14 +1146,12 @@ static int mdc_intent_getattr_async_interpret(const struct lu_env *env, | |||
1147 | rc = mdc_finish_intent_lock(exp, req, &minfo->mi_data, it, lockh); | 1146 | rc = mdc_finish_intent_lock(exp, req, &minfo->mi_data, it, lockh); |
1148 | 1147 | ||
1149 | out: | 1148 | out: |
1150 | kfree(einfo); | ||
1151 | minfo->mi_cb(req, minfo, rc); | 1149 | minfo->mi_cb(req, minfo, rc); |
1152 | return 0; | 1150 | return 0; |
1153 | } | 1151 | } |
1154 | 1152 | ||
1155 | int mdc_intent_getattr_async(struct obd_export *exp, | 1153 | int mdc_intent_getattr_async(struct obd_export *exp, |
1156 | struct md_enqueue_info *minfo, | 1154 | struct md_enqueue_info *minfo) |
1157 | struct ldlm_enqueue_info *einfo) | ||
1158 | { | 1155 | { |
1159 | struct md_op_data *op_data = &minfo->mi_data; | 1156 | struct md_op_data *op_data = &minfo->mi_data; |
1160 | struct lookup_intent *it = &minfo->mi_it; | 1157 | struct lookup_intent *it = &minfo->mi_it; |
@@ -1162,10 +1159,6 @@ int mdc_intent_getattr_async(struct obd_export *exp, | |||
1162 | struct mdc_getattr_args *ga; | 1159 | struct mdc_getattr_args *ga; |
1163 | struct obd_device *obddev = class_exp2obd(exp); | 1160 | struct obd_device *obddev = class_exp2obd(exp); |
1164 | struct ldlm_res_id res_id; | 1161 | struct ldlm_res_id res_id; |
1165 | /*XXX: Both MDS_INODELOCK_LOOKUP and MDS_INODELOCK_UPDATE are needed | ||
1166 | * for statahead currently. Consider CMD in future, such two bits | ||
1167 | * maybe managed by different MDS, should be adjusted then. | ||
1168 | */ | ||
1169 | union ldlm_policy_data policy = { | 1162 | union ldlm_policy_data policy = { |
1170 | .l_inodebits = { MDS_INODELOCK_LOOKUP | MDS_INODELOCK_UPDATE } | 1163 | .l_inodebits = { MDS_INODELOCK_LOOKUP | MDS_INODELOCK_UPDATE } |
1171 | }; | 1164 | }; |
@@ -1188,8 +1181,8 @@ int mdc_intent_getattr_async(struct obd_export *exp, | |||
1188 | return rc; | 1181 | return rc; |
1189 | } | 1182 | } |
1190 | 1183 | ||
1191 | rc = ldlm_cli_enqueue(exp, &req, einfo, &res_id, &policy, &flags, NULL, | 1184 | rc = ldlm_cli_enqueue(exp, &req, &minfo->mi_einfo, &res_id, &policy, |
1192 | 0, LVB_T_NONE, &minfo->mi_lockh, 1); | 1185 | &flags, NULL, 0, LVB_T_NONE, &minfo->mi_lockh, 1); |
1193 | if (rc < 0) { | 1186 | if (rc < 0) { |
1194 | obd_put_request_slot(&obddev->u.cli); | 1187 | obd_put_request_slot(&obddev->u.cli); |
1195 | ptlrpc_req_finished(req); | 1188 | ptlrpc_req_finished(req); |
@@ -1200,7 +1193,6 @@ int mdc_intent_getattr_async(struct obd_export *exp, | |||
1200 | ga = ptlrpc_req_async_args(req); | 1193 | ga = ptlrpc_req_async_args(req); |
1201 | ga->ga_exp = exp; | 1194 | ga->ga_exp = exp; |
1202 | ga->ga_minfo = minfo; | 1195 | ga->ga_minfo = minfo; |
1203 | ga->ga_einfo = einfo; | ||
1204 | 1196 | ||
1205 | req->rq_interpret_reply = mdc_intent_getattr_async_interpret; | 1197 | req->rq_interpret_reply = mdc_intent_getattr_async_interpret; |
1206 | ptlrpcd_add_req(req); | 1198 | ptlrpcd_add_req(req); |