[CRIU] [PATCH 1/3] fsnotify: Add ability to force resolve paths for watchees
Pavel Emelyanov
xemul at parallels.com
Mon Nov 2 07:51:42 PST 2015
On 10/30/2015 04:16 PM, Cyrill Gorcunov wrote:
> 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, when user know that he is migrating and prefer
> a flexible scheme -- we try to resolve file handle into
> a path and use it instead on the restore (just like
> for tmpfs/devtmpfs).
>
> https://jira.sw.ru/browse/PSBM-40871
>
> Reported-by: Nikita Spiridonov <nspiridonov at odin.com>
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
> crtools.c | 5 +++++
> fsnotify.c | 11 +++++++++--
> include/cr_options.h | 1 +
> 3 files changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/crtools.c b/crtools.c
> index d3812a18f4f0..243d90188ac8 100644
> --- a/crtools.c
> +++ b/crtools.c
> @@ -253,6 +253,7 @@ int main(int argc, char *argv[], char *envp[])
> { "freeze-cgroup", required_argument, 0, 1068 },
> { "ghost-limit", required_argument, 0, 1069 },
> { "irmap-scan-path", required_argument, 0, 1070 },
> + { "force-inotify-path", required_argument, 0, 1071 },
One more option is excessive here. There are 3 big blocks that are in the
game here -- get inode handle, try to get the inode name, force FS scan to
get the inode name. And the 2nd block is must-have for TMPFS or (with this
patch) option. I propose to remove the option and make soft path lookup
happen always, but only to fail the dump for TMPFS-s. The forced FS scan
should a) be performed iff the soft path resolve failed and b) still be
under option, which should be turned on by p.haul rsync driver.
-- Pavel
> { },
> };
>
> @@ -498,6 +499,9 @@ int main(int argc, char *argv[], char *envp[])
> if (irmap_scan_path_add(optarg))
> return -1;
> break;
> + case 1071:
> + opts.force_inotify_path = true;
> + break;
> case 'M':
> {
> char *aux;
> @@ -727,6 +731,7 @@ usage:
> " -l|--" OPT_FILE_LOCKS " handle file locks, for safety, only used for container\n"
> " -L|--libdir path to a plugin directory (by default " CR_PLUGIN_DEFAULT ")\n"
> " --force-irmap force resolving names for inotify/fsnotify watches\n"
> +" --force-inotify-path force inotify/fsnotify watches to carry paths (for migration)\n"
> " --irmap-scan-path FILE\n"
> " add a path the irmap hints to scan\n"
> " -M|--ext-mount-map KEY:VALUE\n"
> diff --git a/fsnotify.c b/fsnotify.c
> index 9629977de8bc..57077a974562 100644
> --- a/fsnotify.c
> +++ b/fsnotify.c
> @@ -241,9 +241,16 @@ 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.
> + *
> + * Moreover, when we're migrating to another filesystem
> + * previously say sync'ed its contents, the device may
> + * be changed so on restore we won't be able to lookup
> + * for same hardcoded @s_dev. So carry a path if user
> + * requested.
> */
> - if ((mi->fstype->code == FSTYPE__TMPFS) ||
> - (mi->fstype->code == FSTYPE__DEVTMPFS)) {
> + if ((mi->fstype->code == FSTYPE__TMPFS) ||
> + (mi->fstype->code == FSTYPE__DEVTMPFS) ||
> + opts.force_inotify_path) {
> 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",
> diff --git a/include/cr_options.h b/include/cr_options.h
> index eac7283a4821..f655ad09e195 100644
> --- a/include/cr_options.h
> +++ b/include/cr_options.h
> @@ -84,6 +84,7 @@ struct cr_options {
> bool auto_dedup;
> unsigned int cpu_cap;
> bool force_irmap;
> + bool force_inotify_path;
> char **exec_cmd;
> unsigned int manage_cgroups;
> char *new_global_cg_root;
>
More information about the CRIU
mailing list