1. 21 Apr, 2015 9 commits
  2. 16 Apr, 2015 4 commits
  3. 14 Apr, 2015 15 commits
  4. 10 Apr, 2015 12 commits
    • Oleg Nesterov's avatar
      make resolve_source() more friendly to FSTYPE__AUTO mounts · 323726b7
      Oleg Nesterov authored
      resolve_source() insists on kdev_major() == 0, and this makes sense.
      However, at least FSTYPE__AUTO can try to use mi->source as a block
      device and pray it will work.
      
      [ Also bout this change from Oleg:
      
      Let me send another (last) functional change before the promised
      cleanups we discussed.
      
      To remind, without this patch I still can't dump/restore /home and
      /boot on my testing machine. --enable-fs xfs "works" in a sense that
      "dump" succeeds. But "restore" fails.
      
      However. Lets forget this for the moment. To me resolve_source() looks
      just wrong. Sure, I agree, it is not safe to blindly use mi->source if
      kdev_major() != 0. But this means that we should not have dumped this
      mountpoint, simply because we can't restore it.
      
      Yes, currently this works because fstypes[] contains only the diskless
      filesystems, but still.
      
      So this probably needs more cleanups too, and this patch doesn't make
      this logic look better.
      
      To me, we should do something like
      
      	static char *resolve_source(struct mount_info *mi)
      	{
      		if (kdev_major(mi->s_dev) == 0)
      			/*
      			 * Anonymous block device. Kernel creates them for
      			 * diskless mounts.
      			 */
      			return mi->source;
      
      		if (mi->fstype->code != FSTYPE__AUTO) {
      			pr_err("OOPS! something is wrong!!!\n");
      			return NULL;
      		}
      
      		// OK, this is FSTYPE__AUTO, it should "just work"
      		// by definition. Or the user should blame himself.
      
      		struct stat st;
      
      		if (stat(mi->source, &st) || !S_ISBLK(st.st_mode) ||
      		    major(st.st_rdev) != kdev_major(mi->s_dev) ||
      		    minor(st.st_rdev) != kdev_minor(mi->s_dev))
      			pr_warn("Hmm, can't verify blkdev. Lets see if mount will work...\n");
      
      		return mi->source;
      	}
      
      But this patch only does a minimal change to make FSTYPE__AUTO work
      with blkdev.
      
      ]
      Signed-off-by: 's avatarOleg Nesterov <oleg@redhat.com>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
      323726b7
    • Pavel Emelyanov's avatar
      test: Add test for ext-mount-map option · 2085e078
      Pavel Emelyanov authored
      It mostly reuses the infrastructure for plugin testing.
      Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
      2085e078
    • Pavel Emelyanov's avatar
      test: Rework the ext mount plugin test · ec5b0d84
      Pavel Emelyanov authored
      The existing set of shell scripts do hard-to-debug things and mess
      with the root filesystem. We can make it better.
      
      First, not to play with the system / the process that will be run in
      a new mount namespace is statically compiled .c file. And this "init"
      does a very simple thing -- waits for SIGTERM and check that the
      given filepath contains the given string.
      
      Second, the namespace's root will be some subdir, instead of system
      / bind-mount-ed into a subdir. This makes it easier to keep things
      together and makes 100% sure the external bind mount cannot be
      accessed by custom path.
      Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
      ec5b0d84
    • Tycho Andersen's avatar
      b508ebcb
    • Tycho Andersen's avatar
    • Tycho Andersen's avatar
      mnt: add --enable-external-masters option · fcae4f39
      Tycho Andersen authored
      This option enables external (slave) bind mounts to be resolved.
      
      v2: don't always assume that when the master id matches, the mounts match
      Signed-off-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
      fcae4f39
    • Tycho Andersen's avatar
      mnt: add --enable-external-sharing flag · 0afffc9d
      Tycho Andersen authored
      With this flag, external shared bind mounts are attempted to be resolved
      automatically.
      
      v2: don't always assume when the sharing matches that the mount matches
      Signed-off-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
      0afffc9d
    • Tycho Andersen's avatar
      mnt: add --ext-mount-map auto option · aebfabb5
      Tycho Andersen authored
      When this option is specified, if an external (private) bind mount is not
      specified by --ext-mount-map KEY:VAL then it is attempted to be resolved
      automatically.
      
      v2: introduce find_best_external_match, which looks for the best match based on
          sharing/slave ids; don't try to resolve fsroot_mounted() mountpoints
      v3: get rid of really_collect_self_mounts
      v4: get rid of fsroot_mounted() check when autodetecting external mounts
      Signed-off-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
      aebfabb5
    • Oleg Nesterov's avatar
      introduce --enable-fs cli option · e2c38245
      Oleg Nesterov authored
      Finally add --enable-fs option to specify the comma separated list of
      filesystem names which should be treated as FSTYPE_AUTO.
      
      Note: obviously this option is not safe, use at your own risk. "dump"
      will always succeed if the mntpoint is auto, but "restore" can fail or
      do something wrong if mount(src, mountpoint, flags, options) can not
      actually "just work" as FSTYPE_AUTO logic expects.
      Signed-off-by: 's avatarOleg Nesterov <oleg@redhat.com>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
      e2c38245
    • Oleg Nesterov's avatar
      dump/restore fstype->name if FSTYPE__AUTO · eaf3a03c
      Oleg Nesterov authored
      Add the new mnt_entry->fsname member and change dump_one_mountpoint()
      to save pm->fstype->name if fstype == FSTYPE__AUTO.
      
      Change collect_mnt_from_image() to pass this ->fsname to decode_fstype()
      which falls back to __find_fstype_by_name(fsname, true) if FSTYPE__AUTO.
      Signed-off-by: 's avatarOleg Nesterov <oleg@redhat.com>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
      eaf3a03c
    • Oleg Nesterov's avatar
      introduce __fsname_is_auto(name, force_auto) · 039cf95d
      Oleg Nesterov authored
      Simple preparation to simplify the review of the next patch. Turn
      find_fstype_by_name(name) into __find_fstype_by_name(name, force_auto)
      and reimplement find_fstype_by_name() as a trivial wrapper on top.
      
      This allows "restore" to specify that this particular fsname was treated
      as FSTYPE__AUTO by "dump".
      Signed-off-by: 's avatarOleg Nesterov <oleg@redhat.com>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
      039cf95d
    • Oleg Nesterov's avatar
      introduce fsname_is_auto(name) and FSTYPE__AUTO · 38e148e5
      Oleg Nesterov authored
      The comment in find_fstype_by_name() says:
      
      	just mounting anything is wrong
      
      and this is true in general, but:
      
      	almost every fs has its own features
      
      this is not true in a sense that a lot of supported filesystems do not
      need any special processing: FSTYPE__PROC, FSTYPE__SYSFS, and more. More
      importantly, this logic does not allow to spicify from the command line
      that (say) currently unsupported hugetlbfs can "just work", do_new_mount()
      should only pass the right name/options.
      
      This patch adds the new FSTYPE__AUTO code, find_fstype_by_name(name) adds
      the new entry if fsname_is_auto(name) returns true. We do not care that
      different fstype's can have the same FSTYPE__AUTO code, fstype->code has
      no meaning unless we need to do something special with this fs, but in
      this case it should not be FSTYPE__AUTO by definition.
      
      Note: currently find_fstype_by_name() just returns true, it is obviously
      pointless to "dump" until we teach "restore" to handle FSTYPE__AUTO.
      Signed-off-by: 's avatarOleg Nesterov <oleg@redhat.com>
      Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
      38e148e5