]> git.ipfire.org Git - thirdparty/linux.git/commit
smb/client: preserve errors from smb2_set_sparse()
authorHuiwen He <hehuiwen@kylinos.cn>
Wed, 24 Jun 2026 02:15:43 +0000 (10:15 +0800)
committerSteve French <stfrench@microsoft.com>
Wed, 24 Jun 2026 15:33:51 +0000 (10:33 -0500)
commit2a4b3d2db5c6fcdba889baf7b2ae5661b0beac89
tree24e576ce0fb46ca17d0c7fcdbaf7990ed25c1fdf
parent1c6267a1d5cf4c73b656f8181b310cbbb3e4767b
smb/client: preserve errors from smb2_set_sparse()

smb2_set_sparse() converts every FSCTL_SET_SPARSE failure to false and
marks sparse support as broken for the share. Callers therefore report
EOPNOTSUPP even for errors such as ENOSPC or EACCES, and later sparse
operations remain disabled until the share is unmounted.

Return the SMB2 ioctl error directly. Set broken_sparse_sup only for
EOPNOTSUPP, which indicates that the server does not support the request.

Update smb3_punch_hole() to propagate the error returned by
smb2_set_sparse().

Fixes: 3d1a3745d8ca ("Add sparse file support to SMB2/SMB3 mounts")
Signed-off-by: Huiwen He <hehuiwen@kylinos.cn>
Reviewed-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/smb2ops.c