diff mbox

[CIFS] Incorrect error returned on setting file compressed on SMB2

Message ID CAH2r5muLY2X17Gdg-VyMX=3X-Dg-xtQ_LozMDrsvWFqPYQ+jZg@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Steve French Aug. 19, 2014, 3:33 a.m. UTC
When the server (for an SMB2 or SMB3 mount) doesn't support
an ioctl (such as setting the compressed flag
on a file) we were incorrectly returning EIO instead
of EOPNOTSUPP, this is confusing e.g. doing chattr +c to a file
on a non-btrfs Samba partition, now the error returned is more
intuitive to the user.

Signed-off-by: Steve French <smfrench@gmail.com>
---
 fs/cifs/smb2maperror.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

     {STATUS_WRONG_VOLUME, -EIO, "STATUS_WRONG_VOLUME"},
     {STATUS_NO_MEDIA_IN_DEVICE, -EIO, "STATUS_NO_MEDIA_IN_DEVICE"},

Comments

David Disseldorp Aug. 19, 2014, 9:34 a.m. UTC | #1
On Mon, 18 Aug 2014 22:33:06 -0500, Steve French wrote:

> When the server (for an SMB2 or SMB3 mount) doesn't support
> an ioctl (such as setting the compressed flag
> on a file) we were incorrectly returning EIO instead
> of EOPNOTSUPP, this is confusing e.g. doing chattr +c to a file
> on a non-btrfs Samba partition, now the error returned is more
> intuitive to the user.
> 
> Signed-off-by: Steve French <smfrench@gmail.com>

Reviewed-by: David Disseldorp <ddiss@suse.de>

Looks like the cifs_hardlink() -EIO to -EOPNOTSUPP mapping logic could
potentially also be removed with this change.

Cheers, David
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/cifs/smb2maperror.c b/fs/cifs/smb2maperror.c
index a689514..af59d03 100644
--- a/fs/cifs/smb2maperror.c
+++ b/fs/cifs/smb2maperror.c
@@ -298,7 +298,7 @@  static const struct status_to_posix_error
smb2_error_map_table[] = {
     {STATUS_INVALID_PARAMETER, -EINVAL, "STATUS_INVALID_PARAMETER"},
     {STATUS_NO_SUCH_DEVICE, -ENODEV, "STATUS_NO_SUCH_DEVICE"},
     {STATUS_NO_SUCH_FILE, -ENOENT, "STATUS_NO_SUCH_FILE"},
-    {STATUS_INVALID_DEVICE_REQUEST, -EIO, "STATUS_INVALID_DEVICE_REQUEST"},
+    {STATUS_INVALID_DEVICE_REQUEST, -EOPNOTSUPP,
"STATUS_INVALID_DEVICE_REQUEST"},
     {STATUS_END_OF_FILE, -ENODATA, "STATUS_END_OF_FILE"},