[CRIU] [PATCH] proc: show mnt_id in fdinfo files
Pavel Emelyanov
xemul at parallels.com
Fri Mar 14 02:29:12 PDT 2014
On 03/14/2014 12:47 PM, Andrey Vagin wrote:
> Currently we don't have a way how to determing from which mount point
> file has been opened. This information is required for proper dumping
> and restoring file descriptos.
This is not complete truth.
The full description is -- due to presence of mount namespaces it's
possible, that two file descriptors are opened using the same paths,
but one fd references mount point from one namespace while the other
fd -- from other namespace. Knowing this is crucial.
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
>
> ---
> fs/proc/fd.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/fs/proc/fd.c b/fs/proc/fd.c
> index 985ea88..f45c34b 100644
> --- a/fs/proc/fd.c
> +++ b/fs/proc/fd.c
> @@ -11,6 +11,7 @@
>
> #include <linux/proc_fs.h>
>
> +#include "../mount.h"
> #include "internal.h"
> #include "fd.h"
>
> @@ -48,8 +49,9 @@ static int seq_show(struct seq_file *m, void *v)
> }
>
> if (!ret) {
> - seq_printf(m, "pos:\t%lli\nflags:\t0%o\n",
> - (long long)file->f_pos, f_flags);
> + seq_printf(m, "pos:\t%lli\nflags:\t0%o\nmnt_id:\t%i\n",
> + (long long)file->f_pos, f_flags,
> + real_mount(file->f_path.mnt)->mnt_id);
> if (file->f_op->show_fdinfo)
> ret = file->f_op->show_fdinfo(m, file);
> fput(file);
>
More information about the CRIU
mailing list