From 831972ed6f8db022dc03f2a26e3c783e355fe635 Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Mon, 14 Jun 2010 18:47:26 -0500 Subject: [PATCH] b=22966 UID and GID "high" fields missing in a few structs Several structs (mdt_body, mdt_remote_perm, obdo) needed uid_h/gid_h fields for handling of SIDs (via FUIDs). i=andreas.dilger@oracle.com i=yong.fan@sun.com i=johann@sun.com --- lustre/include/lustre/lustre_idl.h | 10 +++++++--- lustre/ptlrpc/pack_generic.c | 13 +++++++++++-- lustre/ptlrpc/wiretest.c | 12 ++++++++---- lustre/utils/wirecheck.c | 3 ++- lustre/utils/wiretest.c | 12 ++++++++---- 5 files changed, 36 insertions(+), 14 deletions(-) diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index 10b2997..02ace2f 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -1604,8 +1604,9 @@ struct mdt_body { __u32 aclsize; __u32 max_mdsize; __u32 max_cookiesize; - __u32 padding_4; /* also fix lustre_swab_mdt_body */ - __u64 padding_5; + __u32 uid_h; /* high 32-bits of uid, for FUID */ + __u32 gid_h; /* high 32-bits of gid, for FUID */ + __u32 padding_5; /* also fix lustre_swab_mdt_body */ __u64 padding_6; __u64 padding_7; __u64 padding_8; @@ -1717,7 +1718,9 @@ struct mdt_remote_perm { __u32 rp_uid; __u32 rp_gid; __u32 rp_fsuid; + __u32 rp_fsuid_h; __u32 rp_fsgid; + __u32 rp_fsgid_h; __u32 rp_access_perm; /* MAY_READ/WRITE/EXEC */ }; @@ -2591,7 +2594,8 @@ struct obdo { struct lustre_handle o_handle; /* brw: lock handle to prolong locks */ struct llog_cookie o_lcookie; /* destroy: unlink cookie from MDS */ - __u64 o_padding_2; + __u32 o_uid_h; + __u32 o_gid_h; __u64 o_padding_3; __u64 o_padding_4; __u64 o_padding_5; diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index ee9400d..519434b 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -1599,7 +1599,8 @@ void lustre_swab_obdo (struct obdo *o) __swab32s (&o->o_parent_ver); /* o_handle is opaque */ /* o_lcookie is swabbed elsewhere */ - CLASSERT(offsetof(typeof(*o), o_padding_2) != 0); + __swab32s (&o->o_uid_h); + __swab32s (&o->o_gid_h); CLASSERT(offsetof(typeof(*o), o_padding_3) != 0); CLASSERT(offsetof(typeof(*o), o_padding_4) != 0); CLASSERT(offsetof(typeof(*o), o_padding_5) != 0); @@ -1735,7 +1736,9 @@ void lustre_swab_mdt_body (struct mdt_body *b) __swab32s (&b->aclsize); __swab32s (&b->max_mdsize); __swab32s (&b->max_cookiesize); - CLASSERT(offsetof(typeof(*b), padding_4) != 0); + __swab32s (&b->uid_h); + __swab32s (&b->gid_h); + CLASSERT(offsetof(typeof(*b), padding_5) != 0); } void lustre_swab_mdt_ioepoch (struct mdt_ioepoch *b) @@ -1814,7 +1817,9 @@ void lustre_swab_mdt_remote_perm (struct mdt_remote_perm *p) __swab32s (&p->rp_uid); __swab32s (&p->rp_gid); __swab32s (&p->rp_fsuid); + __swab32s (&p->rp_fsuid_h); __swab32s (&p->rp_fsgid); + __swab32s (&p->rp_fsgid_h); __swab32s (&p->rp_access_perm); }; @@ -2105,8 +2110,12 @@ void dump_obdo(struct obdo *oa) (valid & OBD_MD_FLMODE ? ~S_IFMT : 0))); if (valid & OBD_MD_FLUID) CDEBUG(D_RPCTRACE, "obdo: o_uid = %u\n", oa->o_uid); + if (valid & OBD_MD_FLUID) + CDEBUG(D_RPCTRACE, "obdo: o_uid_h = %u\n", oa->o_uid_h); if (valid & OBD_MD_FLGID) CDEBUG(D_RPCTRACE, "obdo: o_gid = %u\n", oa->o_gid); + if (valid & OBD_MD_FLGID) + CDEBUG(D_RPCTRACE, "obdo: o_gid_h = %u\n", oa->o_gid_h); if (valid & OBD_MD_FLFLAGS) CDEBUG(D_RPCTRACE, "obdo: o_flags = %x\n", oa->o_flags); if (valid & OBD_MD_FLNLINK) diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index d084ffb..9898ae9 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -589,10 +589,14 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct obdo, o_lcookie)); LASSERTF((int)sizeof(((struct obdo *)0)->o_lcookie) == 32, " found %lld\n", (long long)(int)sizeof(((struct obdo *)0)->o_lcookie)); - LASSERTF((int)offsetof(struct obdo, o_padding_2) == 168, " found %lld\n", - (long long)(int)offsetof(struct obdo, o_padding_2)); - LASSERTF((int)sizeof(((struct obdo *)0)->o_padding_2) == 8, " found %lld\n", - (long long)(int)sizeof(((struct obdo *)0)->o_padding_2)); + LASSERTF((int)offsetof(struct obdo, o_uid_h) == 168, " found %lld\n", + (long long)(int)offsetof(struct obdo, o_uid_h)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_uid_h) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_uid_h)); + LASSERTF((int)offsetof(struct obdo, o_gid_h) == 172, " found %lld\n", + (long long)(int)offsetof(struct obdo, o_gid_h)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_gid_h) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_gid_h)); LASSERTF((int)offsetof(struct obdo, o_padding_3) == 176, " found %lld\n", (long long)(int)offsetof(struct obdo, o_padding_3)); LASSERTF((int)sizeof(((struct obdo *)0)->o_padding_3) == 8, " found %lld\n", diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index 7a1a333..09da35d 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -252,7 +252,8 @@ check_obdo(void) CHECK_MEMBER(obdo, o_parent_ver); CHECK_MEMBER(obdo, o_handle); CHECK_MEMBER(obdo, o_lcookie); - CHECK_MEMBER(obdo, o_padding_2); + CHECK_MEMBER(obdo, o_uid_h); + CHECK_MEMBER(obdo, o_gid_h); CHECK_MEMBER(obdo, o_padding_3); CHECK_MEMBER(obdo, o_padding_4); CHECK_MEMBER(obdo, o_padding_5); diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index c553509..2a4a52a 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -586,10 +586,14 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct obdo, o_lcookie)); LASSERTF((int)sizeof(((struct obdo *)0)->o_lcookie) == 32, " found %lld\n", (long long)(int)sizeof(((struct obdo *)0)->o_lcookie)); - LASSERTF((int)offsetof(struct obdo, o_padding_2) == 168, " found %lld\n", - (long long)(int)offsetof(struct obdo, o_padding_2)); - LASSERTF((int)sizeof(((struct obdo *)0)->o_padding_2) == 8, " found %lld\n", - (long long)(int)sizeof(((struct obdo *)0)->o_padding_2)); + LASSERTF((int)offsetof(struct obdo, o_uid_h) == 168, " found %lld\n", + (long long)(int)offsetof(struct obdo, o_uid_h)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_uid_h) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_uid_h)); + LASSERTF((int)offsetof(struct obdo, o_gid_h) == 172, " found %lld\n", + (long long)(int)offsetof(struct obdo, o_gid_h)); + LASSERTF((int)sizeof(((struct obdo *)0)->o_gid_h) == 4, " found %lld\n", + (long long)(int)sizeof(((struct obdo *)0)->o_gid_h)); LASSERTF((int)offsetof(struct obdo, o_padding_3) == 176, " found %lld\n", (long long)(int)offsetof(struct obdo, o_padding_3)); LASSERTF((int)sizeof(((struct obdo *)0)->o_padding_3) == 8, " found %lld\n", -- 1.8.3.1