Whamcloud - gitweb
LU-9468 llite: fix for stat under kthread and X86_X32 92/26992/14
authorFrank Zago <fzago@cray.com>
Fri, 5 May 2017 21:10:47 +0000 (17:10 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 13 Jun 2017 16:55:16 +0000 (16:55 +0000)
commit86d26552f91e4b8cfe79a55cae8746aa1c18001e
treefee630ca52bc1bbd44a022ce6b82eafe9a1351be
parentd054c3d4c173a41ca7c74ebe361d6de2e7aa507a
LU-9468 llite: fix for stat under kthread and X86_X32

Under the following conditions, ll_getattr will flatten the inode
number when it shouldn't:

  - the X86_X32 architecture is defined CONFIG_X86_X32, and not even
    used,
  - ll_getattr is called from a kernel thread (though vfs_getattr for
    instance.)

This has the result that inode numbers are different whether the same
file is stat'ed from a kernel thread, or from a syscall. For instance,
4198401 vs. 144115205272502273.

ll_getattr calls ll_need_32bit_api to determine whether the task is 32
bits. When the combination is kthread+X86_X32, that function returns
that the task is 32 bits, which is incorrect, as the kernel is 64
bits.

The solution is to check whether the call is from a kernel thread
(which is 64 bits) and act consequently.

Added test_410 to test the condition. A failed run will have a message like this:

  lustre_kinode_54354: CONFIG_X86_X32 is set
  lustre_kinode_54354: inode is 144115205272502273
  lustre_kinode_54354: inode is 4198401
  lustre_kinode_54354: inode numbers are different: 144115205272502273 4198401

while a successfull one will be:

  lustre_kinode_10519: CONFIG_X86_X32 is set
  lustre_kinode_10519: inode is 144115205272502275
  lustre_kinode_10519: inode is 144115205272502275
  lustre_kinode_10519: inode numbers are identical: 144115205272502275

Signed-off-by: Frank Zago <fzago@cray.com>
Change-Id: Ib8f07de47eaa29046a61c488368d466f9096a994
Reviewed-on: https://review.whamcloud.com/26992
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
lustre.spec.in
lustre/Makefile.in
lustre/autoMakefile.am
lustre/autoconf/lustre-core.m4
lustre/llite/llite_internal.h
lustre/tests/kernel/Makefile.in [new file with mode: 0644]
lustre/tests/kernel/autoMakefile.am [new file with mode: 0644]
lustre/tests/kernel/kinode.c [new file with mode: 0644]
lustre/tests/sanity.sh