diff mbox series

[1/9] lustre: llite: send file mode with rename RPC

Message ID 1612832067-1449-2-git-send-email-jsimmons@infradead.org (mailing list archive)
State New, archived
Headers show
Series Sync to OpenSFS as of Feb 8, 2021 | expand

Commit Message

James Simmons Feb. 9, 2021, 12:54 a.m. UTC
From: Andreas Dilger <adilger@whamcloud.com>

In preparation for parallel rename operations, send renamed file mode
to the MDS in order to allow the rename locking to be more efficient.

WC-bug-id: https://jira.whamcloud.com/browse/LU-12125
Lustre-commit: 47576dc68cd9006 ("LU-12125 llite: send file mode with rename RPC")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/41184
Reviewed-by: Lai Siyao <lai.siyao@whamcloud.com>
Reviewed-by: Yingjin Qian <qian@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 fs/lustre/llite/namei.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/fs/lustre/llite/namei.c b/fs/lustre/llite/namei.c
index b24f097..1095fa9 100644
--- a/fs/lustre/llite/namei.c
+++ b/fs/lustre/llite/namei.c
@@ -1745,6 +1745,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();
+	umode_t mode = 0;
 	int err;
 
 	if (flags)
@@ -1762,7 +1763,13 @@  static int ll_rename(struct inode *src, struct dentry *src_dchild,
 	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);