Skip to contentSkip to conversation

cifs: map NT_STATUS_ERROR_WRITE_PROTECTED to -EROFS

PATCH In review Jeff Layton 2 participants 3 messages Jul 26, 2010 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 cifs: map NT_STATUS_ERROR_WRITE_PROTECTED to -EROFS

Seems like a more sensible mapping than -EIO.

---
 fs/cifs/netmisc.c |    1 +
 fs/cifs/smberr.h  |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
fs/cifs/netmisc.c +1 -0
index 3489468..c6721ee 100644
@@ -61,6 +61,7 @@ static const struct smb_to_posix_error mapping_table_ERRDOS[] = {
 	{ERRremcd, -EACCES},
 	{ERRdiffdevice, -EXDEV},
 	{ERRnofiles, -ENOENT},
+	{ERRwriteprot, -EROFS},
 	{ERRbadshare, -ETXTBSY},
 	{ERRlock, -EACCES},
 	{ERRunsup, -EINVAL},
fs/cifs/smberr.h +1 -0
index c5084d2..7f16cb8 100644
@@ -76,6 +76,7 @@
 #define ERRnofiles		18	/* A File Search command can find no
 					   more files matching the specified
 					   criteria. */
+#define ERRwriteprot		19	/* media is write protected */
 #define ERRgeneral		31
 #define ERRbadshare		32	/* The sharing mode specified for an
 					   Open conflicts with existing FIDs on
Signature · 1 line
1.7.1.1

A message that is not in the archive (sent off-list or not yet received): 1280154598-29628-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

#2 lore raw

PATCH 2/2 cifs: ignore the "mand", "nomand" and "_netdev" mount options

These are all handled by the userspace mount programs, but older versions of mount.cifs also handed them off to the kernel. Ignore them.

---
 fs/cifs/connect.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
fs/cifs/connect.c +6 -0
index d91a608..85a994c 100644
@@ -1264,6 +1264,12 @@ cifs_parse_mount_options(char *options, const char *devname,
 		} else if ((strnicmp(data, "nocase", 6) == 0) ||
 			   (strnicmp(data, "ignorecase", 10)  == 0)) {
 			vol->nocase = 1;
+		} else if (strnicmp(data, "mand", 4) == 0) {
+			/* ignore */
+		} else if (strnicmp(data, "nomand", 6) == 0) {
+			/* ignore */
+		} else if (strnicmp(data, "_netdev", 7) == 0) {
+			/* ignore */
 		} else if (strnicmp(data, "brl", 3) == 0) {
 			vol->nobrl =  0;
 		} else if ((strnicmp(data, "nobrl", 5) == 0) ||
Signature · 1 line
1.7.1.1
#3 lore raw
In reply to a message not in the archive
Quoted 1 line · Jeff Layton

Seems like a more sensible mapping than -EIO.

I agree. Also helps common case of Samba exporting read only shares by default.

Quoted 34 lines

---
 fs/cifs/netmisc.c |    1 +
 fs/cifs/smberr.h  |    1 +

 2 files changed, 2 insertions(+), 0 deletions(-)
fs/cifs/netmisc.c +1 -0
index 3489468..c6721ee 100644
@@ -61,6 +61,7 @@ static const struct smb_to_posix_error mapping_table_ERRDOS[] = {
        {ERRremcd, -EACCES},
        {ERRdiffdevice, -EXDEV},
        {ERRnofiles, -ENOENT},
+       {ERRwriteprot, -EROFS},
        {ERRbadshare, -ETXTBSY},
        {ERRlock, -EACCES},
        {ERRunsup, -EINVAL},
fs/cifs/smberr.h +0 -0
index c5084d2..7f16cb8 100644
@@ -76,6 +76,7 @@
  #define ERRnofiles             18      /* A File Search command can find no

                                          more files matching the specified criteria. */
+#define ERRwriteprot           19      /* media is write protected */ #define ERRgeneral             31
 #define ERRbadshare            32      /* The sharing mode specified for an Open conflicts with existing FIDs on --
1.7.1.1

Signature · 3 lines
Thanks,

Steve