Whamcloud - gitweb
LU-13437 llite: pack parent FID in getattr 90/39290/5
authorLai Siyao <lai.siyao@whamcloud.com>
Mon, 6 Jul 2020 13:52:45 +0000 (21:52 +0800)
committerOleg Drokin <green@whamcloud.com>
Fri, 7 Aug 2020 04:59:02 +0000 (04:59 +0000)
Pack parent FID in getattr request if OBD_CONNECT2_GETATTR_PFID is
enabled, otherwise fill it with target FID for backward compatibility.

Fixes: f9a2da63 ("LU-13437 mdt: don't fetch LOOKUP lock for remot...")
Test-Parameters: clientversion=2.12 testlist=sanity env=SANITY_EXCEPT="27M 151 156"
Test-Parameters: serverversion=2.12 testlist=sanity env=SANITY_EXCEPT="56 165 205b"
Signed-off-by: Lai Siyao <lai.siyao@whamcloud.com>
Change-Id: Idcf8388b65dee1f0a09a53b240ce8303f3c6ff75
Reviewed-on: https://review.whamcloud.com/39290
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/uapi/linux/lustre/lustre_idl.h
lustre/llite/file.c
lustre/llite/llite_lib.c
lustre/lmv/lmv_intent.c

index 1a55c84..cf9b359 100644 (file)
@@ -906,7 +906,8 @@ struct ptlrpc_body_v2 {
                                OBD_CONNECT2_ASYNC_DISCARD | \
                                OBD_CONNECT2_PCC | \
                                OBD_CONNECT2_CRUSH | \
                                OBD_CONNECT2_ASYNC_DISCARD | \
                                OBD_CONNECT2_PCC | \
                                OBD_CONNECT2_CRUSH | \
-                               OBD_CONNECT2_ENCRYPT)
+                               OBD_CONNECT2_ENCRYPT | \
+                               OBD_CONNECT2_GETATTR_PFID)
 
 #define OST_CONNECT_SUPPORTED  (OBD_CONNECT_SRVLOCK | OBD_CONNECT_GRANT | \
                                OBD_CONNECT_REQPORTAL | OBD_CONNECT_VERSION | \
 
 #define OST_CONNECT_SUPPORTED  (OBD_CONNECT_SRVLOCK | OBD_CONNECT_GRANT | \
                                OBD_CONNECT_REQPORTAL | OBD_CONNECT_VERSION | \
index f411a71..d158d1a 100644 (file)
@@ -4695,6 +4695,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)
 {
 
 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 = {
        struct inode *inode = dentry->d_inode;
        struct obd_export *exp = ll_i2mdexp(inode);
        struct lookup_intent oit = {
@@ -4708,9 +4709,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);
 
        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. */
        /* 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));
 
        if (IS_ERR(op_data))
                RETURN(PTR_ERR(op_data));
 
index 45b2128..4c647df 100644 (file)
@@ -276,7 +276,8 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt)
                                   OBD_CONNECT2_LSOM |
                                   OBD_CONNECT2_ASYNC_DISCARD |
                                   OBD_CONNECT2_PCC |
                                   OBD_CONNECT2_LSOM |
                                   OBD_CONNECT2_ASYNC_DISCARD |
                                   OBD_CONNECT2_PCC |
-                                  OBD_CONNECT2_CRUSH;
+                                  OBD_CONNECT2_CRUSH |
+                                  OBD_CONNECT2_GETATTR_PFID;
 
 #ifdef HAVE_LRU_RESIZE_SUPPORT
         if (sbi->ll_flags & LL_SBI_LRU_RESIZE)
 
 #ifdef HAVE_LRU_RESIZE_SUPPORT
         if (sbi->ll_flags & LL_SBI_LRU_RESIZE)
index e4b184c..7c75c75 100644 (file)
@@ -199,7 +199,10 @@ int lmv_revalidate_slaves(struct obd_export *exp,
                 * which is not needed here.
                 */
                memset(op_data, 0, sizeof(*op_data));
                 * 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_tgt(lmv, lsm->lsm_md_oinfo[i].lmo_mds);
                op_data->op_fid2 = fid;
 
                tgt = lmv_tgt(lmv, lsm->lsm_md_oinfo[i].lmo_mds);