public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
To: autofs@vger.kernel.org, linux-kernel@vger.kernel.org, raven@themaw.net
Cc: criu@openvz.org, skinsbursky@virtuozzo.com
Subject: [PATCH v2] autofs: show pipe inode in mount options
Date: Mon, 25 Jan 2016 15:29:43 +0400	[thread overview]
Message-ID: <20160125112929.3570.41795.stgit@localhost.localdomain> (raw)

This is required for CRIU (Checkpoint Restart In Userspace) to migrate a mount
point, when write end in user space is closed.
Below is the brief description of the problem.
To migrate non-catatonic autofs mount point, one have to restore control
pipe between kernel and 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 systemd control pipe, one have to know, which read pipe
end in systemd corresponds to the write pipe end in the kernel. 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, allowing to find correct pipe end is inode number, becuase
it's unique for the whole system and can't be reused until autofs mount
exists. This attribute also allows to recognize a situation with autofs mount
without master (no process with specified "pgrp" or not file descriptor with
"pipe_ino", specified in autofs mount options).

v2:
1) New option "pipe_ino" was moved to the end of the options list.
2) Option is printed only if CONFIG_CHECKPOINT_RESTORE is set.


Signed-off-by: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
---
 fs/autofs4/inode.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index a3ae0b2..4320faa 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;
 }
 

                 reply	other threads:[~2016-01-25 12:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160125112929.3570.41795.stgit@localhost.localdomain \
    --to=skinsbursky@virtuozzo.com \
    --cc=autofs@vger.kernel.org \
    --cc=criu@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=raven@themaw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox