From 465d720485eff1468503d210b1b966660f5f9b85 Mon Sep 17 00:00:00 2001 From: Hyunchul Lee Date: Sat, 3 Jul 2021 12:10:36 +0900 Subject: ksmbd: call mnt_user_ns once in a function Avoid calling mnt_user_ns() many time in a function. Cc: Christoph Hellwig Cc: Christian Brauner Signed-off-by: Hyunchul Lee Signed-off-by: Namjae Jeon Signed-off-by: Steve French --- fs/ksmbd/vfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'fs/ksmbd/vfs.c') diff --git a/fs/ksmbd/vfs.c b/fs/ksmbd/vfs.c index 0f5a4fb8215f..7339d5c74aad 100644 --- a/fs/ksmbd/vfs.c +++ b/fs/ksmbd/vfs.c @@ -406,6 +406,7 @@ static int ksmbd_vfs_stream_write(struct ksmbd_file *fp, char *buf, loff_t *pos, size_t count) { char *stream_buf = NULL, *wbuf; + struct user_namespace *user_ns = file_mnt_user_ns(fp->filp); size_t size, v_len; int err = 0; @@ -418,7 +419,7 @@ static int ksmbd_vfs_stream_write(struct ksmbd_file *fp, char *buf, loff_t *pos, count = (*pos + count) - XATTR_SIZE_MAX; } - v_len = ksmbd_vfs_getcasexattr(file_mnt_user_ns(fp->filp), + v_len = ksmbd_vfs_getcasexattr(user_ns, fp->filp->f_path.dentry, fp->stream.name, fp->stream.size, @@ -444,7 +445,7 @@ static int ksmbd_vfs_stream_write(struct ksmbd_file *fp, char *buf, loff_t *pos, memcpy(&stream_buf[*pos], buf, count); - err = ksmbd_vfs_setxattr(file_mnt_user_ns(fp->filp), + err = ksmbd_vfs_setxattr(user_ns, fp->filp->f_path.dentry, fp->stream.name, (void *)stream_buf, -- cgit v1.2.3