From: ericm Date: Tue, 20 Sep 2005 03:05:40 +0000 (+0000) Subject: add inode generation in capability. X-Git-Tag: v1_7_100~655 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=61bdfc2a5cdee48698fc533b085ef0b262b47db9;p=fs%2Flustre-release.git add inode generation in capability. --- diff --git a/lustre/include/linux/lustre_idl.h b/lustre/include/linux/lustre_idl.h index 052debc..2859111 100644 --- a/lustre/include/linux/lustre_idl.h +++ b/lustre/include/linux/lustre_idl.h @@ -1053,6 +1053,7 @@ struct lustre_capa { __u32 lc_uid; /* uid, mapped uid */ __u32 lc_ruid; /* remote uid on client */ __u32 lc_op; /* operations allowed */ + __u32 lc_igen; /* inode generation */ __u64 lc_ino; /* inode# */ __u32 lc_mdsid; /* mds# */ __u32 lc_keyid; /* key used for the capability */ diff --git a/lustre/include/linux/lustre_sec.h b/lustre/include/linux/lustre_sec.h index 8805fc2..f9adb4e 100644 --- a/lustre/include/linux/lustre_sec.h +++ b/lustre/include/linux/lustre_sec.h @@ -605,7 +605,7 @@ extern struct timer_list ll_capa_timer; 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, int type); + unsigned long ino, __u32 igen, int type); 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/mds/mds_capa.c b/lustre/mds/mds_capa.c index dd38af6..f72fcff 100644 --- a/lustre/mds/mds_capa.c +++ b/lustre/mds/mds_capa.c @@ -533,7 +533,7 @@ int mds_pack_capa(struct obd_device *obd, struct mds_export_data *med, LASSERT(capa != NULL); ocapa = capa_get(req_capa->lc_uid, req_capa->lc_op, req_capa->lc_mdsid, - req_capa->lc_ino, MDS_CAPA); + req_capa->lc_ino, req_capa->lc_igen, MDS_CAPA); if (ocapa) { expired = capa_is_to_expire(ocapa); if (!expired) { diff --git a/lustre/mds/mds_open.c b/lustre/mds/mds_open.c index 963a74d..f19174e 100644 --- a/lustre/mds/mds_open.c +++ b/lustre/mds/mds_open.c @@ -788,6 +788,7 @@ static int mds_finish_open(struct ptlrpc_request *req, struct dentry *dchild, .lc_uid = rec->ur_uc.luc_uid, .lc_op = capa_op(rec->ur_flags), .lc_ino = dchild->d_inode->i_ino, + .lc_igen = dchild->d_inode->i_generation, .lc_mdsid = mds->mds_num, }; diff --git a/lustre/obdclass/capa.c b/lustre/obdclass/capa.c index 28e882e..a28472d 100644 --- a/lustre/obdclass/capa.c +++ b/lustre/obdclass/capa.c @@ -86,7 +86,7 @@ int capa_op(int flags) static struct obd_capa * find_capa(struct hlist_head *head, uid_t uid, int capa_op, __u64 mdsid, - unsigned long ino, int type) + unsigned long ino, __u32 igen, int type) { struct hlist_node *pos; struct obd_capa *ocapa; @@ -95,6 +95,8 @@ find_capa(struct hlist_head *head, uid_t uid, int capa_op, __u64 mdsid, hlist_for_each_entry(ocapa, pos, head, c_hash) { if (ocapa->c_capa.lc_ino != ino) continue; + if (ocapa->c_capa.lc_igen != igen) + continue; if (ocapa->c_capa.lc_mdsid != mdsid) continue; if ((ocapa->c_capa.lc_op & capa_op) != ocapa->c_capa.lc_op) @@ -127,12 +129,12 @@ inline void __capa_get(struct obd_capa *ocapa) static struct obd_capa * find_capa_locked(struct hlist_head *head, uid_t uid, int capa_op, __u64 mdsid, - unsigned long ino, int type) + unsigned long ino, __u32 igen, int type) { struct obd_capa *ocapa; spin_lock(&capa_lock); - ocapa = find_capa(head, uid, capa_op, mdsid, ino, type); + ocapa = find_capa(head, uid, capa_op, mdsid, ino, igen, type); if (ocapa) __capa_get(ocapa); spin_unlock(&capa_lock); @@ -237,7 +239,7 @@ get_new_capa_locked(struct hlist_head *head, int type, struct lustre_capa *capa) return NULL; spin_lock(&capa_lock); - old = find_capa(head, uid, capa_op, mdsid, ino, type); + old = find_capa(head, uid, capa_op, mdsid, ino, capa->lc_igen, type); if (!old) { do_update_capa(ocapa, capa); ocapa->c_type = type; @@ -282,12 +284,13 @@ get_new_capa_locked(struct hlist_head *head, int type, struct lustre_capa *capa) } struct obd_capa * -capa_get(uid_t uid, int capa_op,__u64 mdsid, unsigned long ino, int type) +capa_get(uid_t uid, int capa_op,__u64 mdsid, unsigned long ino, + __u32 igen, int type) { struct hlist_head *head = capa_hash + capa_hashfn(uid, mdsid, ino); struct obd_capa *ocapa; - ocapa = find_capa_locked(head, uid, capa_op, mdsid, ino, type); + ocapa = find_capa_locked(head, uid, capa_op, mdsid, ino, igen, type); return ocapa; } @@ -321,7 +324,7 @@ struct obd_capa *capa_renew(struct lustre_capa *capa, int type) struct obd_capa *ocapa; spin_lock(&capa_lock); - ocapa = find_capa(head, uid, capa_op, mdsid, ino, type); + ocapa = find_capa(head, uid, capa_op, mdsid, ino, capa->lc_igen, type); if (ocapa) { DEBUG_CAPA(D_INFO, capa, "renew %s", capa_type_name[type]); do_update_capa(ocapa, capa); diff --git a/lustre/obdfilter/filter_capa.c b/lustre/obdfilter/filter_capa.c index 09208b9..33c4026 100644 --- a/lustre/obdfilter/filter_capa.c +++ b/lustre/obdfilter/filter_capa.c @@ -252,7 +252,7 @@ filter_verify_capa(int cmd, struct obd_export *exp, struct lustre_capa *capa) } ocapa = capa_get(capa->lc_uid, capa->lc_op, capa->lc_mdsid, - capa->lc_ino, FILTER_CAPA); + capa->lc_ino, capa->lc_igen, FILTER_CAPA); verify: if (ocapa) { /* fo_capa_lock protects capa too */ diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 8a256d6..dbf8db5 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -814,7 +814,7 @@ static int osc_brw_prep_request(int cmd, struct obd_import *imp,struct obdo *oa, * capability could be used here */ capa_op = (opc == OST_WRITE) ? CAPA_WRITE : CAPA_READ | CAPA_WRITE; ocapa = capa_get(oa->o_fsuid, capa_op, raw_id->li_fid.lf_group, - raw_id->li_stc.u.e3s.l3s_ino, CLIENT_CAPA); + id_ino(raw_id), id_gen(raw_id), CLIENT_CAPA); size[bufcnt++] = sizeof(*body); size[bufcnt++] = sizeof(*ioobj); diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index 8736f7a..ba8fa3c 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -923,7 +923,9 @@ void lustre_swab_remote_perm(struct mds_remote_perm *p) void lustre_swab_lustre_capa(struct lustre_capa *c) { __swab32s (&c->lc_uid); + __swab32s (&c->lc_ruid); __swab32s (&c->lc_op); + __swab32s (&c->lc_igen); __swab64s (&c->lc_ino); __swab32s (&c->lc_mdsid); __swab32s (&c->lc_keyid); diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index 65b8874..84dd991 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -679,7 +679,9 @@ check_lustre_capa(void) BLANK_LINE(); CHECK_STRUCT(lustre_capa); CHECK_MEMBER(lustre_capa, lc_uid); + CHECK_MEMBER(lustre_capa, lc_ruid); CHECK_MEMBER(lustre_capa, lc_op); + CHECK_MEMBER(lustre_capa, lc_igen); CHECK_MEMBER(lustre_capa, lc_ino); CHECK_MEMBER(lustre_capa, lc_mdsid); CHECK_MEMBER(lustre_capa, lc_keyid);