Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4416511ioa; Wed, 27 Apr 2022 03:28:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVcjzd9UD9pIqf8SNF321Ys69IM9Eu7Oc9kqnuZEY7BwhdSgr5kKhxRJ/tEKM3BKM6yBzJ X-Received: by 2002:a17:902:9005:b0:158:e46e:688c with SMTP id a5-20020a170902900500b00158e46e688cmr27821465plp.173.1651055296639; Wed, 27 Apr 2022 03:28:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651055296; cv=none; d=google.com; s=arc-20160816; b=Q0XDBFaonfsRKSx/zri/cwc36CoztIGKhTWxqkNQqrVJ3J8u9jAz1DpSQ0HXHj7b3V W8eVz4dgnkX9QH/1zuXfn31RQbIferz8AR6hSuNQMrC1h7ot4yHtA0acOEkn5u85bwfh e1Wgs4Bm0QXXm03pXDyCCS32wr1RdHc2kLz8vSt63pXNXQ/Av/mqb91Pt6ZS9gcu2OFU GzjZfYy6OMlELxOb1pGxwJqHrdpvetLq/XWL6Vr4L5H3oa2oad8uXG4oRfNDRMl5FZQ0 fiEKtLRfypHfqwjAUjklMjZatpRG89hVHtbREYrjTRWeFRD5m7tjHd/FHpL9x+3l5GH5 Msog== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Y/57BaabzzIWlMjFROKlfEz8Gz/oxH31l7+ruExBJcw=; b=me1x8gp+rt0xdxZiEkFbVgSK8ByqAtq+cQKdcWPZooRUc9C9CMjEFxEJGGQKUDFbqw AO2WLqaou2tqMiNx462CqT8Xji0KSY5BtIpGWq6npDrjroDbtaouSgIW2YBb2j8TkHXg skEay5ithSZLKyfCA5+n1JZfG/tRrnkZaboGTGhCbZHmp45gLW6GAootdERs1tos2p93 p3OcB1rpwNi4fMdpER9rvbbzMWvQwuVUHqTDrJ+8a+5LPyeL92yDAPr7cExQ5W6l586t cypoWVdhiiFsSZcw1l4IP+5+pQ8wY+Ur+diqgD/s777LT/KstwLHQwdX9SuDx5HHZW6y v5Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UILMLzfX; 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=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id i123-20020a639d81000000b0039822e42cbasi1129468pgd.427.2022.04.27.03.28.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 03:28: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=@kernel.org header.s=k20201202 header.b=UILMLzfX; 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=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3C1863983E2; Wed, 27 Apr 2022 02:44:18 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353928AbiDZTHK (ORCPT + 99 others); Tue, 26 Apr 2022 15:07:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353770AbiDZTFk (ORCPT ); Tue, 26 Apr 2022 15:05:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CD2419981E; Tue, 26 Apr 2022 12:02:25 -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 EF014B82252; Tue, 26 Apr 2022 19:02:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DD5CC385A0; Tue, 26 Apr 2022 19:02:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650999742; bh=9NY7USzhuSlp779ziJCCibr/+WvkaizSECqK6XQIv0w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UILMLzfXJhWbX3YQIfNVPVEMHKMJgp91vhXSYXm/7qnsu7+9XoGB9wEVHFwtaqnyx eWUcxR79bdaBRTyONPkVy1E3z097XRzWecCamMIZ9GwKPHynzGTVG9NZ/uhZW9QbuJ PhcRMJ58mRvJTDjoWKik6ZMrH4LmCv3p9lRWtsTCfqmMOXzwcpMqieS9rESC4KdZDR ShqCPQuS3lZqjMtr47x7XhHbEPntjKRcpouQobllZMqp0H6hGDPjE+ZBdArYKovLxo KpPXL3M8jG58IY0ludU/Xzl6/Cxd7h4maARMhQAKd4VS8lPW3G/s9q+UnZpg5WGnG2 LH8M3noefuNpA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Namjae Jeon , Steve French , Sasha Levin , sfrench@samba.org, hyc.lee@gmail.com, linux-cifs@vger.kernel.org Subject: [PATCH AUTOSEL 5.15 06/15] ksmbd: set fixed sector size to FS_SECTOR_SIZE_INFORMATION Date: Tue, 26 Apr 2022 15:02:05 -0400 Message-Id: <20220426190216.2351413-6-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220426190216.2351413-1-sashal@kernel.org> References: <20220426190216.2351413-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE 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 a9fdb47c2791..1ed3046dd5b3 100644 --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -11,6 +11,7 @@ #include #include #include +#include #include "glob.h" #include "smb2pdu.h" @@ -4997,15 +4998,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