From 29377377cc123f3dd1a9660c113b05369afb61e2 Mon Sep 17 00:00:00 2001 From: ericm Date: Wed, 21 Sep 2005 01:01:01 +0000 Subject: [PATCH] on OSS compare the whole capa structure because we might have 2 capa only have difference in expiry time. --- lustre/include/linux/lustre_sec.h | 1 + lustre/obdclass/capa.c | 28 ++++++++++++++++++++++++++++ lustre/obdfilter/filter_capa.c | 3 +-- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/lustre/include/linux/lustre_sec.h b/lustre/include/linux/lustre_sec.h index 98d21a0..beb38b1 100644 --- a/lustre/include/linux/lustre_sec.h +++ b/lustre/include/linux/lustre_sec.h @@ -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); diff --git a/lustre/obdclass/capa.c b/lustre/obdclass/capa.c index d235d01..c8385f5 100644 --- a/lustre/obdclass/capa.c +++ b/lustre/obdclass/capa.c @@ -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); diff --git a/lustre/obdfilter/filter_capa.c b/lustre/obdfilter/filter_capa.c index a1b2053..9607b0e 100644 --- a/lustre/obdfilter/filter_capa.c +++ b/lustre/obdfilter/filter_capa.c @@ -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; -- 1.8.3.1