In commit
81243eacfa400f5f7b89f4c2323d0de9982bb0fb few members of
struct group_info where changed.
Change-Id: Id8e5b483cf389eff41c63942cfd78303fff67a8c
Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-on: https://review.whamcloud.com/25838
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
]) # LC_FULL_NAME_HASH_3ARGS
#
+# LC_GROUP_INFO_GID
+#
+# Kernel version 4.9 commit 81243eacfa400f5f7b89f4c2323d0de9982bb0fb
+# cred: simpler, 1D supplementary groups
+#
+AC_DEFUN([LC_GROUP_INFO_GID], [
+LB_CHECK_COMPILE([if 'struct group_info' has member 'gid'],
+group_info_gid, [
+ #include <linux/cred.h>
+],[
+ kgid_t *p;
+ p = ((struct group_info *)0)->gid;
+],[
+ AC_DEFINE(HAVE_GROUP_INFO_GID, 1,
+ [struct group_info has member gid])
+])
+]) # LC_GROUP_INFO_GID
+
+#
# LC_PROG_LINUX
#
# Lustre linux kernel checks
LC_D_COMPARE_4ARGS
LC_FULL_NAME_HASH_3ARGS
+ # 4.9
+ LC_GROUP_INFO_GID
+
#
AS_IF([test "x$enable_server" != xno], [
LC_FUNC_DEV_SET_RDONLY
#include <libcfs/libcfs.h>
+#ifdef HAVE_GROUP_INFO_GID
+
+#define CFS_GROUP_AT(gi, i) ((gi)->gid[(i)])
+
+#else /* !HAVE_GROUP_INFO_GID */
+
#define CFS_NGROUPS_PER_BLOCK ((int)(PAGE_SIZE / sizeof(gid_t)))
#define CFS_GROUP_AT(gi, i) \
((gi)->blocks[(i) / CFS_NGROUPS_PER_BLOCK][(i) % CFS_NGROUPS_PER_BLOCK])
+#endif /* HAVE_GROUP_INFO_GID */
struct lu_ucred;
void lustre_groups_from_list(struct group_info *ginfo, gid_t *glist)
{
+#ifdef HAVE_GROUP_INFO_GID
+ memcpy(ginfo->gid, glist, ginfo->ngroups * sizeof(__u32));
+#else
int i;
int count = ginfo->ngroups;
memcpy(ginfo->blocks[i], glist + off, len);
count -= cp_count;
}
+#endif
}
EXPORT_SYMBOL(lustre_groups_from_list);
task_lock(current);
if (pud->pud_ngroups > current_ngroups)
pud->pud_ngroups = current_ngroups;
+#ifdef HAVE_GROUP_INFO_GID
+ memcpy(pud->pud_groups, current_cred()->group_info->gid,
+ pud->pud_ngroups * sizeof(__u32));
+#else /* !HAVE_GROUP_INFO_GID */
memcpy(pud->pud_groups, current_cred()->group_info->blocks[0],
pud->pud_ngroups * sizeof(__u32));
+#endif /* HAVE_GROUP_INFO_GID */
task_unlock(current);
return 0;