Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4890801iob; Mon, 9 May 2022 04:12:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwue6dq4jRLFzw9sMYJyj/8hUj1bjGh0VD3IzQGhuJQp/pWNvTGKKm31/PHV9sRXCYfTed5 X-Received: by 2002:a05:6a00:21c2:b0:4fe:81f:46c7 with SMTP id t2-20020a056a0021c200b004fe081f46c7mr15459867pfj.5.1652094736773; Mon, 09 May 2022 04:12:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652094736; cv=none; d=google.com; s=arc-20160816; b=pih5wr9l1dZqqB+0IJpUTkUJMC82Dk2YCYbtktOmOCkkt9lxLFRmu+Z0dxE5Snxrdm PELRD+JY3ippeeHmOBpyY93T/laWp4cx1HltPZZJR/T7dVUuIzpAtagJOn7w/3RSiPez Uq/72Pr+zmy+7ctWwuYCcOAA5Za0YQlrGpvjPbhHXxjADO5l7XgXvlBRrLhMyHk7cXZm 9WYEtJIQIZ4dmqTra8asG7HmJVPFdeThlh7Ob+Y/YRVvGeKjxMqiPneYZnxLmz7j2USk XQ1gY0PRZW9SHdJWsd8jxCw9WhOnzDttQwl21uVHZzCb6j9NKP6rdUKT9mCT+tpaDfyE YLYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qT1CDu9rz+kfLqePp7/jvG6Rt8gHzqjJ4PMhKGUfclY=; b=YtRZqoVdY0ldEzCnqJ1CNoClCYURmrghF7Ktzb7Y3SQdt2jLFvkJj8+31Y0x/53VVr JMpvqUsPanGauW2fSp4o4Kb48U1AmOzRRYNwAZo671yoNQ5GLkH+VCI/NZ5PfR78bXXD 2DUZVegpcT3PmwYr6CbrK8saAMP42pQzj5uxhr2EbxBuP6a+xfkmbINcAewfppt0MF4a hLQyZU+/sU6PjhhAVQuUokMh8+spHxkAqkfjFXPRYavhuvtU2NoRgSX7vHkbU1MKai4B vgnXv2A46d8LVg4+7TaLipy8+p0gXzZrhrCYAJPZ2gWK8DwkGBKLXLh7f/o8hpVmEReY LMUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=18UX1DpZ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id y9-20020a1709029b8900b00153b2d1659esi11043592plp.422.2022.05.09.04.12.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:12:16 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=18UX1DpZ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1C37D245619; Mon, 9 May 2022 03:24:28 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376807AbiEDRzY (ORCPT + 99 others); Wed, 4 May 2022 13:55:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356741AbiEDROF (ORCPT ); Wed, 4 May 2022 13:14:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A91953B74; Wed, 4 May 2022 09:58:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D3A26B82416; Wed, 4 May 2022 16:58:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DED7C385AA; Wed, 4 May 2022 16:58:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683492; bh=0Y5QnMd8T87CITmK3jIabf6VdsS8nJNvvvMpL+BzWVI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=18UX1DpZBWSdlvlu5tlQYycNZeV255dF0sqrzh9N+R2rOamGnzxupOtkqbo+nutPR K/dhSh7k72Vf0GL9AiQnjJTenr1twsd5IHSomGF+2b0XdadfkShPeWLpGrYRmS3I8/ m4pa6W9Ydikqlvz/4nzfTgbvtBSKbsWiT9bO5qZI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Namjae Jeon , Steve French , Sasha Levin Subject: [PATCH 5.17 167/225] ksmbd: set fixed sector size to FS_SECTOR_SIZE_INFORMATION Date: Wed, 4 May 2022 18:46:45 +0200 Message-Id: <20220504153124.856157629@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153110.096069935@linuxfoundation.org> References: <20220504153110.096069935@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Namjae Jeon [ Upstream commit 02655a70b7cc0f534531ee65fa72692f4d31a944 ] 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 Signed-off-by: Steve French Signed-off-by: Sasha Levin --- fs/ksmbd/smb2pdu.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c index a19a2b9c1e56..83ffa73c9348 100644 --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -11,6 +11,7 @@ #include #include #include +#include #include "glob.h" #include "smbfsctl.h" @@ -5005,15 +5006,17 @@ static int smb2_get_info_filesystem(struct ksmbd_work *work, case FS_SECTOR_SIZE_INFORMATION: { struct smb3_fs_ss_info *info; + unsigned int sector_size = + min_t(unsigned int, path.mnt->mnt_sb->s_blocksize, 4096); info = (struct smb3_fs_ss_info *)(rsp->Buffer); - info->LogicalBytesPerSector = cpu_to_le32(stfs.f_bsize); + info->LogicalBytesPerSector = cpu_to_le32(sector_size); info->PhysicalBytesPerSectorForAtomicity = - cpu_to_le32(stfs.f_bsize); - info->PhysicalBytesPerSectorForPerf = cpu_to_le32(stfs.f_bsize); + cpu_to_le32(sector_size); + info->PhysicalBytesPerSectorForPerf = cpu_to_le32(sector_size); info->FSEffPhysicalBytesPerSectorForAtomicity = - cpu_to_le32(stfs.f_bsize); + cpu_to_le32(sector_size); info->Flags = cpu_to_le32(SSINFO_FLAGS_ALIGNED_DEVICE | SSINFO_FLAGS_PARTITION_ALIGNED_ON_DEVICE); info->ByteOffsetForSectorAlignment = 0; -- 2.35.1