From 3314727b4d2cb98d4930c0499f75231a95bf4b06 Mon Sep 17 00:00:00 2001 From: Lai Siyao Date: Mon, 6 Jul 2020 21:52:45 +0800 Subject: [PATCH] LU-13437 llite: pack parent FID in getattr Pack parent FID in getattr request if OBD_CONNECT2_GETATTR_PFID is enabled, otherwise fill it with target FID for backward compatibility. Lustre-change: https://review.whamcloud.com/39290 Lustre-commit: 5f2c44bf626b178503c1c4d2d85c40bae087ff4f Fixes: f9a2da63 ("LU-13437 mdt: don't fetch LOOKUP lock for remot...") Signed-off-by: Lai Siyao Reviewed-by: Neil Brown Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Change-Id: I91bace23e67b548feb92fd885fb5e64e92c96408 Reviewed-on: https://review.whamcloud.com/39771 Tested-by: jenkins Tested-by: Maloo --- lustre/include/uapi/linux/lustre/lustre_idl.h | 3 ++- lustre/llite/file.c | 10 ++++++++-- lustre/llite/llite_lib.c | 3 ++- lustre/lmv/lmv_intent.c | 5 ++++- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/lustre/include/uapi/linux/lustre/lustre_idl.h b/lustre/include/uapi/linux/lustre/lustre_idl.h index 2e79565..26fa74b 100644 --- a/lustre/include/uapi/linux/lustre/lustre_idl.h +++ b/lustre/include/uapi/linux/lustre/lustre_idl.h @@ -893,7 +893,8 @@ struct ptlrpc_body_v2 { OBD_CONNECT2_ARCHIVE_ID_ARRAY | \ OBD_CONNECT2_SELINUX_POLICY | \ OBD_CONNECT2_LSOM | \ - OBD_CONNECT2_ASYNC_DISCARD) + OBD_CONNECT2_ASYNC_DISCARD | \ + OBD_CONNECT2_GETATTR_PFID) #define OST_CONNECT_SUPPORTED (OBD_CONNECT_SRVLOCK | OBD_CONNECT_GRANT | \ OBD_CONNECT_REQPORTAL | OBD_CONNECT_VERSION | \ diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 250d93e..b7f9546 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -4346,6 +4346,7 @@ static int ll_inode_revalidate_fini(struct inode *inode, int rc) static int ll_inode_revalidate(struct dentry *dentry, enum ldlm_intent_flags op) { + struct inode *parent; struct inode *inode = dentry->d_inode; struct obd_export *exp = ll_i2mdexp(inode); struct lookup_intent oit = { @@ -4359,9 +4360,14 @@ static int ll_inode_revalidate(struct dentry *dentry, enum ldlm_intent_flags op) CDEBUG(D_VFSTRACE, "VFS Op:inode="DFID"(%p),name=%s\n", PFID(ll_inode2fid(inode)), inode, dentry->d_name.name); + if (exp_connect_flags2(exp) & OBD_CONNECT2_GETATTR_PFID) + parent = dentry->d_parent->d_inode; + else + parent = inode; + /* Call getattr by fid, so do not provide name at all. */ - op_data = ll_prep_md_op_data(NULL, dentry->d_parent->d_inode, inode, - NULL, 0, 0, LUSTRE_OPC_ANY, NULL); + op_data = ll_prep_md_op_data(NULL, parent, inode, NULL, 0, 0, + LUSTRE_OPC_ANY, NULL); if (IS_ERR(op_data)) RETURN(PTR_ERR(op_data)); diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index ee6e001..d200d2a 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -228,7 +228,8 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, OBD_CONNECT2_SUM_STATFS | OBD_CONNECT2_ARCHIVE_ID_ARRAY | OBD_CONNECT2_LSOM | - OBD_CONNECT2_ASYNC_DISCARD; + OBD_CONNECT2_ASYNC_DISCARD | + OBD_CONNECT2_GETATTR_PFID; #ifdef HAVE_LRU_RESIZE_SUPPORT if (sbi->ll_flags & LL_SBI_LRU_RESIZE) diff --git a/lustre/lmv/lmv_intent.c b/lustre/lmv/lmv_intent.c index f7ec215..ef780b4 100644 --- a/lustre/lmv/lmv_intent.c +++ b/lustre/lmv/lmv_intent.c @@ -188,7 +188,10 @@ int lmv_revalidate_slaves(struct obd_export *exp, * which is not needed here. */ memset(op_data, 0, sizeof(*op_data)); - op_data->op_fid1 = *pfid; + if (exp_connect_flags2(exp) & OBD_CONNECT2_GETATTR_PFID) + op_data->op_fid1 = *pfid; + else + op_data->op_fid1 = fid; op_data->op_fid2 = fid; tgt = lmv_get_target(lmv, lsm->lsm_md_oinfo[i].lmo_mds, NULL); -- 1.8.3.1