diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2010-09-19 11:34:26 -0400 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2010-09-19 14:07:58 -0400 |
commit | 2ef13294d29bcfb306e0d360f1b97f37b647b0c0 (patch) | |
tree | 877e1ece00c14de0f0d79e86b6480d284d309216 /fs/ubifs/misc.h | |
parent | 2680d722bf2c5f75225dd9acb3ec9e5a9e2652f4 (diff) |
UBIFS: introduce new flags for RO mounts
Commit 2fde99cb55fb9d9b88180512a5e8a5d939d27fec "UBIFS: mark VFS SB RO too"
introduced regression. This commit made UBIFS set the 'MS_RDONLY' flag in the
VFS superblock when it switches to R/O mode due to an error. This was done
to make VFS show the R/O UBIFS flag in /proc/mounts.
However, several places in UBIFS relied on the 'MS_RDONLY' flag and assume this
flag can only change when we re-mount. For example, 'ubifs_put_super()'.
This patch introduces new UBIFS flag - 'c->ro_mount' which changes only when
we re-mount, and preserves the way UBIFS was originally mounted (R/W or R/O).
This allows us to de-initialize UBIFS cleanly in 'ubifs_put_super()'.
This patch also changes all 'ubifs_assert(!c->ro_media)' assertions to
'ubifs_assert(!c->ro_media && !c->ro_mount)', because we never should write
anything if the FS was mounter R/O.
All the places where we test for 'MS_RDONLY' flag in the VFS SB were changed
and now we test the 'c->ro_mount' flag instead, because it preserves the
original UBIFS mount type, unlike the 'MS_RDONLY' flag.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/misc.h')
-rw-r--r-- | fs/ubifs/misc.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/ubifs/misc.h b/fs/ubifs/misc.h index 5d476ba184e6..c3de04dc952a 100644 --- a/fs/ubifs/misc.h +++ b/fs/ubifs/misc.h | |||
@@ -132,7 +132,7 @@ static inline int ubifs_leb_unmap(const struct ubifs_info *c, int lnum) | |||
132 | { | 132 | { |
133 | int err; | 133 | int err; |
134 | 134 | ||
135 | ubifs_assert(!c->ro_media); | 135 | ubifs_assert(!c->ro_media && !c->ro_mount); |
136 | if (c->ro_error) | 136 | if (c->ro_error) |
137 | return -EROFS; | 137 | return -EROFS; |
138 | err = ubi_leb_unmap(c->ubi, lnum); | 138 | err = ubi_leb_unmap(c->ubi, lnum); |
@@ -160,7 +160,7 @@ static inline int ubifs_leb_write(const struct ubifs_info *c, int lnum, | |||
160 | { | 160 | { |
161 | int err; | 161 | int err; |
162 | 162 | ||
163 | ubifs_assert(!c->ro_media); | 163 | ubifs_assert(!c->ro_media && !c->ro_mount); |
164 | if (c->ro_error) | 164 | if (c->ro_error) |
165 | return -EROFS; | 165 | return -EROFS; |
166 | err = ubi_leb_write(c->ubi, lnum, buf, offs, len, dtype); | 166 | err = ubi_leb_write(c->ubi, lnum, buf, offs, len, dtype); |
@@ -188,7 +188,7 @@ static inline int ubifs_leb_change(const struct ubifs_info *c, int lnum, | |||
188 | { | 188 | { |
189 | int err; | 189 | int err; |
190 | 190 | ||
191 | ubifs_assert(!c->ro_media); | 191 | ubifs_assert(!c->ro_media && !c->ro_mount); |
192 | if (c->ro_error) | 192 | if (c->ro_error) |
193 | return -EROFS; | 193 | return -EROFS; |
194 | err = ubi_leb_change(c->ubi, lnum, buf, len, dtype); | 194 | err = ubi_leb_change(c->ubi, lnum, buf, len, dtype); |