~vcs-imports/btrfs-tools/unstable

Viewing all changes in revision 1286.

  • Committer: David Sterba
  • Author(s): Gui Hecheng
  • Date: 2014-08-22 14:09:55 UTC
  • Revision ID: git-v1:3db4c0a3d35dd5f81a4c1d405ef7f3ca3357ae03
btrfs-progs: add ask_user confirmation for btrfstune clear seeding flag

If we do the following:
        # mkfs.btrfs -f <dev>
        # mount <dev> <mnt>
        # dd if=/dev/urandom of=<mnt>/data bs=1M count=100
        # umount <dev>
        # btrfstune -S 1 <dev>            <--- make seeding device
        # mount <dev> <mnt>
        # btrfs dev add -f <dev2> <mnt>
        # umount <dev>
        # btrfstune -S 0 <dev>            <--- clear seeding flag
        # mount <dev2> <mnt>                <=== new device not mountable

When mounting the new device, btrfs will check whether
the seeding flag is set when try to open seeding device.
If the user clears the seeding flag of the seeding device,
the new device will not be mountable. Even set the seeding
flag back will not recovery this problem, because the generation
has been changed. So clear the seeding flag has the chance to
damage the derived new fs.

So I add user confirmation check when clearing seeding flag.

Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: