Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1248665pxk; Fri, 25 Sep 2020 09:46:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymYD0jA3Z82I3Y18gTH/AgG1PHntIkLLmXLlY2RRtVqYOqZTzLlSX4TeFGs9itC4Kg6hgx X-Received: by 2002:aa7:d15a:: with SMTP id r26mr2280418edo.181.1601052390054; Fri, 25 Sep 2020 09:46:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601052390; cv=none; d=google.com; s=arc-20160816; b=MfozJThRRRwF4PcQMMc0u1H/vxoqSpbTRAavlWGGjIPazZXh4WaFhfPos5EPZxYdHL Eos1eiKADogd9qc4eUoNMbsqJwroykce6Tp/AMHr/VQuZxCenbNO4ga1ptDKDHwnBq8W f2U+fnSWftKa6j4wmfjNTz1Q5pPiNrD2tg+quKKJyxAPQYgPE7a32NS7uTzfX5zqAeMV mFRV1kR2ho5sgRWZMFlPkVbNM632dCu8RaZgsmcR5HyxV7+VA5sffIqnEuXvpNGPLhGn bHtFkERreO3HoXH0/ZkCxT7vhh9Nbb7rHv8vl3vq73aj8YTanB6AEAQuI3zceMKljomq /Amg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=pMJSBGncr9k8+i5yr4/WJpZH3QmmiD+UwEsuN6RTtI0=; b=P+GRz/YDiGyuc+I3Vix3+soHW/fDLGzOv/R9onWWhlWGQEcTl+Y2EYqX670Q/8N+IC 9jHMuIjDL+theSLTw26UGVQw5U3+8JsS7xAzt1YUNBGWEly5bStXM/f9zf7Xk6ClLLFY RD2yxGWohcrVgKLIbw3cQWLk3mmt/dcvaFhSyNaw59/3YG8WyoUwVwbVsnfivrzPPbeY +KgLz/hXDp7EkPWi23TIaTAwOm0mPELETg9JBphdRLynDv5JAcIyMCz+Dn5/38xK37JS EsMJDmkexpzHEvfaTJ1T4P4uBvkP9b14gXJJfSvZPn6bUQCjNRYgMgxezyDjkOohmXrc CQYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oycXR9qG; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x25si2171722edi.558.2020.09.25.09.46.05; Fri, 25 Sep 2020 09:46:30 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oycXR9qG; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728443AbgIYQnD (ORCPT + 99 others); Fri, 25 Sep 2020 12:43:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727324AbgIYQnD (ORCPT ); Fri, 25 Sep 2020 12:43:03 -0400 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 072A1C0613CE; Fri, 25 Sep 2020 09:43:03 -0700 (PDT) Received: by mail-io1-xd44.google.com with SMTP id z13so3441913iom.8; Fri, 25 Sep 2020 09:43:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pMJSBGncr9k8+i5yr4/WJpZH3QmmiD+UwEsuN6RTtI0=; b=oycXR9qGnnYyNd2ph2xmGb9rTEZzdhlwRyH36Mb+SPJ8kZ63wrxcMg5AajYL3b041W BfkPCBdpeMd78WIhhATPNfy9W0FxohBjieWXMfm60DhqdB/rO2dV0t76M96Lj3zuy9Zd jiZRB/5j5l5JoOtdNXLCMSF0fMmxUnCZiAgUyWy+/EhjXQX6AXnQnb4fiNDiPeuYzUDi bK/vQd4WKKo2b0O25G0iUqdGMTkE7R/NRoGp11wo0gxMaMPFbXBMMhdWzwDTJhguTK9l gKUWoV8ued8nFhdXjJWqzhTsfCuAyfK1AqM6OlPcsD/x/0Q7UopHLNvJ1YUXTY8wLWBm KYvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pMJSBGncr9k8+i5yr4/WJpZH3QmmiD+UwEsuN6RTtI0=; b=XWtxr88/BdPO1RnSAFuqxa7XjTrNagL05GFK0doR5mVeveqKcMzdE/ypnPOHiM1stV /+fUqgruNVjlZctMFfdIJnFrKmVJKBKPPWApcCd701EhUnNqin87fbKLWcFhhGHxtZ1W tEuW55Afbj69/egyPApFZYyLhOF/14PrvipkzrACdUiwHLMmb/AjzYDaln2Id/pWPId6 9NJQZcSHb88GrWGiJL1tIIO6HsKNcLgor3tOTo58yvRB8RC/+MGrYd496vEYbd0ZsYjp MrbsSVRGFJx5nbICp7BUOir66P6+UUMnL6CJdc+oZkHOkUAjJIYVwvGcqcmS0E7bGtMd SzWA== X-Gm-Message-State: AOAM532GILENXxF3/gNUKz9cqyO5WQH/6IzTAPPqxJbvfbqlDIHwEEJj 6GiydA2s9vWdu+DpeyTDaoCfSrhGBxhMODEjcWYs0dacT8w= X-Received: by 2002:a05:6602:2e81:: with SMTP id m1mr917217iow.64.1601052181955; Fri, 25 Sep 2020 09:43:01 -0700 (PDT) MIME-Version: 1.0 References: <20200925083507.13603-1-ptikhomirov@virtuozzo.com> <20200925083507.13603-3-ptikhomirov@virtuozzo.com> In-Reply-To: <20200925083507.13603-3-ptikhomirov@virtuozzo.com> From: Amir Goldstein Date: Fri, 25 Sep 2020 19:42:51 +0300 Message-ID: Subject: Re: [PATCH v4 2/2] ovl: introduce new "uuid=off" option for inodes index feature To: Pavel Tikhomirov Cc: Miklos Szeredi , Vivek Goyal , overlayfs , linux-kernel Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 25, 2020 at 11:35 AM Pavel Tikhomirov wrote: > > This replaces uuid with null in overelayfs file handles and thus relaxes typo: overelayfs > uuid checks for overlay index feature. It is only possible in case there > is only one filesystem for all the work/upper/lower directories and bare > file handles from this backing filesystem are uniq. In other case when > we have multiple filesystems lets just fallback to "uuid=on" which is > and equivalent of how it worked before with all uuid checks. > typo: uniq > This is needed when overlayfs is/was mounted in a container with index > enabled (e.g.: to be able to resolve inotify watch file handles on it to > paths in CRIU), and this container is copied and started alongside with > the original one. This way the "copy" container can't have the same uuid > on the superblock and mounting the overlayfs from it later would fail. > > Note: In our (Virtuozzo) use case users inside a container can create > "regular" overlayfs mounts without any "index=" option, but we still > want to migrate this containers with CRIU so we set "index=on" as kernel this container > default so that all the container overlayfs mounts get support of file > handles automatically. With "uuid=off" we want the same thing (to be > able to "copy" container with uuid change) - we would set kernel default > so that all the container overlayfs mounts get "uuid=off" automatically. > > That is an example of the problem on top of loop+ext4: > > dd if=/dev/zero of=loopbackfile.img bs=100M count=10 > losetup -fP loopbackfile.img > losetup -a > #/dev/loop0: [64768]:35 (/loop-test/loopbackfile.img) > mkfs.ext4 loopbackfile.img > mkdir loop-mp > mount -o loop /dev/loop0 loop-mp > mkdir loop-mp/{lower,upper,work,merged} > mount -t overlay overlay -oindex=on,lowerdir=loop-mp/lower,\ > upperdir=loop-mp/upper,workdir=loop-mp/work loop-mp/merged > umount loop-mp/merged > umount loop-mp > e2fsck -f /dev/loop0 > tune2fs -U random /dev/loop0 > > mount -o loop /dev/loop0 loop-mp > mount -t overlay overlay -oindex=on,lowerdir=loop-mp/lower,\ > upperdir=loop-mp/upper,workdir=loop-mp/work loop-mp/merged > #mount: /loop-test/loop-mp/merged: > #mount(2) system call failed: Stale file handle. > > If you just change the uuid of the backing filesystem, overlay is not > mounting any more. In Virtuozzo we copy container disks (ploops) when > crate the copy of container and we require fs uuid to be uniq for a new typos: crat, uniq > container. > > CC: Amir Goldstein > CC: Vivek Goyal > CC: Miklos Szeredi > CC: linux-unionfs@vger.kernel.org > CC: linux-kernel@vger.kernel.org > Signed-off-by: Pavel Tikhomirov > Apart from some typos, looks good to me. You may add: Reviewed-by: Amir Goldstein Please do not post v5. you should wait for more feedback from others. > --- > v2: in v1 I missed actual uuid check skip > v3: rebase to overlayfs-next, replace uuid with null in file handles, > split ovl_fs propagation to function arguments to separate patch, add > separate bool "uuid=on/off" option, move numfs check up, add doc note. > v4: get rid of double negatives, remove nouuid leftower comment, fix > missprint in kernel config name > > Documentation/filesystems/overlayfs.rst | 6 ++++++ > fs/overlayfs/Kconfig | 19 +++++++++++++++++++ > fs/overlayfs/copy_up.c | 3 ++- > fs/overlayfs/namei.c | 4 +++- > fs/overlayfs/ovl_entry.h | 1 + > fs/overlayfs/super.c | 25 +++++++++++++++++++++++++ > 6 files changed, 56 insertions(+), 2 deletions(-) > > diff --git a/Documentation/filesystems/overlayfs.rst b/Documentation/filesystems/overlayfs.rst > index 580ab9a0fe31..4f9cc20f255c 100644 > --- a/Documentation/filesystems/overlayfs.rst > +++ b/Documentation/filesystems/overlayfs.rst > @@ -563,6 +563,12 @@ This verification may cause significant overhead in some cases. > Note: the mount options index=off,nfs_export=on are conflicting for a > read-write mount and will result in an error. > > +Note: the mount option uuid=off (or corresponding module param, or kernel > +config) can be used to replace UUID of the underlying filesystem in file > +handles with null, and effectively disable UUID checks. This can be useful in > +case the underlying disk is copied and the UUID of this copy is changed. This > +is only applicable if all lower/upper/work directories are on the same > +filesystem, otherwise it will fallback to normal behaviour. > > Volatile mount > -------------- > diff --git a/fs/overlayfs/Kconfig b/fs/overlayfs/Kconfig > index dd188c7996b3..c21abdb43206 100644 > --- a/fs/overlayfs/Kconfig > +++ b/fs/overlayfs/Kconfig > @@ -61,6 +61,25 @@ config OVERLAY_FS_INDEX > > If unsure, say N. > > +config OVERLAY_FS_INDEX_UUID > + bool "Overlayfs: export uuid in file handles" > + default y > + depends on OVERLAY_FS > + help > + If this config option is disabled then overlay will replace uuid with > + null in overlayfs file handles, effectively disabling uuid checks for > + them. This affects overlayfs mounted with "index=on". This only can be > + done if all upper and lower directories are on the same filesystem > + where basic fhandles are uniq. In case the latter is not true There are some typos in it, but I think this phrase can be dropped: "where basic fhandles are uniq" Thanks, Amir.