All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ksmbd: add default data stream name in FILE_STREAM_INFORMATION
@ 2021-09-18 12:02 Namjae Jeon
  2021-09-18 12:39 ` Tom Talpey
  0 siblings, 1 reply; 10+ messages in thread
From: Namjae Jeon @ 2021-09-18 12:02 UTC (permalink / raw)
  To: linux-cifs; +Cc: Namjae Jeon

Windows client expect to get default stream name(::DATA) in
FILE_STREAM_INFORMATION response even if there is no stream data in file.
This patch fix update failure when writing ppt or doc files.

Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
---
 fs/ksmbd/smb2pdu.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
index 49a1ca75f427..301605e0cbf7 100644
--- a/fs/ksmbd/smb2pdu.c
+++ b/fs/ksmbd/smb2pdu.c
@@ -4465,17 +4465,15 @@ static void get_file_stream_info(struct ksmbd_work *work,
 		file_info->NextEntryOffset = cpu_to_le32(next);
 	}
 
-	if (nbytes) {
+	if (!S_ISDIR(stat.mode)) {
 		file_info = (struct smb2_file_stream_info *)
 			&rsp->Buffer[nbytes];
 		streamlen = smbConvertToUTF16((__le16 *)file_info->StreamName,
 					      "::$DATA", 7, conn->local_nls, 0);
 		streamlen *= 2;
 		file_info->StreamNameLength = cpu_to_le32(streamlen);
-		file_info->StreamSize = S_ISDIR(stat.mode) ? 0 :
-			cpu_to_le64(stat.size);
-		file_info->StreamAllocationSize = S_ISDIR(stat.mode) ? 0 :
-			cpu_to_le64(stat.size);
+		file_info->StreamSize = 0;
+		file_info->StreamAllocationSize = 0;
 		nbytes += sizeof(struct smb2_file_stream_info) + streamlen;
 	}
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-09-21 19:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-18 12:02 [PATCH] ksmbd: add default data stream name in FILE_STREAM_INFORMATION Namjae Jeon
2021-09-18 12:39 ` Tom Talpey
2021-09-18 21:36   ` Namjae Jeon
2021-09-20  4:47   ` Steve French
2021-09-20  4:53     ` Steve French
2021-09-20 16:08     ` Tom Talpey
2021-09-20 16:34       ` Namjae Jeon
2021-09-21 18:19         ` Tom Talpey
2021-09-21 19:17           ` Steve French
2021-09-20 16:36       ` Steve French

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.