Whamcloud - gitweb
EX-5358 pcc: remove realpath() from lfs_pcc_state()
authorQian Yingjin <qian@ddn.com>
Wed, 15 Jun 2022 07:59:52 +0000 (03:59 -0400)
committerAndreas Dilger <adilger@whamcloud.com>
Thu, 7 Jul 2022 18:12:57 +0000 (18:12 +0000)
commit95d256846f9b97244297cf71d7f200cba79301ff
tree6f0c95f4d35ee2dda360e41bb3be3d710dbcb795
parent0c34fb4a24d867fcb1cb337b42bc8efdbca08629
EX-5358 pcc: remove realpath() from lfs_pcc_state()

Before Ubuntu 20.04, realpath() executes lstat() for each
component of the path. If the file is still valid cached on PCC
device with the layout generation unchanged, the Lustre file will
be auto re-attach during the stat() call in the Lustre kernel.
This may result in misunderstanding for the operation "lfs pcc
state" on a file that has already detached but still valid cached
on PCC according to the unchanged layout generation.

This problem exposes on the newer Ubuntu 22.04 in which realpath()
executes readlink() for each component of the path instead of
lstat():
readlink("/mnt", 0x7fffd5760800, 1023)  = -1
readlink("/mnt/lustre", 0x7fffd5760800, 1023) = -1
readlink("/mnt/lustre/sanity-pcc.f15", 0x7fffd5760800, 1023) = -1

In this patch, it remove realpath() from lfs_pcc_state() to avoid
this misunderstanding behavior for the command: $LFS pcc state.
And it also fixes the test scripts sanity-pcc: test_15, test_16,
test_27, test_39.

Change-Id: I50ae46a1e952a3faaf0d7a7293579e239156d6d3
Test-Parameters: clientdistro=el8.5 env=SANITY_PCC_EXCEPT="101a" testlist=sanity-pcc
Test-Parameters: clientdistro=ubuntu2204 env=SANITY_PCC_EXCEPT="101a 39" testlist=sanity-pcc
Test-Parameters: clientdistro=ubuntu2004 env=SANITY_PCC_EXCEPT="101a" testlist=sanity-pcc
Signed-off-by: Qian Yingjin <qian@ddn.com>
Reviewed-on: https://review.whamcloud.com/47632
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/tests/sanity-pcc.sh
lustre/utils/lfs.c