From f384a8733c41e43ebc2db3c542287a700ace8cbb Mon Sep 17 00:00:00 2001 From: Lai Siyao Date: Mon, 6 Jul 2020 21:03:59 +0800 Subject: [PATCH] LU-13437 uapi: add OBD_CONNECT2_GETATTR_PFID Add OBD_CONNECT2_GETATTR_PFID connect flag to pack parent FID in getattr request, which will be used to check whether target is remote object, if so, don't take LOOKUP lock, otherwise client may see stale directory entries. Test-parameters: trivial Signed-off-by: Lai Siyao Change-Id: Ibdf880934456f255f83cd4bac9d61ab5e1ed7330 Reviewed-on: https://review.whamcloud.com/39289 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Neil Brown Reviewed-by: Oleg Drokin --- lustre/include/uapi/linux/lustre/lustre_idl.h | 1 + lustre/obdclass/lprocfs_status.c | 2 ++ lustre/ptlrpc/wiretest.c | 2 ++ lustre/utils/wirecheck.c | 1 + lustre/utils/wiretest.c | 2 ++ 5 files changed, 8 insertions(+) diff --git a/lustre/include/uapi/linux/lustre/lustre_idl.h b/lustre/include/uapi/linux/lustre/lustre_idl.h index 1a411dd..1a55c84 100644 --- a/lustre/include/uapi/linux/lustre/lustre_idl.h +++ b/lustre/include/uapi/linux/lustre/lustre_idl.h @@ -848,6 +848,7 @@ struct ptlrpc_body_v2 { #define OBD_CONNECT2_ASYNC_DISCARD 0x4000ULL /* support async DoM data discard */ #define OBD_CONNECT2_ENCRYPT 0x8000ULL /* client-to-disk encrypt */ #define OBD_CONNECT2_FIDMAP 0x10000ULL /* FID map */ +#define OBD_CONNECT2_GETATTR_PFID 0x20000ULL /* pack parent FID in getattr */ /* XXX README XXX: * Please DO NOT add flag values here before first ensuring that this same * flag value is not in use on some other branch. Please clear any such diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 22f60c4..85ed714 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -633,6 +633,8 @@ static const char *obd_connect_names[] = { "crush", /* 0x2000 */ "async_discard", /* 0x4000 */ "client_encryption", /* 0x8000 */ + "fidmap", /* 0x10000 */ + "getattr_pfid", /* 0x20000 */ NULL }; diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index 442faf1..46a692c 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -1375,6 +1375,8 @@ void lustre_assert_wire_constants(void) OBD_CONNECT2_ENCRYPT); LASSERTF(OBD_CONNECT2_FIDMAP== 0x10000ULL, "found 0x%.16llxULL\n", OBD_CONNECT2_FIDMAP); + LASSERTF(OBD_CONNECT2_GETATTR_PFID== 0x20000ULL, "found 0x%.16llxULL\n", + OBD_CONNECT2_GETATTR_PFID); LASSERTF(OBD_CKSUM_CRC32 == 0x00000001UL, "found 0x%.8xUL\n", (unsigned)OBD_CKSUM_CRC32); LASSERTF(OBD_CKSUM_ADLER == 0x00000002UL, "found 0x%.8xUL\n", diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index dea1149..189f136 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -625,6 +625,7 @@ check_obd_connect_data(void) CHECK_DEFINE_64X(OBD_CONNECT2_ASYNC_DISCARD); CHECK_DEFINE_64X(OBD_CONNECT2_ENCRYPT); CHECK_DEFINE_64X(OBD_CONNECT2_FIDMAP); + CHECK_DEFINE_64X(OBD_CONNECT2_GETATTR_PFID); CHECK_VALUE_X(OBD_CKSUM_CRC32); CHECK_VALUE_X(OBD_CKSUM_ADLER); diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index 625cca8..d266c04 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -1401,6 +1401,8 @@ void lustre_assert_wire_constants(void) OBD_CONNECT2_ENCRYPT); LASSERTF(OBD_CONNECT2_FIDMAP== 0x10000ULL, "found 0x%.16llxULL\n", OBD_CONNECT2_FIDMAP); + LASSERTF(OBD_CONNECT2_GETATTR_PFID== 0x20000ULL, "found 0x%.16llxULL\n", + OBD_CONNECT2_GETATTR_PFID); LASSERTF(OBD_CKSUM_CRC32 == 0x00000001UL, "found 0x%.8xUL\n", (unsigned)OBD_CKSUM_CRC32); LASSERTF(OBD_CKSUM_ADLER == 0x00000002UL, "found 0x%.8xUL\n", -- 1.8.3.1