summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStanislav Kinsburskiy <skinsbursky@virtuozzo.com>2016-02-06 12:16:22 +1100
committerStephen Rothwell <sfr@canb.auug.org.au>2016-02-09 09:33:16 +1100
commit5914a93ae2d9efcd382c615f4bd88dfe857516b4 (patch)
treefe60a0f3e0cd9ee66e7ab7b7a3c8772b5576c40e
parent992ed6aa3ceea666cae58b145e6e9a75d90c7df9 (diff)
downloadlinux-next-5914a93ae2d9efcd382c615f4bd88dfe857516b4.tar.gz
autofs: show pipe inode in mount options
This is required for CRIU (Checkpoint Restart In Userspace) to migrate a mount point when write end in user space is closed. Below is a brief description of the problem. To migrate a non-catatonic autofs mount point, one has to restore the control pipe between kernel and autofs master process. One of the autofs masters is systemd, which closes pipe write end after passing it to the kernel with mount call. To be able to restore the systemd control pipe one has to know which read pipe end in systemd corresponds to the write pipe end in the kernel. The pipe "fd" in mount options is not enough because it was closed and probably replaced by some other descriptor. Thus, some other attribute is required to be able to find the read pipe end. The best attribute to use to find the correct pipe end is inode number becuase it's unique for the whole system and can't be reused while the autofs mount exists. This attribute can also be used to recognize a situation where an autofs mount has no master (no process with specified "pgrp" or no file descriptor with "pipe_ino", specified in autofs mount options). Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com> Signed-off-by: Ian Kent <raven@themaw.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--fs/autofs4/inode.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index a3ae0b2aeb5a..4320faa2d2dc 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -94,7 +94,12 @@ static int autofs4_show_options(struct seq_file *m, struct dentry *root)
seq_printf(m, ",direct");
else
seq_printf(m, ",indirect");
-
+#ifdef CONFIG_CHECKPOINT_RESTORE
+ if (sbi->pipe)
+ seq_printf(m, ",pipe_ino=%ld", sbi->pipe->f_inode->i_ino);
+ else
+ seq_printf(m, ",pipe_ino=-1");
+#endif
return 0;
}