summaryrefslogtreecommitdiff
path: root/fs/ksmbd/oplock.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/oplock.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/oplock.c')
-rw-r--r--fs/ksmbd/oplock.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/ksmbd/oplock.c b/fs/ksmbd/oplock.c
index 5484b5bf75b0..71063568dfee 100644
--- a/fs/ksmbd/oplock.c
+++ b/fs/ksmbd/oplock.c
@@ -1582,6 +1582,7 @@ void create_posix_rsp_buf(char *cc, struct ksmbd_file *fp)
{
struct create_posix_rsp *buf;
struct inode *inode = file_inode(fp->filp);
+ struct user_namespace *user_ns = file_mnt_user_ns(fp->filp);
buf = (struct create_posix_rsp *)cc;
memset(buf, 0, sizeof(struct create_posix_rsp));
@@ -1612,9 +1613,9 @@ void create_posix_rsp_buf(char *cc, struct ksmbd_file *fp)
buf->nlink = cpu_to_le32(inode->i_nlink);
buf->reparse_tag = cpu_to_le32(fp->volatile_id);
buf->mode = cpu_to_le32(inode->i_mode);
- id_to_sid(from_kuid(file_mnt_user_ns(fp->filp), inode->i_uid),
+ id_to_sid(from_kuid(user_ns, inode->i_uid),
SIDNFS_USER, (struct smb_sid *)&buf->SidBuffer[0]);
- id_to_sid(from_kgid(file_mnt_user_ns(fp->filp), inode->i_gid),
+ id_to_sid(from_kgid(user_ns, inode->i_gid),
SIDNFS_GROUP, (struct smb_sid *)&buf->SidBuffer[20]);
}