Whamcloud - gitweb
LU-12125 llite: send file mode with rename RPC 84/41184/5
authorAndreas Dilger <adilger@whamcloud.com>
Sat, 9 Jan 2021 07:23:39 +0000 (00:23 -0700)
committerOleg Drokin <green@whamcloud.com>
Fri, 22 Jan 2021 20:14:23 +0000 (20:14 +0000)
In preparation for parallel rename operations, send renamed file mode
to the MDS in order to allow the rename locking to be more efficient.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I4691f30d151a8ff81e443d24109234341b3ebbe5
Reviewed-on: https://review.whamcloud.com/41184
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Lai Siyao <lai.siyao@whamcloud.com>
Reviewed-by: Yingjin Qian <qian@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/namei.c

index 4d0babd..7311a2f 100644 (file)
@@ -1814,6 +1814,7 @@ static int ll_rename(struct inode *src, struct dentry *src_dchild,
        struct ll_sb_info *sbi = ll_i2sbi(src);
        struct md_op_data *op_data;
        ktime_t kstart = ktime_get();
        struct ll_sb_info *sbi = ll_i2sbi(src);
        struct md_op_data *op_data;
        ktime_t kstart = ktime_get();
+       umode_t mode = 0;
        int err;
        ENTRY;
 
        int err;
        ENTRY;
 
@@ -1838,15 +1839,21 @@ static int ll_rename(struct inode *src, struct dentry *src_dchild,
        if (err)
                RETURN(err);
 
        if (err)
                RETURN(err);
 
-       op_data = ll_prep_md_op_data(NULL, src, tgt, NULL, 0, 0,
+       if (src_dchild->d_inode)
+               mode = src_dchild->d_inode->i_mode;
+
+       if (tgt_dchild->d_inode)
+               mode = tgt_dchild->d_inode->i_mode;
+
+       op_data = ll_prep_md_op_data(NULL, src, tgt, NULL, 0, mode,
                                     LUSTRE_OPC_ANY, NULL);
        if (IS_ERR(op_data))
                RETURN(PTR_ERR(op_data));
 
                                     LUSTRE_OPC_ANY, NULL);
        if (IS_ERR(op_data))
                RETURN(PTR_ERR(op_data));
 
-       if (src_dchild->d_inode != NULL)
+       if (src_dchild->d_inode)
                op_data->op_fid3 = *ll_inode2fid(src_dchild->d_inode);
 
                op_data->op_fid3 = *ll_inode2fid(src_dchild->d_inode);
 
-       if (tgt_dchild->d_inode != NULL)
+       if (tgt_dchild->d_inode)
                op_data->op_fid4 = *ll_inode2fid(tgt_dchild->d_inode);
 
        err = md_rename(sbi->ll_md_exp, op_data,
                op_data->op_fid4 = *ll_inode2fid(tgt_dchild->d_inode);
 
        err = md_rename(sbi->ll_md_exp, op_data,