Skip to content

Commit 02655a7

Browse files
namjaejeonSteve French
authored andcommitted
ksmbd: set fixed sector size to FS_SECTOR_SIZE_INFORMATION
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 4KB sector size if ->s_blocksize is bigger than 4KB. Signed-off-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 8510a04 commit 02655a7

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

fs/ksmbd/smb2pdu.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <linux/statfs.h>
1212
#include <linux/ethtool.h>
1313
#include <linux/falloc.h>
14+
#include <linux/mount.h>
1415

1516
#include "glob.h"
1617
#include "smbfsctl.h"
@@ -4995,15 +4996,17 @@ static int smb2_get_info_filesystem(struct ksmbd_work *work,
49954996
case FS_SECTOR_SIZE_INFORMATION:
49964997
{
49974998
struct smb3_fs_ss_info *info;
4999+
unsigned int sector_size =
5000+
min_t(unsigned int, path.mnt->mnt_sb->s_blocksize, 4096);
49985001

49995002
info = (struct smb3_fs_ss_info *)(rsp->Buffer);
50005003

5001-
info->LogicalBytesPerSector = cpu_to_le32(stfs.f_bsize);
5004+
info->LogicalBytesPerSector = cpu_to_le32(sector_size);
50025005
info->PhysicalBytesPerSectorForAtomicity =
5003-
cpu_to_le32(stfs.f_bsize);
5004-
info->PhysicalBytesPerSectorForPerf = cpu_to_le32(stfs.f_bsize);
5006+
cpu_to_le32(sector_size);
5007+
info->PhysicalBytesPerSectorForPerf = cpu_to_le32(sector_size);
50055008
info->FSEffPhysicalBytesPerSectorForAtomicity =
5006-
cpu_to_le32(stfs.f_bsize);
5009+
cpu_to_le32(sector_size);
50075010
info->Flags = cpu_to_le32(SSINFO_FLAGS_ALIGNED_DEVICE |
50085011
SSINFO_FLAGS_PARTITION_ALIGNED_ON_DEVICE);
50095012
info->ByteOffsetForSectorAlignment = 0;

0 commit comments

Comments
 (0)