From: Bobi Jam Date: Thu, 12 Jul 2012 03:51:20 +0000 (+0800) Subject: LU-1597 obdfilter: fix some capa code for OST X-Git-Tag: 2.1.4-RC1~30 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=f144acc2d72740ebda8f77ce7c37c457ead1ef66;p=fs%2Flustre-release.git 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. port of master commit 27fe2e8d24e70af2377a52d411d53e332c3a3406 Signed-off-by: Bobi Jam Change-Id: Ie27497d2b61654a7f24c06f6975e8bfaf5e9ae13 Reviewed-on: http://review.whamcloud.com/3383 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin --- diff --git a/lustre/obdfilter/filter_capa.c b/lustre/obdfilter/filter_capa.c index 6595374..6d9c5e5 100644 --- a/lustre/obdfilter/filter_capa.c +++ b/lustre/obdfilter/filter_capa.c @@ -128,6 +128,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); @@ -228,6 +231,8 @@ 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) { + struct obd_device *obd = exp->exp_obd; + struct filter_obd *filter = &obd->u.filter; int rc = 0; ENTRY; @@ -238,12 +243,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 e31e254..f0d391b 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -1546,6 +1546,7 @@ int ost_blocking_ast(struct ldlm_lock *lock, 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(lock->l_export, oinfo, lock->l_policy_data.l_extent.start,