From: Michael Trimarchi <trimarchimichael@yahoo.it>
To: dwmw2@infradead.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] Force remount read-only of jffs2 when the garbage collector dies
Date: Mon, 21 Apr 2008 16:31:35 +0000 (GMT) [thread overview]
Message-ID: <831534.91220.qm@web26206.mail.ukl.yahoo.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 122 bytes --]
Inviato da Yahoo! Mail.
La casella di posta intelligente.
http://it.docs.yahoo.com/mail/overview/index.html
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: force-remount-readonly-jffs2.patch --]
[-- Type: text/x-patch; name="force-remount-readonly-jffs2.patch", Size: 1304 bytes --]
[PATCH] Force remount read-only of jffs2 when the garbage collector dies
Signed-off-by: Michael Trimarchi <michael@evidence.eu.com>
---
fs/jffs2/background.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/fs/jffs2/background.c b/fs/jffs2/background.c
index 8adebd3..669b35e 100644
--- a/fs/jffs2/background.c
+++ b/fs/jffs2/background.c
@@ -70,6 +70,7 @@ void jffs2_stop_garbage_collect_thread(struct jffs2_sb_info *c)
static int jffs2_garbage_collect_thread(void *_c)
{
struct jffs2_sb_info *c = _c;
+ struct super_block *sb;
daemonize("jffs2_gcd_mtd%d", c->mtd->index);
allow_signal(SIGKILL);
@@ -145,5 +146,25 @@ static int jffs2_garbage_collect_thread(void *_c)
spin_lock(&c->erase_completion_lock);
c->gc_task = NULL;
spin_unlock(&c->erase_completion_lock);
+
+ sb = c->os_priv;
+ BUG_ON(sb == NULL);
+
+ /* The garbage collect is died. Try to remount the fs
+ * read-only
+ */
+ down_read(&sb->s_umount);
+ if (sb->s_root && sb->s_mtd && !(sb->s_flags & MS_RDONLY)) {
+ /*
+ * ->remount_fs needs lock_kernel().
+ *
+ * What lock protects sb->s_flags??
+ */
+ lock_kernel();
+ do_remount_sb(sb, MS_RDONLY, NULL, 1);
+ unlock_kernel();
+ }
+ drop_super(sb);
+
complete_and_exit(&c->gc_thread_exit, 0);
}
--
1.5.3.6
next reply other threads:[~2008-04-21 16:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-21 16:31 Michael Trimarchi [this message]
2008-04-21 17:29 ` Josh Boyer
2008-04-21 18:52 ` David Woodhouse
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=831534.91220.qm@web26206.mail.ukl.yahoo.com \
--to=trimarchimichael@yahoo.it \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®