diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2009-01-29 09:22:54 -0500 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2009-01-29 09:22:54 -0500 |
commit | a2b9df3ff691db8e5e521dccd231a8098bbf7416 (patch) | |
tree | 50a12bd4d40a27d7a605aa55e3d770b4af3c8576 /fs/ubifs/super.c | |
parent | b466f17d780c5b72427f36aef22ecdec9f1d0689 (diff) |
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/ubifs/super.c')
-rw-r--r-- | fs/ubifs/super.c | 11 |
1 files changed, 3 insertions, 8 deletions
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) | |||
1085 | ubifs_err("insufficient free space to mount in read/write mode"); | 1085 | ubifs_err("insufficient free space to mount in read/write mode"); |
1086 | dbg_dump_budg(c); | 1086 | dbg_dump_budg(c); |
1087 | dbg_dump_lprops(c); | 1087 | dbg_dump_lprops(c); |
1088 | /* | 1088 | return -ENOSPC; |
1089 | * We return %-EINVAL instead of %-ENOSPC because it seems to | ||
1090 | * be the closest error code mentioned in the mount function | ||
1091 | * documentation. | ||
1092 | */ | ||
1093 | return -EINVAL; | ||
1094 | } | 1089 | } |
1095 | return 0; | 1090 | return 0; |
1096 | } | 1091 | } |
@@ -1790,7 +1785,7 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data) | |||
1790 | if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) { | 1785 | if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) { |
1791 | if (c->ro_media) { | 1786 | if (c->ro_media) { |
1792 | ubifs_msg("cannot re-mount due to prior errors"); | 1787 | ubifs_msg("cannot re-mount due to prior errors"); |
1793 | return -EINVAL; | 1788 | return -EROFS; |
1794 | } | 1789 | } |
1795 | err = ubifs_remount_rw(c); | 1790 | err = ubifs_remount_rw(c); |
1796 | if (err) | 1791 | if (err) |
@@ -1798,7 +1793,7 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data) | |||
1798 | } else if (!(sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY)) { | 1793 | } else if (!(sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY)) { |
1799 | if (c->ro_media) { | 1794 | if (c->ro_media) { |
1800 | ubifs_msg("cannot re-mount due to prior errors"); | 1795 | ubifs_msg("cannot re-mount due to prior errors"); |
1801 | return -EINVAL; | 1796 | return -EROFS; |
1802 | } | 1797 | } |
1803 | ubifs_remount_ro(c); | 1798 | ubifs_remount_ro(c); |
1804 | } | 1799 | } |