Whamcloud - gitweb
add inode generation in capability.
authorericm <ericm>
Tue, 20 Sep 2005 03:05:40 +0000 (03:05 +0000)
committerericm <ericm>
Tue, 20 Sep 2005 03:05:40 +0000 (03:05 +0000)
lustre/include/linux/lustre_idl.h
lustre/include/linux/lustre_sec.h
lustre/mds/mds_capa.c
lustre/mds/mds_open.c
lustre/obdclass/capa.c
lustre/obdfilter/filter_capa.c
lustre/osc/osc_request.c
lustre/ptlrpc/pack_generic.c
lustre/utils/wirecheck.c

index 052debc..2859111 100644 (file)
@@ -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_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 */
         __u64   lc_ino;       /* inode# */
         __u32   lc_mdsid;     /* mds# */
         __u32   lc_keyid;     /* key used for the capability */
index 8805fc2..f9adb4e 100644 (file)
@@ -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,
 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);
 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 dd38af6..f72fcff 100644 (file)
@@ -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,
         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) {
         if (ocapa) {
                 expired = capa_is_to_expire(ocapa);
                 if (!expired) {
index 963a74d..f19174e 100644 (file)
@@ -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_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,
                 };
 
                         .lc_mdsid = mds->mds_num,
                 };
 
index 28e882e..a28472d 100644 (file)
@@ -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,
 
 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;
 {
         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;
         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)
                 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,
 
 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);
 {
         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);
         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);
                 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;
         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 *
 }
 
 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;
 
 {
         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;
 }
         
         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);
         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);
         if (ocapa) {
                 DEBUG_CAPA(D_INFO, capa, "renew %s", capa_type_name[type]);
                 do_update_capa(ocapa, capa);
index 09208b9..33c4026 100644 (file)
@@ -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,
         }
 
         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 */
 verify:
         if (ocapa) {
                 /* fo_capa_lock protects capa too */
index 8a256d6..dbf8db5 100644 (file)
@@ -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,
          * 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);
 
         size[bufcnt++] = sizeof(*body);
         size[bufcnt++] = sizeof(*ioobj);
index 8736f7a..ba8fa3c 100644 (file)
@@ -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);
 void lustre_swab_lustre_capa(struct lustre_capa *c)
 {
         __swab32s (&c->lc_uid);
+        __swab32s (&c->lc_ruid);
         __swab32s (&c->lc_op);
         __swab32s (&c->lc_op);
+        __swab32s (&c->lc_igen);
         __swab64s (&c->lc_ino);
         __swab32s (&c->lc_mdsid);
         __swab32s (&c->lc_keyid);
         __swab64s (&c->lc_ino);
         __swab32s (&c->lc_mdsid);
         __swab32s (&c->lc_keyid);
index 65b8874..84dd991 100644 (file)
@@ -679,7 +679,9 @@ check_lustre_capa(void)
         BLANK_LINE();
         CHECK_STRUCT(lustre_capa);
         CHECK_MEMBER(lustre_capa, lc_uid);
         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_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);
         CHECK_MEMBER(lustre_capa, lc_ino);
         CHECK_MEMBER(lustre_capa, lc_mdsid);
         CHECK_MEMBER(lustre_capa, lc_keyid);