Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2197754ybg; Fri, 5 Jun 2020 07:59:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYNnJ4mz9jgm75MgzXUkTGMLxicqdApz5MIoRWjVz8thOHW55eJbLu6Ko/CbASoRnGTwa+ X-Received: by 2002:a17:906:f745:: with SMTP id jp5mr1962982ejb.440.1591369159786; Fri, 05 Jun 2020 07:59:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591369159; cv=none; d=google.com; s=arc-20160816; b=XKZmjyyMT+Nc5csNIdZkAESoNk/mUQqe9FLwtNR5Zqass1JqqRsP/9T1ip+WkIHd8n LsBGZAjYe+Av7qxOG723O7mXPQdjIomLlf+HiCi1ucNJZkdSxGqADbHtdog+/vjXEzCq +qD/37P6kN0OMh4/xNau7wgAX3onDwn8CSKd0MI9DNUL8HDZrvUNC006+fhEeDVJ516q q4JyO7ixMHKNH+rz8rkjlTrizBA7qr1CRaYRXkSjei3UNYX58UXsRpkpiVJFQbyDcwZ7 oJXhSiDgHdaVFhofrWB6wubz54iW4CHI80NHx3XEs8z1jTPFsd9qJ9VoT9vmHbSysAGV /rVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=fOTHjYlGSM8R5dlhVjInqQUUsDkfJwqM+thkTpl1JGM=; b=B3tfKRX6irZKxM6R4/Gsedif0CHMWw5G9qEmhrbJJFPxHPJlzfIFzRWRAS2PcQkLqF u4sUcvbICzgZtxz0EjeJZfkVkYadtbPElplX5o+cWaRU/4dv604S5xcrqX14kqzOo8yo 9Cg5ehLmC/mT1V2fJElvjuHstslxNOAKz6zSFlNdanND0SVkIXAywD/PTuhIMKDzUS6t rILD9s6s0b5xY9zw/wOSkLxS/tJxvcG3S+x2Rg/4fIHxnuQDZ8udBzq5tdyrjgQkaXMb SVbOluGnA0EkwxQ68ES882T+nmtbzA/E6fX/ynuqPDuseSAYhlW4xdPKUZ8m9sLpRYNF 5KDg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x17si3849103ejs.175.2020.06.05.07.58.56; Fri, 05 Jun 2020 07:59:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728077AbgFEO5G (ORCPT + 99 others); Fri, 5 Jun 2020 10:57:06 -0400 Received: from relay.sw.ru ([185.231.240.75]:33218 "EHLO relay3.sw.ru" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727114AbgFEO5G (ORCPT ); Fri, 5 Jun 2020 10:57:06 -0400 Received: from [192.168.15.111] (helo=alex-laptop) by relay3.sw.ru with smtp (Exim 4.93) (envelope-from ) id 1jhDmB-0002Ls-6G; Fri, 05 Jun 2020 17:56:55 +0300 Date: Fri, 5 Jun 2020 17:56:58 +0300 From: Alexander Mikhalitsyn To: Amir Goldstein Cc: Pavel Tikhomirov , Miklos Szeredi , Andrey Vagin , Konstantin Khorenko , Vasiliy Averin , Kirill Tkhai , overlayfs , linux-kernel Subject: Re: [PATCH 0/2] overlayfs: C/R enhancements Message-Id: <20200605175658.99b977a202d0ffb6c7cf5a04@virtuozzo.com> In-Reply-To: References: <20200604161133.20949-1-alexander.mikhalitsyn@virtuozzo.com> <20200605154438.408e5dc5522170c50463bbec@virtuozzo.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 5 Jun 2020 17:36:10 +0300 Amir Goldstein wrote: > > > While at it, you copy pasted the text: > > > For more information, see Documentation/filesystems/overlayfs.txt > > > but there is no more information to be found. > > > > As far as I know documentation patches must be send to another mailing list. > > Of course I have plan to add information to overlayfs documentation about new feature. > > > > Please send documentation patch together with the series > to this list. its fine to wait with that until the concept is approved though. > Yep, I will prepare patch and send. > > > > > > And if this works for you, you don't have to export the layers ovl_fh in > > > > > /proc/mounts, you can export them in numerous other ways. > > > > > One way from the top of my head, getxattr on overlay root dir. > > > > > "trusted.overlay" xattr is anyway a reserved prefix, so "trusted.overlay.layers" > > > > > for example could work. > > > > > > > > Thanks xattr might be a good option, but still don't forget about (a) > > > > and (b), users like to know all information about mount from > > > > /proc/pid/mountinfo. > > > > > > > > > > Let's stick to your use cases requirements. If you have other use cases > > > for this functionality lay them out explicitly. > > > > Requirements is very simple, at "dump stage" we need to save all overlayfs mount options > > sufficient to fully reconstruct overlayfs mount state on "restore stage". We already > > have proof of concept implementation of Docker overlayfs mounts when docker is running in > > OpenVZ container. In this case we fully dump all tree of mounts and all mount namespaces. > > CRIU mounts restore procedure at first reconstruct mount tree in special separate subtrees > > called "yards", then when all mounts is reconstructed we do "pivot_root" syscall. And > > with overlayfs it was a problem, because we mounted overlayfs with lowerdir,workdir,upperdir > > paths with mount namespace "yard" path prefix, and after restore in mount options user may see > > that lowerdir,workdir,upperdir paths were changed... It's a problem. Also it makes second C/R > > procedure is impossible, because after first C/R lowerdir,workdir,upperdir paths is invalidated > > after pivot_root. > > > > Example for Docker (after first C/R procedure): > > > > options lowerdir=/tmp/.criu.mntns.owMo9C/9-0000000000//var/lib/docker/overlay2/l/4BLZ4WH6GZIVKJE5QF62QUUKVZ:/var/lib/docker/overlay2/l/7FYRGAXT35JMKTXCHDNCQO3HKT,upperdir=/tmp/.criu.mntns.owMo9C/9-0000000000//var/lib/docker/overlay2/30aa26fb5e5671fc0126f2fc0e84cc740ce6bf06ca6ad4ac877a3c60f5aceaf1/diff,workdir=/tmp/.criu.mntns.owMo9C/9-0000000000//var/lib/docker/overlay2/30aa26fb5e5671fc0126f2fc0e84cc740ce6bf06ca6ad4ac877a3c60f5aceaf1/work > > > > That reminds me. > I've read somewhere that thoses symlinks l/4BLZ4WH6GZIVKJE5QF62QUUKVZ > are meant to shorten the mount option string, because the mount > options are limited by > page size and with many lower layers limitation can reach. > > That is one of the reasons that new mount API was created for (i.e. fsconfig()). > I wonder if /proc/mounts also has a similar limitation on options size. > I also wonder why docker doesn't chdir into /var/lib/docker/overlay2/ > before mounting overlay and use relative paths, though that would have > been worse for CRIU. > > So at least for the docker use case CRIU knows very well where the > underlying filesytem is mounted (/var/lib/docker/overlay2/ or above). > So if you got any API from overlayfs something like: > getxattr("/var/lib/docker/overlay2/XYZ/merged", > "trusted.overlay.layers.0.fh",..) > which reads the ovl_fh encoding of layer 0 (upper) rootdir, CRIU > can verify that uuid matches the filesystem mounted at /var/vol/docker/overlay2/ > and then call open_by_handle_at() to open fd and resolve it to a path > under /var/vol/docker/overlay2. > > I don't know if that provides what CRIU needs, but it would be no more > than a few lines of code in overlayfs: > > if (i < ofs->numlayer) > fh = ovl_encode_real_fh(ofs->layers[i].mnt->mnt_root, ... > I will try to experiment with that. Thank you! > Thanks, > Amir. -- Regards, Alex.