summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-01-29 17:22:54 +0300
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2009-01-29 17:22:54 +0300
commita2b9df3ff691db8e5e521dccd231a8098bbf7416 (patch)
tree50a12bd4d40a27d7a605aa55e3d770b4af3c8576 /fs
parentb466f17d780c5b72427f36aef22ecdec9f1d0689 (diff)
downloadlinux-a2b9df3ff691db8e5e521dccd231a8098bbf7416.tar.xz
UBIFS: return sensible error codes
When mounting/re-mounting, UBIFS returns EINVAL even if the ENOSPC or EROFS codes are are much better, just because we have not found references to ENOSPC/EROFS in mount (2) man pages. This patch changes this behaviour and makes UBIFS return real error code, because: 1. It is just less confusing and more logical 2. mount is not described in SuSv3, so it seems to be not really well-standartized 3. we do not cover all cases, and any random undocumented in man pages error code may be returned anyway Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/ubifs/master.c2
-rw-r--r--fs/ubifs/super.c11
2 files changed, 4 insertions, 9 deletions
diff --git a/fs/ubifs/master.c b/fs/ubifs/master.c
index 71d5493bf565..a88f33801b98 100644
--- a/fs/ubifs/master.c
+++ b/fs/ubifs/master.c
@@ -354,7 +354,7 @@ int ubifs_write_master(struct ubifs_info *c)
int err, lnum, offs, len;
if (c->ro_media)
- return -EINVAL;
+ return -EROFS;
lnum = UBIFS_MST_LNUM;
offs = c->mst_offs + c->mst_node_alsz;
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index daa679d3a03e..ab85eb8cce79 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1085,12 +1085,7 @@ static int check_free_space(struct ubifs_info *c)
ubifs_err("insufficient free space to mount in read/write mode");
dbg_dump_budg(c);
dbg_dump_lprops(c);
- /*
- * We return %-EINVAL instead of %-ENOSPC because it seems to
- * be the closest error code mentioned in the mount function
- * documentation.
- */
- return -EINVAL;
+ return -ENOSPC;
}
return 0;
}
@@ -1790,7 +1785,7 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data)
if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) {
if (c->ro_media) {
ubifs_msg("cannot re-mount due to prior errors");
- return -EINVAL;
+ return -EROFS;
}
err = ubifs_remount_rw(c);
if (err)
@@ -1798,7 +1793,7 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data)
} else if (!(sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY)) {
if (c->ro_media) {
ubifs_msg("cannot re-mount due to prior errors");
- return -EINVAL;
+ return -EROFS;
}
ubifs_remount_ro(c);
}