summaryrefslogtreecommitdiff
path: root/fs/ksmbd/vfs.c
diff options
context:
space:
mode:
authorHyunchul Lee <hyc.lee@gmail.com>2021-07-03 12:10:36 +0900
committerNamjae Jeon <namjae.jeon@samsung.com>2021-07-05 09:22:49 +0900
commit465d720485eff1468503d210b1b966660f5f9b85 (patch)
treea1580b00e3295e9b6b29253dbc9e50e84ed9af38 /fs/ksmbd/vfs.c
parent690f969705138b235b9fa4c4d19e5129ed54a845 (diff)
ksmbd: call mnt_user_ns once in a function
Avoid calling mnt_user_ns() many time in a function. Cc: Christoph Hellwig <hch@infradead.org> Cc: Christian Brauner <christian@brauner.io> Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com> Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/ksmbd/vfs.c')
-rw-r--r--fs/ksmbd/vfs.c5
1 files changed, 3 insertions, 2 deletions
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,