Force remount read-only of jffs2 when the garbage collector dies
PATCH 1/1 Force remount read-only of jffs2 when the garbage collector dies
Inviato da Yahoo! Mail.
La casella di posta intelligente.
http://it.docs.yahoo.com/mail/overview/index.html
[PATCH] Force remount read-only of jffs2 when the garbage collector dies
Signed-off-by Michael Trimarchi <[email protected]>
--- fs/jffs2/background.c | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-)
fs/jffs2/background.c +21 -0
@@ -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 ); }
Signature · 1 line
1.5.3.6
Quoted 4 lines · Michael Trimarchi
[PATCH] Force remount read-only of jffs2 when the garbage collector dies
Signed-off-by Michael Trimarchi <[email protected]>
Why would you do this? The garbage collect thread is an optimization, not a requirement. Garbage collection will occur as-needed on behalf of whichever process forces the requirement.
josh
Quoted 48 lines
--- fs/jffs2/background.c | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-)fs/jffs2/background.c +1
-0@@ -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);fs/jffs2/background.c +20
-0@@ -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 ); }Signature · 1 line
1.5.3.6
David Woodhouse
maintainerQuoted 3 lines · Michael Trimarchi
Inviato da Yahoo! Mail.
La casella di posta intelligente.
http://it.docs.yahoo.com/mail/overview/index.html
NAK. The garbage collector is purely an optimisation; we don't need it for read-write operation.
Signature · 1 line
dwmw2