All of lore.kernel.org
 help / color / mirror / Atom feed
From: Namjae Jeon <linkinjeon@kernel.org>
To: Tom Talpey <tom@talpey.com>
Cc: linux-cifs@vger.kernel.org, smfrench@gmail.com,
	hyc.lee@gmail.com, senozhatsky@chromium.org,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH] ksmbd: set fixed sector size to FS_SECTOR_SIZE_INFORMATION
Date: Wed, 13 Apr 2022 12:23:33 +0900	[thread overview]
Message-ID: <CAKYAXd_Esmq__t6JCYCYT0rFS5EdrvUOtGitX-b9MV4ogg3dAw@mail.gmail.com> (raw)
In-Reply-To: <d7771443-f935-357f-3606-c09920a2341f@talpey.com>

2022-04-13 10:40 GMT+09:00, Tom Talpey <tom@talpey.com>:
> On 4/12/2022 6:58 PM, Namjae Jeon wrote:
>> Currently ksmbd is using ->f_bsize from vfs_statfs() as sector size.
>> If fat/exfat is a local share, ->f_bsize is a cluster size that is too
>> large to be used as a sector size. Sector sizes larger than 4K cause
>> problem occurs when mounting an iso file through windows client.
>>
>> The error message can be obtained using Mount-DiskImage command,
>>   the error is:
>> "Mount-DiskImage : The sector size of the physical disk on which the
>> virtual disk resides is not supported."
>>
>> This patch reports fixed sector size as 512B logical/4K physical to
>> windows client to avoid poking into the block device.
>>
>> Cc: Christoph Hellwig <hch@lst.de>
>> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
>> ---
>>   fs/ksmbd/smb2pdu.c | 9 ++++-----
>>   1 file changed, 4 insertions(+), 5 deletions(-)
>>
>> diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
>> index 62cc0f95ab87..28ff7c058bc4 100644
>> --- a/fs/ksmbd/smb2pdu.c
>> +++ b/fs/ksmbd/smb2pdu.c
>> @@ -4998,12 +4998,11 @@ static int smb2_get_info_filesystem(struct
>> ksmbd_work *work,
>>
>>   		info = (struct smb3_fs_ss_info *)(rsp->Buffer);
>>
>> -		info->LogicalBytesPerSector = cpu_to_le32(stfs.f_bsize);
>> -		info->PhysicalBytesPerSectorForAtomicity =
>> -				cpu_to_le32(stfs.f_bsize);
>> -		info->PhysicalBytesPerSectorForPerf = cpu_to_le32(stfs.f_bsize);
>> +		info->LogicalBytesPerSector = cpu_to_le32(512);
>> +		info->PhysicalBytesPerSectorForAtomicity = cpu_to_le32(4096);
>> +		info->PhysicalBytesPerSectorForPerf = cpu_to_le32(4096);
>>   		info->FSEffPhysicalBytesPerSectorForAtomicity =
>> -				cpu_to_le32(stfs.f_bsize);
>> +				cpu_to_le32(4096);
>
Hi Tom,
> So, this sounds like a great approach, much better than returning 128K.
Thanks:)
>
> However, it's not at all universally true that 4K is going to be atomic.
Could you please elaborate more ? Is the atomic size not 4K for 4K
native storage?

> And min(stfs.f_bsize, 4096) might be problematic too. Is there any better
> option??
There is no option than to poke into block layer, but Christoph
pointed out that this will also give the wrong answer for file systems
with multiple device support (btrfs, f2fs, xfs).
So we need to select fixed size as between 512B ~ 4KB. I think the v2
patch looks a bit better...

Thanks!
>
> Tom.
>
>
>>   		info->Flags = cpu_to_le32(SSINFO_FLAGS_ALIGNED_DEVICE |
>>   				    SSINFO_FLAGS_PARTITION_ALIGNED_ON_DEVICE);
>>   		info->ByteOffsetForSectorAlignment = 0;
>

  reply	other threads:[~2022-04-13  3:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-12 22:58 [PATCH] ksmbd: set fixed sector size to FS_SECTOR_SIZE_INFORMATION Namjae Jeon
2022-04-13  1:40 ` Tom Talpey
2022-04-13  3:23   ` Namjae Jeon [this message]
2022-04-13 12:25     ` Tom Talpey
2022-04-13 14:31       ` 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=CAKYAXd_Esmq__t6JCYCYT0rFS5EdrvUOtGitX-b9MV4ogg3dAw@mail.gmail.com \
    --to=linkinjeon@kernel.org \
    --cc=hch@lst.de \
    --cc=hyc.lee@gmail.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=senozhatsky@chromium.org \
    --cc=smfrench@gmail.com \
    --cc=tom@talpey.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 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.