From 27fe2e8d24e70af2377a52d411d53e332c3a3406 Mon Sep 17 00:00:00 2001 From: Bobi Jam Date: Wed, 11 Jul 2012 11:53:06 +0800 Subject: [PATCH] LU-1597 obdfilter: fix some capa code for OST * A capability should be set for filter_sync(), and when the operation is come from OSS itself, the capability check can be passed. * filter_capa_fixoa() need check whether filter enabled capability. Signed-off-by: Bobi Jam Change-Id: Ie27497d2b61654a7f24c06f6975e8bfaf5e9ae13 Reviewed-on: http://review.whamcloud.com/3372 Reviewed-by: Lai Siyao Tested-by: Hudson Reviewed-by: Fan Yong Tested-by: Maloo Reviewed-by: Prakash Surya Reviewed-by: Oleg Drokin --- lustre/obdfilter/filter_capa.c | 20 ++++++++++++++------ lustre/ost/ost_handler.c | 1 + 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/lustre/obdfilter/filter_capa.c b/lustre/obdfilter/filter_capa.c index 59cf195..0e23110 100644 --- a/lustre/obdfilter/filter_capa.c +++ b/lustre/obdfilter/filter_capa.c @@ -110,8 +110,9 @@ int filter_update_capa_key(struct obd_device *obd, struct lustre_capa_key *new) RETURN(0); } -int filter_auth_capa(struct obd_export *exp, struct lu_fid *fid, obd_seq seq, - struct lustre_capa *capa, __u64 opc) +int filter_auth_capa(struct obd_export *exp, + struct lu_fid *fid, obd_seq seq, + struct lustre_capa *capa, __u64 opc) { struct obd_device *obd = exp->exp_obd; struct filter_obd *filter = &obd->u.filter; @@ -126,6 +127,9 @@ int filter_auth_capa(struct obd_export *exp, struct lu_fid *fid, obd_seq seq, if (!fid_seq_is_mdt(seq)) RETURN(0); + if (capa == BYPASS_CAPA) + RETURN(0); + /* capability is disabled */ if (!filter->fo_fl_oss_capa) RETURN(0); @@ -226,8 +230,10 @@ int filter_auth_capa(struct obd_export *exp, struct lu_fid *fid, obd_seq seq, int filter_capa_fixoa(struct obd_export *exp, struct obdo *oa, obd_seq seq, struct lustre_capa *capa) { - int rc = 0; - ENTRY; + struct obd_device *obd = exp->exp_obd; + struct filter_obd *filter = &obd->u.filter; + int rc = 0; + ENTRY; /* skip capa check for llog and obdecho */ if (!fid_seq_is_mdt(seq)) @@ -236,12 +242,14 @@ int filter_capa_fixoa(struct obd_export *exp, struct obdo *oa, obd_seq seq, if (!(exp->exp_connect_flags & OBD_CONNECT_OSS_CAPA)) RETURN(0); + /* capability is disabled */ + if (!filter->fo_fl_oss_capa) + RETURN(0); + if (unlikely(!capa)) RETURN(-EACCES); if (capa_flags(capa) == LC_ID_CONVERT) { - struct obd_device *obd = exp->exp_obd; - struct filter_obd *filter = &obd->u.filter; struct filter_capa_key *k; int found = 0; diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index 17a0fb2..cd52890 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -1591,6 +1591,7 @@ int ost_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc, oa->o_seq = lock->l_resource->lr_name.name[1]; oa->o_valid = OBD_MD_FLID|OBD_MD_FLGROUP; oinfo->oi_oa = oa; + oinfo->oi_capa = BYPASS_CAPA; rc = obd_sync(&env, lock->l_export, oinfo, lock->l_policy_data.l_extent.start, -- 1.8.3.1