From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932611AbcAYM0v (ORCPT ); Mon, 25 Jan 2016 07:26:51 -0500 Received: from swsoft-msk-nat.sw.ru ([195.214.232.10]:48681 "EHLO sandbox" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932071AbcAYM0r (ORCPT ); Mon, 25 Jan 2016 07:26:47 -0500 X-Greylist: delayed 3413 seconds by postgrey-1.27 at vger.kernel.org; Mon, 25 Jan 2016 07:26:46 EST Subject: [PATCH v2] autofs: show pipe inode in mount options From: Stanislav Kinsburskiy To: autofs@vger.kernel.org, linux-kernel@vger.kernel.org, raven@themaw.net Cc: criu@openvz.org, skinsbursky@virtuozzo.com Date: Mon, 25 Jan 2016 15:29:43 +0400 Message-ID: <20160125112929.3570.41795.stgit@localhost.localdomain> User-Agent: StGit/0.17-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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; }