Commit 225273c4 authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

fsnotify: Lookup for watchee path before doing irmap

In case of migrating filesystem with nonpersistent inodes\devices
we may hit the case where we successfully dump the container but
on restore we will fail because block device get another id
(while its contents might be fully sinc'ed). In this case we
will try to lookup device from its number carried in image
and fail.

Instead lets do an optimistic approach -- always try to
fetch the watchee path first and if it fails go down
to old scheme where irmap and native handle steps
into account.

https://jira.sw.ru/browse/PSBM-40871Reported-by: 's avatarNikita Spiridonov <nspiridonov@odin.com>
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 7e862bb3
......@@ -239,18 +239,25 @@ int check_open_handle(unsigned int s_dev, unsigned long i_ino,
}
/*
* Inode numbers are not restored for tmpfs content, but we can
* get file names, becasue tmpfs cache is not pruned.
* Always try to fetch watchee path first. There are several reasons:
*
* - tmpfs/devtmps do not save inode numbers between mounts,
* so it is critical to have the complete path under our
* hands for restore purpose;
*
* - in case of migration the inodes might be changed as well
* so the only portable solution is to carry the whole path
* to the watchee inside image.
*/
if ((mi->fstype->code == FSTYPE__TMPFS) ||
(mi->fstype->code == FSTYPE__DEVTMPFS)) {
path = alloc_openable(s_dev, i_ino, f_handle);
if (IS_ERR_OR_NULL(path)) {
pr_err("Can't find suitable path for handle (%d)\n",
(int)PTR_ERR(path));
goto err;
}
path = alloc_openable(s_dev, i_ino, f_handle);
if (!IS_ERR_OR_NULL(path))
goto out;
if ((mi->fstype->code == FSTYPE__TMPFS) ||
(mi->fstype->code == FSTYPE__DEVTMPFS)) {
pr_err("Can't find suitable path for handle (dev %#x ino %#lx): %d\n",
s_dev, i_ino, (int)PTR_ERR(path));
goto err;
}
if (!opts.force_irmap)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment