From patchwork Tue Oct 17 16:44:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 10012463 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6ABF5600CC for ; Tue, 17 Oct 2017 16:44:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F47927F94 for ; Tue, 17 Oct 2017 16:44:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 53C1A28066; Tue, 17 Oct 2017 16:44:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D959E27F94 for ; Tue, 17 Oct 2017 16:44:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937063AbdJQQoV (ORCPT ); Tue, 17 Oct 2017 12:44:21 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:56281 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S937051AbdJQQoQ (ORCPT ); Tue, 17 Oct 2017 12:44:16 -0400 Received: by mail-wm0-f65.google.com with SMTP id u138so5225510wmu.4; Tue, 17 Oct 2017 09:44:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gu9cYUK3E6fHT4DNXSBvaiBjF2Dd44dG4VjZ2g1bnu0=; b=jrKXUe4vTXJZIFWqQ3zR4f85xl5mVyz76ARihNdEZrDNRi/b22+lokJj93hvt3THWw 9oFjQFsrnn2Flf7QdZGJB71kT3KukUEwdlFazEUZaJfNv9YZilkHDOD/Y+gvsc7BvRM9 kJybBed4seoZGfte7uSTK9GSQqPdpyKnbg9WQeLpASTeFNHP6aOv2hiOlNtpKNtZDWv4 0/aUj6w9uKJA7iVhw8iQMYLZ5fXbxu13Sv8+LoEv1QhtSAYRg5AQWXqFw6PfQXoZOk6b YJlZyGL/Mw4nrOoPj/VSmGAzmqOpPMOnUTvjT0pbtozcMunlfN6IS1qKBVSwifk/diot ummg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gu9cYUK3E6fHT4DNXSBvaiBjF2Dd44dG4VjZ2g1bnu0=; b=sLRQEt6lsqGuF/BkmU+OKELrydzErQjHvpNOMHvxYXBhj1wc+7IDvboo8hk/HPsTVB VDy7p66VKZBKV4luISFjHbN6b3tvEoONu4MBAkW6wjDpDnSj+g4pT28etTf+HWBAsMAh gg6sqqMKVJdS54x6QLnXDxNFJ6mkRrycoMRz6L15oiEEML7D9jlK/RRGoAHvnc0ez6OQ g2t7A+dHzhG+5Vm++rxIu63yrcIx+paSUwTJQDcEU6TFn6Lt5Q1OxtgWDsTEJhWO1IEt daWV2vmm6OcXe5VYc8XJcYQ9mI6PepWBVIs2eT11cH1ZzQmwfooDQoNGjbSBk3EWopfR 4MQg== X-Gm-Message-State: AMCzsaWMt6iOfK/Yqf+Z3S6DrR18JtU81w8MzLhYLSpB7dMKx3HxZm/K Nn7TQlkzVMaPcGiOsTxIeXHPklt9 X-Google-Smtp-Source: AOwi7QAsAKd46Xg2dFWKb8hk+mDK6NRtoxnjJ14DPiV3Uor72fU/RPonamQ/rDoumnLeVv+6rfhr8g== X-Received: by 10.80.137.82 with SMTP id f18mr17728216edf.202.1508258654858; Tue, 17 Oct 2017 09:44:14 -0700 (PDT) Received: from localhost.localdomain (bzq-166-168-31-246.red.bezeqint.net. [31.168.166.246]) by smtp.gmail.com with ESMTPSA id c25sm8439979edb.28.2017.10.17.09.44.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Oct 2017 09:44:14 -0700 (PDT) From: Amir Goldstein To: Miklos Szeredi Cc: Jeff Layton , "J . Bruce Fields" , linux-unionfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 14/14] ovl: document NFS export Date: Tue, 17 Oct 2017 19:44:31 +0300 Message-Id: <1508258671-10800-15-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508258671-10800-1-git-send-email-amir73il@gmail.com> References: <1508258671-10800-1-git-send-email-amir73il@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Amir Goldstein --- Documentation/filesystems/overlayfs.txt | 61 +++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/Documentation/filesystems/overlayfs.txt b/Documentation/filesystems/overlayfs.txt index d89041baceb9..dbd829b0b12b 100644 --- a/Documentation/filesystems/overlayfs.txt +++ b/Documentation/filesystems/overlayfs.txt @@ -285,6 +285,67 @@ merged with the upper directory instead. The "verify_dir" feature, therefore, makes an overlay mount cope better with the situations of lower directory rename and delete. + +NFS export +---------- + +An overlay filesystem may be exported to NFS when: +- All underlying filesystems support NFS file handles +- overlay is mounted with the mount options "index=all,verify_dir" +- overlay is not using multiple lower layers + +With the "index=all" feature, on copy_up of any lower object, an index +entry is created under the index directory. The index entry name is the +hexadecimal representation of the copy up origin file handle. For a +non-directory object, the index entry is a hard link to the upper inode. +For a directory object, the index entry has an extended attribute +"trusted.overlay.origin" with an encoded file handle of the upper +directory inode. + +When encoding a file handle from an overlay filesystem object, the +following rules apply: + +1. For a non-upper object, encode a lower file handle from lower inode +2. For a pure-upper object, encode an upper file handle from upper inode +3. For an indexed object, encode a lower file handle from copy_up origin + +Encoding a lower directory file handle will copy up and index that +directory, so the index can be use on decode to find the upper directory. +An existing non-indexed merged directory cannot be encoded with current +NFS export implementation. + +The encoded overlay file handle includes: + - Header including path type information (e.g. lower/upper) + - UUID of the underlying filesystem + - Underlying filesystem encoding of underlying inode + +This encoding is identical to the encoding of copy_up origin stored in +"trusted.overlay.origin". + +When decoding an overlay file handle, the following steps are followed: + +1. Find underlying layer by UUID and path type information. +2. Decode the underlying filesystem file handle to underlying dentry. +3. Lookup the file handle in index directory by name. +4. If not found in index, instantiate an overlay dentry from the decoded + lower dentry. +6. If a non-directory is found in index, instantiate a disconnected overlay + dentry from the upper index dentry and the decoded lower dentry. +5. If a directory is found in index, decode upper dentry from file handle + stored in extended attribute "trusted.overlay.origin" in the index and + instantiate an overlay dentry from the decoded upper and lower dentries. +7. If a whiteout is found in index, return ESTALE. This represents an + overlay object that was deleted after its file handle was encoded. + +The "verify_dir" mount option and no multiple lower layer requirements, +ensure that a decoded overlay directory object will be equivalent to the +object that was used to encode the file handle. + +Decoding a non-directory file handle may return a disconnected dentry. +copy_up of that disconnected dentry will create an upper index entry with +no upper alias. + + Testsuite ---------