Whamcloud - gitweb
LU-1597 obdfilter: fix some capa code for OST
authorBobi Jam <bobijam@whamcloud.com>
Wed, 11 Jul 2012 03:53:06 +0000 (11:53 +0800)
committerOleg Drokin <green@whamcloud.com>
Sat, 28 Jul 2012 05:04:19 +0000 (01:04 -0400)
* 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 <bobijam@whamcloud.com>
Change-Id: Ie27497d2b61654a7f24c06f6975e8bfaf5e9ae13
Reviewed-on: http://review.whamcloud.com/3372
Reviewed-by: Lai Siyao <laisiyao@whamcloud.com>
Tested-by: Hudson
Reviewed-by: Fan Yong <yong.fan@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Prakash Surya <surya1@llnl.gov>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/obdfilter/filter_capa.c
lustre/ost/ost_handler.c

index 59cf195..0e23110 100644 (file)
@@ -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;
 
index 17a0fb2..cd52890 100644 (file)
@@ -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,