From: Namjae Jeon <linkinjeon@kernel.org>
To: linux-cifs@vger.kernel.org
Cc: smfrench@gmail.com, hyc.lee@gmail.com, senozhatsky@chromium.org,
Namjae Jeon <linkinjeon@kernel.org>
Subject: [PATCH 2/2] ksmbd: remove generic_fillattr use in smb2_open()
Date: Tue, 30 Aug 2022 23:17:32 +0900 [thread overview]
Message-ID: <20220830141732.9982-2-linkinjeon@kernel.org> (raw)
In-Reply-To: <20220830141732.9982-1-linkinjeon@kernel.org>
Removed the use of unneeded generic_fillattr() in smb2_open().
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
---
fs/ksmbd/smb2pdu.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
index c49f65146ab3..ad6410874b95 100644
--- a/fs/ksmbd/smb2pdu.c
+++ b/fs/ksmbd/smb2pdu.c
@@ -2761,7 +2761,6 @@ int smb2_open(struct ksmbd_work *work)
} else {
file_present = true;
user_ns = mnt_user_ns(path.mnt);
- generic_fillattr(user_ns, d_inode(path.dentry), &stat);
}
if (stream_name) {
if (req->CreateOptions & FILE_DIRECTORY_FILE_LE) {
@@ -2770,7 +2769,8 @@ int smb2_open(struct ksmbd_work *work)
rsp->hdr.Status = STATUS_NOT_A_DIRECTORY;
}
} else {
- if (S_ISDIR(stat.mode) && s_type == DATA_STREAM) {
+ if (file_present && S_ISDIR(d_inode(path.dentry)->i_mode) &&
+ s_type == DATA_STREAM) {
rc = -EIO;
rsp->hdr.Status = STATUS_FILE_IS_A_DIRECTORY;
}
@@ -2787,7 +2787,8 @@ int smb2_open(struct ksmbd_work *work)
}
if (file_present && req->CreateOptions & FILE_NON_DIRECTORY_FILE_LE &&
- S_ISDIR(stat.mode) && !(req->CreateOptions & FILE_DELETE_ON_CLOSE_LE)) {
+ S_ISDIR(d_inode(path.dentry)->i_mode) &&
+ !(req->CreateOptions & FILE_DELETE_ON_CLOSE_LE)) {
ksmbd_debug(SMB, "open() argument is a directory: %s, %x\n",
name, req->CreateOptions);
rsp->hdr.Status = STATUS_FILE_IS_A_DIRECTORY;
@@ -2797,7 +2798,7 @@ int smb2_open(struct ksmbd_work *work)
if (file_present && (req->CreateOptions & FILE_DIRECTORY_FILE_LE) &&
!(req->CreateDisposition == FILE_CREATE_LE) &&
- !S_ISDIR(stat.mode)) {
+ !S_ISDIR(d_inode(path.dentry)->i_mode)) {
rsp->hdr.Status = STATUS_NOT_A_DIRECTORY;
rc = -EIO;
goto err_out;
--
2.25.1
next prev parent reply other threads:[~2022-08-30 14:18 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-30 14:17 [PATCH 1/2] ksmbd: update documentation Namjae Jeon
2022-08-30 14:17 ` Namjae Jeon [this message]
2022-09-01 6:08 ` [PATCH 2/2] ksmbd: remove generic_fillattr use in smb2_open() Hyunchul Lee
2022-08-30 16:13 ` [PATCH 1/2] ksmbd: update documentation Tom Talpey
2022-08-31 1:36 ` Namjae Jeon
2022-09-01 5:19 ` atheik
2022-09-01 13:06 ` Tom Talpey
2022-09-01 16:14 ` Jeremy Allison
2022-09-01 17:41 ` atheik
2022-09-01 18:30 ` Jeremy Allison
2022-09-01 18:52 ` Tom Talpey
2022-09-01 22:24 ` Steve French
2022-09-01 23:54 ` Tom Talpey
2022-09-01 19:42 ` atheik
2022-09-01 20:26 ` Jeremy Allison
2022-09-01 21:21 ` ronnie sahlberg
2022-09-01 21:37 ` Steve French
2022-09-01 21:48 ` Jeremy Allison
2022-09-02 0:56 ` Namjae Jeon
2022-09-02 2:11 ` Jeremy Allison
2022-09-02 12:35 ` Tom Talpey
2022-09-02 13:33 ` Namjae Jeon
2022-08-30 17:32 ` Tom Talpey
2022-08-31 0:02 ` Namjae Jeon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220830141732.9982-2-linkinjeon@kernel.org \
--to=linkinjeon@kernel.org \
--cc=hyc.lee@gmail.com \
--cc=linux-cifs@vger.kernel.org \
--cc=senozhatsky@chromium.org \
--cc=smfrench@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox