From: Oleg Drokin Date: Thu, 3 Jun 2021 00:10:47 +0000 (-0400) Subject: LU-10948 mdt: New connect flag for non-open-by-fid lock request X-Git-Tag: 2.14.53~92 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=72c9a6e5fb6e11fca1b1438ac18f58ff7849ed7d LU-10948 mdt: New connect flag for non-open-by-fid lock request While we removed the 2.1 check for open by fid when open lock is requested, when you talk to old servers that don't have that patch - they get an open error, so introduce a compat flag. Change-Id: I94d50ad98a2828519853a35fa90c5063adf2feab Fixes: 41d99c4902 ("LU-10948 llite: Introduce inode open heat counter") Signed-off-by: Oleg Drokin Reviewed-on: https://review.whamcloud.com/43907 Reviewed-by: Andreas Dilger Tested-by: jenkins Tested-by: Maloo Reviewed-by: James Nunez --- diff --git a/lustre/include/uapi/linux/lustre/lustre_idl.h b/lustre/include/uapi/linux/lustre/lustre_idl.h index de854ee..19d2fe3 100644 --- a/lustre/include/uapi/linux/lustre/lustre_idl.h +++ b/lustre/include/uapi/linux/lustre/lustre_idl.h @@ -851,6 +851,7 @@ struct ptlrpc_body_v2 { #define OBD_CONNECT2_LSEEK 0x40000ULL /* SEEK_HOLE/DATA RPC */ #define OBD_CONNECT2_DOM_LVB 0x80000ULL /* pack DOM glimpse data in LVB */ #define OBD_CONNECT2_REP_MBITS 0x100000ULL /* match reply by mbits, not xid */ +#define OBD_CONNECT2_ATOMIC_OPEN_LOCK 0x4000000ULL/* request lock on 1st open */ /* 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 @@ -911,7 +912,8 @@ struct ptlrpc_body_v2 { OBD_CONNECT2_ENCRYPT | \ OBD_CONNECT2_GETATTR_PFID |\ OBD_CONNECT2_LSEEK | OBD_CONNECT2_DOM_LVB |\ - OBD_CONNECT2_REP_MBITS) + OBD_CONNECT2_REP_MBITS | \ + OBD_CONNECT2_ATOMIC_OPEN_LOCK) #define OST_CONNECT_SUPPORTED (OBD_CONNECT_SRVLOCK | OBD_CONNECT_GRANT | \ OBD_CONNECT_REQPORTAL | OBD_CONNECT_VERSION | \ diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 819c072..4217af2 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -336,7 +336,8 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt) OBD_CONNECT2_CRUSH | OBD_CONNECT2_LSEEK | OBD_CONNECT2_GETATTR_PFID | OBD_CONNECT2_DOM_LVB | - OBD_CONNECT2_REP_MBITS; + OBD_CONNECT2_REP_MBITS | + OBD_CONNECT2_ATOMIC_OPEN_LOCK; #ifdef HAVE_LRU_RESIZE_SUPPORT if (sbi->ll_flags & LL_SBI_LRU_RESIZE) diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index 3409c16..cbe3aa6 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -1156,7 +1156,9 @@ static int ll_atomic_open(struct inode *dir, struct dentry *dentry, * we only need to request open lock if it was requested * for every open */ - if (ll_i2sbi(dir)->ll_oc_thrsh_count == 1) + if (ll_i2sbi(dir)->ll_oc_thrsh_count == 1 && + exp_connect_flags2(ll_i2mdexp(dir)) & + OBD_CONNECT2_ATOMIC_OPEN_LOCK) it->it_flags |= MDS_OPEN_LOCK; /* Dentry added to dcache tree in ll_lookup_it */ diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index ac0d0aa..7f7446d 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -642,6 +642,12 @@ static const char *const obd_connect_names[] = { "lseek", /* 0x40000 */ "dom_lvb", /* 0x80000 */ "reply_mbits", /* 0x100000 */ + "mode_convert", /* 0x200000 */ + "batch_rpc", /* 0x400000 */ + "pcc_ro", /* 0x800000 */ + "mne_nid_type", /* 0x1000000 */ + "lock_contend", /* 0x2000000 */ + "atomic_open_lock", /* 0x4000000 */ NULL }; diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index a3fb406..a843b29 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -1384,6 +1384,8 @@ void lustre_assert_wire_constants(void) OBD_CONNECT2_DOM_LVB); LASSERTF(OBD_CONNECT2_REP_MBITS == 0x100000ULL, "found 0x%.16llxULL\n", OBD_CONNECT2_REP_MBITS); + LASSERTF(OBD_CONNECT2_ATOMIC_OPEN_LOCK == 0x4000000ULL, "found 0x%.16llxULL\n", + OBD_CONNECT2_ATOMIC_OPEN_LOCK); 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 a7f5c66..1472488 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -628,6 +628,7 @@ check_obd_connect_data(void) CHECK_DEFINE_64X(OBD_CONNECT2_LSEEK); CHECK_DEFINE_64X(OBD_CONNECT2_DOM_LVB); CHECK_DEFINE_64X(OBD_CONNECT2_REP_MBITS); + CHECK_DEFINE_64X(OBD_CONNECT2_ATOMIC_OPEN_LOCK); 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 9f2b869..ff6515d 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -1406,6 +1406,8 @@ void lustre_assert_wire_constants(void) OBD_CONNECT2_DOM_LVB); LASSERTF(OBD_CONNECT2_REP_MBITS == 0x100000ULL, "found 0x%.16llxULL\n", OBD_CONNECT2_REP_MBITS); + LASSERTF(OBD_CONNECT2_ATOMIC_OPEN_LOCK == 0x4000000ULL, "found 0x%.16llxULL\n", + OBD_CONNECT2_ATOMIC_OPEN_LOCK); LASSERTF(OBD_CKSUM_CRC32 == 0x00000001UL, "found 0x%.8xUL\n", (unsigned)OBD_CKSUM_CRC32); LASSERTF(OBD_CKSUM_ADLER == 0x00000002UL, "found 0x%.8xUL\n",