[CRIU] [PATCH 5/7] sk-unix: Don't fail if socket path lays on btrfs volume
Pavel Emelyanov
xemul at parallels.com
Wed Dec 4 05:51:33 PST 2013
On 12/04/2013 05:23 PM, Cyrill Gorcunov wrote:
>
> Because socket migh lay on btrfs volume (thus the device
> number reported by diag module won't be the same as obtained
> from stat(2)) we need to do an additional test and try
> to resolve device number with help of btrfs engine.
>
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
> sk-unix.c | 22 +++++++++++++++++++++-
> 1 file changed, 21 insertions(+), 1 deletion(-)
>
> + udiag_vfs_dev = kdev_to_odev(uv->udiag_vfs_dev);
> + if (st.st_dev != udiag_vfs_dev) {
> + if (btrfs_lazy_parse_subvol(udiag_vfs_dev))
> + goto err;
> + if (is_btrfs_subvol(udiag_vfs_dev, st.st_dev)) {
> + pr_info("unix: liftup btrfs dev %lx -> %lx\n",
> + (long)st.st_dev, (long)udiag_vfs_dev);
> + st.st_dev = udiag_vfs_dev;
> + }
> + }
This is way too complex. Why no
- if (st.st_dev != dev)
+ if (phys_stat_dev_match(st.st_dev, dev)
in all the places including ghosts and inotifies, where
bool phys_stat_dev_match(dev_t st_dev, dev_t phys_dev)
{
struct mount_info *mi;
if (st_dev == phys_dev)
return true;
/*
* comment here about btrfs devs screwup
*/
mi = lookup_mnt_sdev(phys_dev);
if (!mi)
/* no mountpoint with this device */
return false;
if (strcmp(mi->kfstype, "btrfs"))
/* not btrfs -- no match */
return false;
if (!mi->private)
btrfs_lazy_parse_subvol(mi);
return is_btrfs_subvol(mi->private, st_dev);
}
More information about the CRIU
mailing list