All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ksmbd: set fixed sector size to FS_SECTOR_SIZE_INFORMATION
@ 2022-04-12 22:58 Namjae Jeon
  2022-04-13  1:40 ` Tom Talpey
  0 siblings, 1 reply; 5+ messages in thread
From: Namjae Jeon @ 2022-04-12 22:58 UTC (permalink / raw)
  To: linux-cifs; +Cc: smfrench, hyc.lee, senozhatsky, Namjae Jeon, Christoph Hellwig

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);
 		info->Flags = cpu_to_le32(SSINFO_FLAGS_ALIGNED_DEVICE |
 				    SSINFO_FLAGS_PARTITION_ALIGNED_ON_DEVICE);
 		info->ByteOffsetForSectorAlignment = 0;
-- 
2.25.1


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

end of thread, other threads:[~2022-04-13 14:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2022-04-13 12:25     ` Tom Talpey
2022-04-13 14:31       ` Namjae Jeon

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.