linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Talpey <tom@talpey.com>
To: Namjae Jeon <linkinjeon@kernel.org>, linux-cifs@vger.kernel.org
Subject: Re: [PATCH] ksmbd: add default data stream name in FILE_STREAM_INFORMATION
Date: Sat, 18 Sep 2021 08:39:53 -0400	[thread overview]
Message-ID: <ac18e062-e835-b575-66af-72631df7ef7d@talpey.com> (raw)
In-Reply-To: <20210918120239.96627-1-linkinjeon@kernel.org>

This doesn't appear to be what's documented in MS-FSA section 2.1.5.11.29.
There, it appears to call for returning an empty stream list,
and STATUS_SUCCESS, when no streams are present.

Also, why does the code special-case directories? The conditionals
on StreamSize and StreamAllocation size are entirely redundant,
after the top-level if (!S_ISDIR...), btw.

I'd suggest asking Microsoft dochelp for clarification before
implementing this.

Tom.

On 9/18/2021 8:02 AM, Namjae Jeon wrote:
> 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;
>   	}
>   
> 

  reply	other threads:[~2021-09-18 12:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=ac18e062-e835-b575-66af-72631df7ef7d@talpey.com \
    --to=tom@talpey.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).