lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20061024203840.GA14736@infradead.org>
Date:	Tue, 24 Oct 2006 21:38:40 +0100
From:	Christoph Hellwig <hch@...radead.org>
To:	Nigel Cunningham <ncunningham@...uxmail.org>
Cc:	Andrew Morton <akpm@...l.org>, "Rafael J. Wysocki" <rjw@...k.pl>,
	LKML <linux-kernel@...r.kernel.org>
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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ