Whamcloud - gitweb
Branch b1_6
authorbwzhou <bwzhou>
Mon, 5 Nov 2007 16:01:07 +0000 (16:01 +0000)
committerbwzhou <bwzhou>
Mon, 5 Nov 2007 16:01:07 +0000 (16:01 +0000)
b=13317
r=shadow, johann

enable liblustre to connect to mds with acl

lustre/autoconf/lustre-core.m4
lustre/include/liblustre.h
lustre/include/lustre_mds.h
lustre/liblustre/llite_lib.c
lustre/liblustre/super.c
lustre/utils/wirecheck.c
lustre/utils/wiretest.c

index e65ad06..c0651fa 100644 (file)
@@ -1269,6 +1269,19 @@ if test x$enable_liblustre != xyes ; then
 fi
 AC_MSG_RESULT([$enable_liblustre_tests])
 
+AC_MSG_CHECKING([whether to enable liblustre acl])
+AC_ARG_ENABLE([liblustre-acl],
+       AC_HELP_STRING([--disable-liblustre-acl],
+                       [disable ACL support for liblustre]),
+       [],[enable_liblustre_acl=yes])
+if test x$enable_liblustre != xyes ; then
+   enable_liblustre_acl='no'
+fi
+AC_MSG_RESULT([$enable_liblustre_acl])
+if test x$enable_liblustre_acl != xno ; then
+  AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
+fi
+
 AC_MSG_CHECKING([whether to build mpitests])
 AC_ARG_ENABLE([mpitests],
        AC_HELP_STRING([--enable-mpitests],
index abf8d3a..82436dd 100644 (file)
@@ -903,6 +903,15 @@ void posix_acl_release(struct posix_acl *acl)
 {
 }
 
+#ifdef LIBLUSTRE_POSIX_ACL
+ #define posix_acl_xattr_entry xattr_acl_entry
+ #define posix_acl_xattr_header xattr_acl_header
+ #define posix_acl_xattr_size(entry) xattr_acl_size(entry)
+ #ifndef CONFIG_FS_POSIX_ACL
+  #define CONFIG_FS_POSIX_ACL 1
+ #endif
+#endif
+
 #ifndef ENOTSUPP
 #define ENOTSUPP ENOTSUP
 #endif
index 4a79122..c2ace3e 100644 (file)
@@ -101,14 +101,8 @@ struct mds_file_data {
 # endif /* HAVE_XATTR_ACL */
 
 # define LUSTRE_POSIX_ACL_MAX_ENTRIES   (32)
-
-# ifdef __KERNEL__
 #  define LUSTRE_POSIX_ACL_MAX_SIZE      \
                 (mds_xattr_acl_size(LUSTRE_POSIX_ACL_MAX_ENTRIES))
-# else /* __KERNEL__ */
-#  define LUSTRE_POSIX_ACL_MAX_SIZE    0
-# endif /* __KERNEL__ */
-
 #else /* CONFIG_FS_POSIX_ACL */
 # define LUSTRE_POSIX_ACL_MAX_SIZE      0
 #endif /* CONFIG_FS_POSIX_ACL */
index a4b3e42..09d17c3 100644 (file)
@@ -157,6 +157,9 @@ int liblustre_process_log(struct config_llog_instance *cfg,
                 GOTO(out_cleanup, rc = -ENOMEM);
 
         ocd->ocd_connect_flags = OBD_CONNECT_VERSION | OBD_CONNECT_AT;
+#ifdef LIBLUSTRE_POSIX_ACL
+        ocd->ocd_connect_flags |= OBD_CONNECT_ACL;
+#endif
         ocd->ocd_version = LUSTRE_VERSION_CODE;
 
         rc = obd_connect(&mgc_conn, obd, &mgc_uuid, ocd, NULL);
index 6abda5e..784101a 100644 (file)
@@ -1937,6 +1937,9 @@ llu_fsswop_mount(const char *source,
 
         ocd.ocd_connect_flags = OBD_CONNECT_IBITS | OBD_CONNECT_VERSION |
                 OBD_CONNECT_AT;
+#ifdef LIBLUSTRE_POSIX_ACL
+        ocd.ocd_connect_flags |= OBD_CONNECT_ACL;
+#endif
         ocd.ocd_ibits_known = MDS_INODELOCK_FULL;
         ocd.ocd_version = LUSTRE_VERSION_CODE;
 
@@ -1991,7 +1994,8 @@ llu_fsswop_mount(const char *source,
 
         /* fetch attr of root inode */
         err = mdc_getattr(sbi->ll_mdc_exp, &rootfid,
-                          OBD_MD_FLGETATTR | OBD_MD_FLBLOCKS, 0, &request);
+                          OBD_MD_FLGETATTR | OBD_MD_FLBLOCKS, 0, 
+                          &request);
         if (err) {
                 CERROR("mdc_getattr failed for root: rc = %d\n", err);
                 GOTO(out_osc, err);
index 560ec81..e3e677f 100644 (file)
@@ -54,23 +54,44 @@ do {                                                            \
         CHECK_VALUE((int)offsetof(struct s, m));                \
 } while(0)
 
+#define CHECK_MEMBER_OFFSET_TYPEDEF(s,m)                        \
+do {                                                            \
+        CHECK_VALUE((int)offsetof(s, m));                       \
+} while(0)
+
 #define CHECK_MEMBER_SIZEOF(s,m)                                \
 do {                                                            \
         CHECK_VALUE((int)sizeof(((struct s *)0)->m));           \
 } while(0)
 
+#define CHECK_MEMBER_SIZEOF_TYPEDEF(s,m)                        \
+do {                                                            \
+        CHECK_VALUE((int)sizeof(((s *)0)->m));                  \
+} while(0)
+
 #define CHECK_MEMBER(s,m)                                       \
 do {                                                            \
         CHECK_MEMBER_OFFSET(s, m);                              \
         CHECK_MEMBER_SIZEOF(s, m);                              \
 } while(0)
 
+#define CHECK_MEMBER_TYPEDEF(s,m)                               \
+do {                                                            \
+        CHECK_MEMBER_OFFSET_TYPEDEF(s, m);                      \
+        CHECK_MEMBER_SIZEOF_TYPEDEF(s, m);                      \
+} while(0)
+
 #define CHECK_STRUCT(s)                                         \
 do {                                                            \
         COMMENT("Checks for struct "#s);                        \
                 CHECK_VALUE((int)sizeof(struct s));             \
 } while(0)
 
+#define CHECK_STRUCT_TYPEDEF(s)                                 \
+do {                                                            \
+        COMMENT("Checks for type "#s);                          \
+                CHECK_VALUE((int)sizeof(s));                    \
+} while(0)
 
 static void
 check_lustre_handle(void)
@@ -1005,6 +1026,25 @@ check_lustre_disk_data(void)
 }
 
 static void
+check_posix_acl_xattr_entry(void)
+{
+        BLANK_LINE();
+        CHECK_STRUCT_TYPEDEF(posix_acl_xattr_entry);
+        CHECK_MEMBER_TYPEDEF(posix_acl_xattr_entry, e_tag);
+        CHECK_MEMBER_TYPEDEF(posix_acl_xattr_entry, e_perm);
+        CHECK_MEMBER_TYPEDEF(posix_acl_xattr_entry, e_id);
+}
+
+static void
+check_posix_acl_xattr_header(void)
+{
+        BLANK_LINE();
+        CHECK_STRUCT_TYPEDEF(posix_acl_xattr_header);
+        CHECK_MEMBER_TYPEDEF(posix_acl_xattr_header, a_version);
+        CHECK_MEMBER_TYPEDEF(posix_acl_xattr_header, a_entries);
+}
+
+static void
 system_string (char *cmdline, char *str, int len)
 {
         int   fds[2];
@@ -1253,6 +1293,8 @@ main(int argc, char **argv)
         check_qunit_data_old();
         check_mgs_target_info();
         check_lustre_disk_data();
+        check_posix_acl_xattr_entry();
+        check_posix_acl_xattr_header();
 
 
         printf("}\n\n");
index 4590602..c0824d1 100644 (file)
@@ -2140,4 +2140,33 @@ void lustre_assert_wire_constants(void)
                  (long long)(int)offsetof(struct lustre_disk_data, ldd_params));
         LASSERTF((int)sizeof(((struct lustre_disk_data *)0)->ldd_params) == 4096, " found %lld\n",
                  (long long)(int)sizeof(((struct lustre_disk_data *)0)->ldd_params));
+
+        /* Checks for type posix_acl_xattr_entry */
+        LASSERTF((int)sizeof(xattr_acl_entry) == 8, " found %lld\n",
+                 (long long)(int)sizeof(xattr_acl_entry));
+        LASSERTF((int)offsetof(xattr_acl_entry, e_tag) == 0, " found %lld\n",
+                 (long long)(int)offsetof(xattr_acl_entry, e_tag));
+        LASSERTF((int)sizeof(((xattr_acl_entry *)0)->e_tag) == 2, " found %lld\n",
+                 (long long)(int)sizeof(((xattr_acl_entry *)0)->e_tag));
+        LASSERTF((int)offsetof(xattr_acl_entry, e_perm) == 2, " found %lld\n",
+                 (long long)(int)offsetof(xattr_acl_entry, e_perm));
+        LASSERTF((int)sizeof(((xattr_acl_entry *)0)->e_perm) == 2, " found %lld\n",
+                 (long long)(int)sizeof(((xattr_acl_entry *)0)->e_perm));
+        LASSERTF((int)offsetof(xattr_acl_entry, e_id) == 4, " found %lld\n",
+                 (long long)(int)offsetof(xattr_acl_entry, e_id));
+        LASSERTF((int)sizeof(((xattr_acl_entry *)0)->e_id) == 4, " found %lld\n",
+                 (long long)(int)sizeof(((xattr_acl_entry *)0)->e_id));
+
+        /* Checks for type posix_acl_xattr_header */
+        LASSERTF((int)sizeof(xattr_acl_header) == 4, " found %lld\n",
+                 (long long)(int)sizeof(xattr_acl_header));
+        LASSERTF((int)offsetof(xattr_acl_header, a_version) == 0, " found %lld\n",
+                 (long long)(int)offsetof(xattr_acl_header, a_version));
+        LASSERTF((int)sizeof(((xattr_acl_header *)0)->a_version) == 4, " found %lld\n",
+                 (long long)(int)sizeof(((xattr_acl_header *)0)->a_version));
+        LASSERTF((int)offsetof(xattr_acl_header, a_entries) == 4, " found %lld\n",
+                 (long long)(int)offsetof(xattr_acl_header, a_entries));
+        LASSERTF((int)sizeof(((xattr_acl_header *)0)->a_entries) == 0, " found %lld\n",
+                 (long long)(int)sizeof(((xattr_acl_header *)0)->a_entries));
+
 }