Whamcloud - gitweb
add debug code for capa cleanup failure.
authorlsy <lsy>
Wed, 8 Nov 2006 10:49:22 +0000 (10:49 +0000)
committerlsy <lsy>
Wed, 8 Nov 2006 10:49:22 +0000 (10:49 +0000)
rename filter_verify_capa to filter_auth_capa.

lustre/mdt/mdt_lproc.c
lustre/obdclass/capa.c
lustre/obdfilter/filter.c
lustre/obdfilter/filter_capa.c
lustre/obdfilter/filter_internal.h
lustre/obdfilter/filter_io.c
lustre/obdfilter/lproc_obdfilter.c

index 1f7f683..c4f885e 100644 (file)
@@ -578,6 +578,12 @@ static int lprocfs_wr_capa(struct file *file, const char *buffer,
         mdt->mdt_opts.mo_oss_capa = (val & 0x1);
         mdt->mdt_opts.mo_mds_capa = !!(val & 0x2);
         mdt->mdt_capa_conf = 1;
+        LCONSOLE_INFO("MDS %s %s MDS fid capability.\n",
+                      obd->obd_name,
+                      mdt->mdt_opts.mo_mds_capa ? "enabled" : "disabled");
+        LCONSOLE_INFO("MDS %s %s OSS fid capability.\n",
+                      obd->obd_name,
+                      mdt->mdt_opts.mo_oss_capa ? "enabled" : "disabled");
         return count;
 }
 
index 8d5f173..839bd38 100644 (file)
@@ -96,13 +96,24 @@ int init_capa_hash(void)
 void cleanup_capa_hash(void)
 {
         int i;
+        struct hlist_node *pos;
+        struct obd_capa *oc;
 
-        for (i = 0; i < NR_CAPAHASH; i++)
-                LASSERTF(hlist_empty(capa_hash + i),
-                         "capa hash %d not empty\n", i);
-        for (i = CAPA_SITE_MAX; i < CAPA_SITE_MAX; i++)
-                LASSERTF(list_empty(&capa_list[i]),
-                         "capa list %d not empty\n", i);
+        for (i = 0; i < NR_CAPAHASH; i++) {
+                if (hlist_empty(capa_hash + i))
+                        continue;
+                hlist_for_each_entry(oc, pos, capa_hash + i, u.tgt.c_hash)
+                        DEBUG_CAPA(D_ERROR, &oc->c_capa, "remaining cached");
+                LBUG();
+        }
+        for (i = CAPA_SITE_MAX; i < CAPA_SITE_MAX; i++) {
+                if (list_empty(&capa_list[i]))
+                        continue;
+                list_for_each_entry(oc, &capa_list[i], c_list)
+                        DEBUG_CAPA(D_ERROR, &oc->c_capa, "remaining %s",
+                                   capa_site_name[oc->c_site]);
+                LBUG();
+        }
         OBD_FREE(capa_hash, PAGE_SIZE);
 }
 
index c8e699f..343289c 100644 (file)
@@ -2730,8 +2730,8 @@ static int filter_getattr(struct obd_export *exp, struct obd_info *oinfo)
         int rc = 0;
         ENTRY;
 
-        rc = filter_verify_capa(exp, NULL, oinfo_mdsno(oinfo),
-                                oinfo_capa(oinfo), CAPA_OPC_META_READ);
+        rc = filter_auth_capa(exp, NULL, oinfo_mdsno(oinfo),
+                              oinfo_capa(oinfo), CAPA_OPC_META_READ);
         if (rc)
                 RETURN(rc);
 
@@ -2939,8 +2939,8 @@ int filter_setattr(struct obd_export *exp, struct obd_info *oinfo,
         int rc;
         ENTRY;
 
-        rc = filter_verify_capa(exp, NULL, oinfo_mdsno(oinfo),
-                                oinfo_capa(oinfo), CAPA_OPC_META_WRITE);
+        rc = filter_auth_capa(exp, NULL, oinfo_mdsno(oinfo),
+                              oinfo_capa(oinfo), CAPA_OPC_META_WRITE);
         if (rc)
                 RETURN(rc);
 
@@ -3612,8 +3612,8 @@ static int filter_truncate(struct obd_export *exp, struct obd_info *oinfo,
                ", o_size = "LPD64"\n", oinfo->oi_oa->o_id,
                oinfo->oi_oa->o_valid, oinfo->oi_policy.l_extent.start);
 
-        rc = filter_verify_capa(exp, NULL, oinfo_mdsno(oinfo),
-                                oinfo_capa(oinfo), CAPA_OPC_OSS_TRUNC);
+        rc = filter_auth_capa(exp, NULL, oinfo_mdsno(oinfo),
+                              oinfo_capa(oinfo), CAPA_OPC_OSS_TRUNC);
         if (rc)
                 RETURN(rc);
 
@@ -3633,8 +3633,8 @@ static int filter_sync(struct obd_export *exp, struct obdo *oa,
         int rc, rc2;
         ENTRY;
 
-        rc = filter_verify_capa(exp, NULL, obdo_mdsno(oa),
-                                (struct lustre_capa *)capa, CAPA_OPC_OSS_WRITE);
+        rc = filter_auth_capa(exp, NULL, obdo_mdsno(oa),
+                              (struct lustre_capa *)capa, CAPA_OPC_OSS_WRITE);
         if (rc)
                 RETURN(rc);
 
index 12e67e9..c40d639 100644 (file)
@@ -95,8 +95,8 @@ int filter_update_capa_key(struct obd_device *obd, struct lustre_capa_key *new)
         RETURN(0);
 }
 
-int filter_verify_capa(struct obd_export *exp, struct lu_fid *fid, __u64 mdsid,
-                       struct lustre_capa *capa, __u64 opc)
+int filter_auth_capa(struct obd_export *exp, struct lu_fid *fid, __u64 mdsid,
+                     struct lustre_capa *capa, __u64 opc)
 {
         struct obd_device *obd = exp->exp_obd;
         struct filter_obd *filter = &obd->u.filter;
@@ -112,11 +112,12 @@ int filter_verify_capa(struct obd_export *exp, struct lu_fid *fid, __u64 mdsid,
                 RETURN(0);
 
         if (capa == NULL) {
-                CERROR("no capa has been passed\n");
+                CERROR("mdsno/fid/opc "LPU64"/"DFID"/"LPX64": no capa has been "
+                       "passed\n", mdsid, PFID(fid), opc);
                 RETURN(-EACCES);
         }
 
-#warning "enable fid check in filter_verify_capa when fid ready"
+#warning "enable fid check in filter_auth_capa when fid ready"
 
         if (opc == CAPA_OPC_OSS_READ) {
                 if (!(capa->lc_opc & CAPA_OPC_OSS_RW))
index 2ea4d0f..196d6c9 100644 (file)
@@ -199,7 +199,7 @@ static inline __u64 obdo_mdsno(struct obdo *oa)
 }
 
 int filter_update_capa_key(struct obd_device *obd, struct lustre_capa_key *key);
-int filter_verify_capa(struct obd_export *exp, struct lu_fid *fid, __u64 mdsid,
-                       struct lustre_capa *capa, __u64 opc);
+int filter_auth_capa(struct obd_export *exp, struct lu_fid *fid, __u64 mdsid,
+                     struct lustre_capa *capa, __u64 opc);
 void filter_free_capa_keys(struct filter_obd *filter);
 #endif /* _FILTER_INTERNAL_H */
index 0743433..e267297 100644 (file)
@@ -291,8 +291,8 @@ static int filter_preprw_read(int cmd, struct obd_export *exp, struct obdo *oa,
         LASSERTF(objcount == 1, "%d\n", objcount);
         LASSERTF(obj->ioo_bufcnt > 0, "%d\n", obj->ioo_bufcnt);
 
-        rc = filter_verify_capa(exp, NULL, obdo_mdsno(oa), capa,
-                                CAPA_OPC_OSS_READ);
+        rc = filter_auth_capa(exp, NULL, obdo_mdsno(oa), capa,
+                              CAPA_OPC_OSS_READ);
         if (rc)
                 RETURN(rc);
 
@@ -527,8 +527,8 @@ static int filter_preprw_write(int cmd, struct obd_export *exp, struct obdo *oa,
         LASSERT(objcount == 1);
         LASSERT(obj->ioo_bufcnt > 0);
 
-        rc = filter_verify_capa(exp, NULL, obdo_mdsno(oa), capa,
-                                CAPA_OPC_OSS_WRITE);
+        rc = filter_auth_capa(exp, NULL, obdo_mdsno(oa), capa,
+                              CAPA_OPC_OSS_WRITE);
         if (rc)
                 RETURN(rc);
 
index f3ea9fb..730a3f4 100644 (file)
@@ -334,6 +334,9 @@ static int lprocfs_filter_wr_capa(struct file *file, const char *buffer,
         }
 
         obd->u.filter.fo_fl_oss_capa = val;
+        if (val)
+                LCONSOLE_INFO("OSS %s enabled fid capability.\n",
+                              obd->obd_name);
         return count;
 }