Messages in this thread | | | Date | Tue, 24 Oct 2006 21:38:40 +0100 | From | Christoph Hellwig <> | Subject | Re: [PATCH] Freeze bdevs when freezing processes. |
| |
> +/* > + * Done after userspace is frozen, so there should be no danger of > + * fses being unmounted while we're in here. > + */ > +int freezer_make_fses_ro(void)
This should be called freeze_filesystems() or something along the line. I also wonder whether it should be next to freeze_bdev instead of in the suspend code.
> +{ > + struct frozen_fs *fs; > + struct super_block *sb; > + > + /* Generate the list */ > + list_for_each_entry(sb, &super_blocks, s_list) { > + if (!sb->s_root || !sb->s_bdev || > + (sb->s_frozen == SB_FREEZE_TRANS) || > + (sb->s_flags & MS_RDONLY)) > + continue; > + > + fs = kmalloc(sizeof(struct frozen_fs), GFP_ATOMIC); > + if (!fs) > + return 1; > + fs->sb = sb; > + list_add_tail(&fs->fsb_list, &frozen_fs_list); > + }; > + > + /* Do the freezing in reverse order so filesystems dependant > + * upon others are frozen in the right order. (Eg loopback > + * on ext3). */ > + list_for_each_entry_reverse(fs, &frozen_fs_list, fsb_list) > + freeze_bdev(fs->sb->s_bdev);
I'd rather avoid this local list and operate directly on the super_blocks lists. To do that we'd need another flag in the superblock to flag a filesystem as suspended by this routine, which seems just fine.
void freeze_filesystems(void) { /* * Freeze in reverse order so filesystems dependant * upon others are frozen in the right order. * (E.g. loopback on ext3). */ list_for_each_entry_reverse(fs, &super_blocks, fsb_list) { if (!sb->s_root || !sb->s_bdev || (sb->s_frozen == SB_FREEZE_TRANS) || (sb->s_flags & MS_RDONLY)) continue; freeze_bdev(sb->s_bdev); sb->s_flags &= MS_SUSPENDED; // XXX find protection for s_flags } } - 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/
| |