From: Dmitry Monakhov <dmonakhov@openvz.org>
To: linux-fsdevel@vger.kernel.org
Cc: jack@suse.cz, hch@infradead.org, sandeen@redhat.com,
Dmitry Monakhov <dmonakhov@openvz.org>
Subject: [PATCH 5/6] ext4: handle errors in orphan_cleanup
Date: Thu, 8 Apr 2010 22:04:24 +0400 [thread overview]
Message-ID: <1270749865-25441-6-git-send-email-dmonakhov@openvz.org> (raw)
In-Reply-To: <1270749865-25441-5-git-send-email-dmonakhov@openvz.org>
Orphan cleanup procedure is complex task and may fail due to number
of reasons. Handle errors from orphan_cleanp according to
predefined per-sb errors behavior flags.
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
---
fs/ext4/super.c | 30 ++++++++++++++++++++++--------
1 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index edcf3b0..230b71c 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1873,23 +1873,24 @@ static int ext4_check_descriptors(struct super_block *sb)
* e2fsck was run on this filesystem, and it must have already done the orphan
* inode cleanup for us, so we can safely abort without any further action.
*/
-static void ext4_orphan_cleanup(struct super_block *sb,
+static int ext4_orphan_cleanup(struct super_block *sb,
struct ext4_super_block *es)
{
unsigned int s_flags = sb->s_flags;
int nr_orphans = 0, nr_truncates = 0;
+ int ret = 0;
#ifdef CONFIG_QUOTA
int i;
#endif
if (!es->s_last_orphan) {
jbd_debug(4, "no orphan inodes to clean up\n");
- return;
+ return 0;
}
if (bdev_read_only(sb->s_bdev)) {
ext4_msg(sb, KERN_ERR, "write access "
"unavailable, skipping orphan cleanup");
- return;
+ return 0;
}
if (EXT4_SB(sb)->s_mount_state & EXT4_ERROR_FS) {
@@ -1898,7 +1899,7 @@ static void ext4_orphan_cleanup(struct super_block *sb,
"clearing orphan list.\n");
es->s_last_orphan = 0;
jbd_debug(1, "Skipping orphan recovery on fs with errors.\n");
- return;
+ return 0;
}
if (s_flags & MS_RDONLY) {
@@ -1911,11 +1912,14 @@ static void ext4_orphan_cleanup(struct super_block *sb,
/* Turn on quotas so that they are updated correctly */
for (i = 0; i < MAXQUOTAS; i++) {
if (EXT4_SB(sb)->s_qf_names[i]) {
- int ret = ext4_quota_on_mount(sb, i);
- if (ret < 0)
+ ret = ext4_quota_on_mount(sb, i);
+ if (ret < 0) {
ext4_msg(sb, KERN_ERR,
"Cannot turn on journaled "
"quota: error %d", ret);
+ if (!test_opt (sb, ERRORS_CONT))
+ goto out;
+ }
}
}
#endif
@@ -1951,13 +1955,16 @@ static void ext4_orphan_cleanup(struct super_block *sb,
}
#define PLURAL(x) (x), ((x) == 1) ? "" : "s"
-
+out:
if (nr_orphans)
ext4_msg(sb, KERN_INFO, "%d orphan inode%s deleted",
PLURAL(nr_orphans));
if (nr_truncates)
ext4_msg(sb, KERN_INFO, "%d truncate%s cleaned up",
PLURAL(nr_truncates));
+ if (ret)
+ ext4_msg(sb, KERN_ERR, "Error %d wile orphan cleanup", ret);
+
#ifdef CONFIG_QUOTA
/* Turn quotas off */
for (i = 0; i < MAXQUOTAS; i++) {
@@ -1966,6 +1973,7 @@ static void ext4_orphan_cleanup(struct super_block *sb,
}
#endif
sb->s_flags = s_flags; /* Restore MS_RDONLY status */
+ return ret;
}
/*
@@ -2915,7 +2923,13 @@ no_journal:
};
EXT4_SB(sb)->s_mount_state |= EXT4_ORPHAN_FS;
- ext4_orphan_cleanup(sb, es);
+ ret = ext4_orphan_cleanup(sb, es);
+ if (err) {
+ ext4_mb_release(sb);
+ ext4_ext_release(sb);
+ goto failed_mount4;
+ }
+
EXT4_SB(sb)->s_mount_state &= ~EXT4_ORPHAN_FS;
if (needs_recovery) {
ext4_msg(sb, KERN_INFO, "recovery complete");
--
1.6.6.1
next prev parent reply other threads:[~2010-04-08 18:05 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-08 18:04 [PATCH 0/6] RFC quota: Redesign IO error handling interface Dmitry Monakhov
2010-04-08 18:04 ` [PATCH 1/6] quota: unify quota init condition in setattr Dmitry Monakhov
2010-04-08 18:04 ` [PATCH 2/6] quota: Add proper error handling on quota initialization Dmitry Monakhov
2010-04-08 18:04 ` [PATCH 3/6] quota: Check what quota is properly initialized for inode before charge Dmitry Monakhov
2010-04-08 18:04 ` [PATCH 4/6] ext3: handle errors in orphan_cleanup Dmitry Monakhov
2010-04-08 18:04 ` Dmitry Monakhov [this message]
2010-04-08 18:04 ` [PATCH 6/6] quota: check error code from dquot_initialize Dmitry Monakhov
2010-05-07 17:01 ` Jan Kara
2010-05-07 16:59 ` [PATCH 4/6] ext3: handle errors in orphan_cleanup Jan Kara
2010-05-07 16:48 ` [PATCH 3/6] quota: Check what quota is properly initialized for inode before charge Jan Kara
2010-05-17 6:22 ` Dmitry Monakhov
2010-05-07 16:44 ` [PATCH 2/6] quota: Add proper error handling on quota initialization Jan Kara
2010-05-07 16:39 ` [PATCH 1/6] quota: unify quota init condition in setattr Jan Kara
2010-05-13 16:29 ` Jan Kara
2010-05-05 8:45 ` [PATCH 0/6] RFC quota: Redesign IO error handling interface Dmitry Monakhov
2010-05-07 16:38 ` Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1270749865-25441-6-git-send-email-dmonakhov@openvz.org \
--to=dmonakhov@openvz.org \
--cc=hch@infradead.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=sandeen@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).