Whamcloud - gitweb
on OSS compare the whole capa structure because we might have 2 capa only
authorericm <ericm>
Wed, 21 Sep 2005 01:01:01 +0000 (01:01 +0000)
committerericm <ericm>
Wed, 21 Sep 2005 01:01:01 +0000 (01:01 +0000)
have difference in expiry time.

lustre/include/linux/lustre_sec.h
lustre/obdclass/capa.c
lustre/obdfilter/filter_capa.c

index 98d21a0..beb38b1 100644 (file)
@@ -606,6 +606,7 @@ int capa_op(int flags);
 void __capa_get(struct obd_capa *ocapa);
 struct obd_capa *capa_get(uid_t uid, int capa_op, __u64 mdsid,
                           unsigned long ino, __u32 igen, int type);
+struct obd_capa *filter_capa_get(struct lustre_capa *capa);
 void capa_put(struct obd_capa *ocapa);
 struct obd_capa *capa_renew(struct lustre_capa *capa, int type);
 void capa_hmac(struct crypto_tfm *tfm, __u8 *key, struct lustre_capa *capa);
index d235d01..c8385f5 100644 (file)
@@ -298,6 +298,33 @@ capa_get(uid_t uid, int capa_op,__u64 mdsid, unsigned long ino,
         return ocapa;
 }
 
+struct obd_capa * filter_capa_get(struct lustre_capa *capa)
+{
+        struct hlist_head *head = capa_hash +
+                capa_hashfn(capa->lc_uid, capa->lc_mdsid, capa->lc_ino);
+        struct hlist_node *pos;
+        struct obd_capa *ocapa;
+
+        spin_lock(&capa_lock);
+
+        hlist_for_each_entry(ocapa, pos, head, c_hash) {
+                if (ocapa->c_type != FILTER_CAPA)
+                        continue;
+                if (!memcmp(&ocapa->c_capa, capa,
+                            sizeof(struct lustre_capa_data))) {
+                        __capa_get(ocapa);
+
+                        DEBUG_CAPA(D_INODE, &ocapa->c_capa, "found %s",
+                                   capa_type_name[ocapa->c_type]);
+                        spin_unlock(&capa_lock);
+                        return ocapa;
+                }
+        }
+
+        spin_unlock(&capa_lock);
+        return NULL;
+}
+
 void capa_put(struct obd_capa *ocapa)
 {
         if (!ocapa)
@@ -403,6 +430,7 @@ int capa_is_to_expire(struct obd_capa *ocapa)
 
 EXPORT_SYMBOL(capa_op);
 EXPORT_SYMBOL(capa_get);
+EXPORT_SYMBOL(filter_capa_get);
 EXPORT_SYMBOL(capa_put);
 EXPORT_SYMBOL(capa_renew);
 EXPORT_SYMBOL(__capa_get);
index a1b2053..9607b0e 100644 (file)
@@ -258,8 +258,7 @@ filter_verify_capa(int cmd, struct obd_export *exp, struct lustre_capa *capa)
                 RETURN(-ESTALE);
         }
 
-        ocapa = capa_get(capa->lc_uid, capa->lc_op, capa->lc_mdsid,
-                         capa->lc_ino, capa->lc_igen, FILTER_CAPA);
+        ocapa = filter_capa_get(capa);
 verify:
         if (ocapa) {
                 struct timeval tv;