Re: [RFC] write_super is for syncing

Hugh Dickins (hugh@veritas.com)
Wed, 13 Mar 2002 20:49:15 +0000 (GMT)


On Tue, 12 Mar 2002, Chris Mason wrote:
>
> But, the loop in sync_supers(dev == 0) is harder, it expects
> some flag it can check, and it expects the callback to the FS
> will clear that flag. Adding a new flag seemed like more fun
> than redoing the locking and super walk. I'm curious to hear what
> Al thinks of it though.

Sorry if this is irrelevant to your case (wasn't following the thread),
but we noticed that repeatedly-restarting sync_supers() loop some while
back. Would this patch help?

Hugh

--- 2.4.19-pre3/fs/super.c Tue Mar 12 02:16:52 2002
+++ linux/fs/super.c Wed Mar 13 20:27:54 2002
@@ -398,6 +398,7 @@
struct file_system_type *fs = s->s_type;

spin_lock(&sb_lock);
+ s->s_type = NULL;
list_del(&s->s_list);
list_del(&s->s_instances);
spin_unlock(&sb_lock);
@@ -461,19 +462,25 @@
}
return;
}
-restart:
spin_lock(&sb_lock);
+restart:
sb = sb_entry(super_blocks.next);
- while (sb != sb_entry(&super_blocks))
+ while (sb != sb_entry(&super_blocks)) {
if (sb->s_dirt) {
sb->s_count++;
spin_unlock(&sb_lock);
down_read(&sb->s_umount);
write_super(sb);
- drop_super(sb);
- goto restart;
- } else
- sb = sb_entry(sb->s_list.next);
+ up_read(&sb->s_umount);
+ spin_lock(&sb_lock);
+ if (!--sb->s_count) {
+ destroy_super(sb);
+ goto restart;
+ } else if (!sb->s_type)
+ goto restart;
+ }
+ sb = sb_entry(sb->s_list.next);
+ }
spin_unlock(&sb_lock);
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/