get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/816586/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 816586,
    "url": "http://patchwork.ozlabs.org/api/patches/816586/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-mtd/patch/20170920224605.22030-2-ebiggers3@gmail.com/",
    "project": {
        "id": 3,
        "url": "http://patchwork.ozlabs.org/api/projects/3/?format=api",
        "name": "Linux MTD development",
        "link_name": "linux-mtd",
        "list_id": "linux-mtd.lists.infradead.org",
        "list_email": "linux-mtd@lists.infradead.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170920224605.22030-2-ebiggers3@gmail.com>",
    "list_archive_url": null,
    "date": "2017-09-20T22:45:41",
    "name": "[01/25] fs, fscrypt: add an S_ENCRYPTED inode flag",
    "commit_ref": null,
    "pull_url": null,
    "state": "not-applicable",
    "archived": false,
    "hash": "6261577311368e476735b8db1a3fa55e7fc8047b",
    "submitter": {
        "id": 65202,
        "url": "http://patchwork.ozlabs.org/api/people/65202/?format=api",
        "name": "Eric Biggers",
        "email": "ebiggers3@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-mtd/patch/20170920224605.22030-2-ebiggers3@gmail.com/mbox/",
    "series": [
        {
            "id": 4250,
            "url": "http://patchwork.ozlabs.org/api/series/4250/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-mtd/list/?series=4250",
            "date": "2017-09-20T22:45:45",
            "name": "fscrypt: add some higher-level helper functions",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/4250/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/816586/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/816586/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Authentication-Results": [
            "ozlabs.org; spf=none (mailfrom)\n\tsmtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133;\n\thelo=bombadil.infradead.org;\n\tenvelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"UMiPepaQ\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"Xa+VKYqR\"; dkim-atps=neutral"
        ],
        "Received": [
            "from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xyFVM45P7z9sPk\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 21 Sep 2017 08:56:43 +1000 (AEST)",
            "from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dunuu-0006Iz-Uf; Wed, 20 Sep 2017 22:56:28 +0000",
            "from mail-pf0-x241.google.com ([2607:f8b0:400e:c00::241])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dunlw-0004wI-IO\n\tfor linux-mtd@lists.infradead.org; Wed, 20 Sep 2017 22:47:14 +0000",
            "by mail-pf0-x241.google.com with SMTP id e69so1716313pfg.4\n\tfor <linux-mtd@lists.infradead.org>;\n\tWed, 20 Sep 2017 15:46:52 -0700 (PDT)",
            "from ebiggers-linuxstation.kir.corp.google.com ([100.66.174.81])\n\tby smtp.gmail.com with ESMTPSA id j2sm6249pgn.26.2017.09.20.15.46.51\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tWed, 20 Sep 2017 15:46:51 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe:\n\tList-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References:\n\tIn-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID:\n\tContent-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc\n\t:Resent-Message-ID:List-Owner;\n\tbh=Gxo7n/Am8+4qYLetDFRxo6eawWeQ4FEZHNHnZLOvEt0=;\n\tb=UMiPepaQrjsSQTX0UZzGFtI8vA\n\t36I9pj0IPbxfHX/yZQFdNAjSNky+nF09d0zjRb+i3//sWtghRtSflHa3GHUm2rHigpLFOBd/rtmNI\n\tRo3rwGSjlsKkly6BWuSLdCxLecWGT1ourV/AgdeZfMvOy6iFAnaQWsh/gIJzBxklW9C3gU8nyhh5w\n\tgPzthgU9EMnIDYPD74r8tbZBQv7c6V/+SUILOs2O1oM9jSwXgopXrEAWSQSBIKtCkizsHKQioVcQ5\n\t6loz8ljcLasG6mgBgMsNXWCkofqXt4TUXYatVtBerSZ6Udnvkmvdp0WRtDYhltpOW4WYJisHEuoZq\n\tm5YST+xA==;",
            "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=wARWDprN0k35/Sd7s8XV8xzgOqaKGxpXF6yLyf3yyrw=;\n\tb=Xa+VKYqRS2FgWA4AvVbp/NAUSyEKBZG4AjdI4e/A8MMP56ywYkq7d7oAwwvVZEp2Tk\n\thw3bfARbjK1NdDS8Zk3Ia2i3up8Ncc87P99jH+f5/9lkTPGhp4QK4beLbINGCeDflDtQ\n\tfJZ35YdR6PuE8BBguaELXzzi2ezjsuTJTfg3OjLKfDqvDeGmMmqsrVWZPOQW+VCCJdEE\n\tc3g9Sy84NT+i5QXRUvSCULVe4UL5kZMWs967gfFXfH2rcpJueeGV5TwgtUFz/WwAlWsX\n\tqZc8UJMN+nEG0bQsnf4W1kIVm25DGOkrDM9grf5kc80pMCTClROilpyoYoI4vRMx3NO2\n\tjz7g=="
        ],
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=wARWDprN0k35/Sd7s8XV8xzgOqaKGxpXF6yLyf3yyrw=;\n\tb=GttqzhqTMam9GKT1YVemDglzPyg3mvBgMhYCNb+h3UFDrur/D4/ezRQkCnW6TjlUk4\n\tMOJYg0zANs6R6u6WtG3a9MS+tzOAUEqe1LTmgqnqBrgtwn8H9+XoQYUBj8HOXUkPZNY2\n\t2qwQ4LMHuukiX4xl0G8ChEjGqssJORR8Iny5j0c1n2koeQsVMrhEImEF+7icZ58Dr5Z8\n\tWx9d7BZ1BdRb+LoKRBQ3GgxZGVAMRiNoulvNoxg73P2/dDrFLX6BQBKnqdrhgWI6FlC8\n\tiCFlRwsNyx7AANq2rmJRbPnKLV8HIiMrHnax+HAyxB/6w+5rf1pMZciX4G1IRR7aZYT7\n\t6pdQ==",
        "X-Gm-Message-State": "AHPjjUg7F6OMsaxCNgrpipah5uDCy3S1hnfeWGoMaClJLy0mUPQ2Y3Q0\n\twQdyq0JX8y9nLp5EVFCIFUM=",
        "X-Google-Smtp-Source": "AOwi7QDEYFPyapqGQ2nhbKXYP+AjJ3BfoLK2WVVdflpsSz/P3AozwctMH74c5ZQZ00QtUPTGgJxpAg==",
        "X-Received": "by 10.84.143.165 with SMTP id 34mr3392176plz.91.1505947612023;\n\tWed, 20 Sep 2017 15:46:52 -0700 (PDT)",
        "From": "Eric Biggers <ebiggers3@gmail.com>",
        "To": "linux-fscrypt@vger.kernel.org",
        "Subject": "[PATCH 01/25] fs, fscrypt: add an S_ENCRYPTED inode flag",
        "Date": "Wed, 20 Sep 2017 15:45:41 -0700",
        "Message-Id": "<20170920224605.22030-2-ebiggers3@gmail.com>",
        "X-Mailer": "git-send-email 2.14.1.821.g8fa685d3b7-goog",
        "In-Reply-To": "<20170920224605.22030-1-ebiggers3@gmail.com>",
        "References": "<20170920224605.22030-1-ebiggers3@gmail.com>",
        "X-CRM114-Version": "20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ",
        "X-CRM114-CacheID": "sfid-20170920_154712_712565_24B43B31 ",
        "X-CRM114-Status": "GOOD (  16.27  )",
        "X-Spam-Score": "-1.8 (-)",
        "X-Spam-Report": "SpamAssassin version 3.4.1 on bombadil.infradead.org summary:\n\tContent analysis details:   (-1.8 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/,\n\tno\n\ttrust [2607:f8b0:400e:c00:0:0:0:241 listed in] [list.dnswl.org]\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends\n\tin digit (ebiggers3[at]gmail.com)\n\t0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\n\tprovider (ebiggers3[at]gmail.com)\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature\n\t0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from\n\tauthor's domain",
        "X-BeenThere": "linux-mtd@lists.infradead.org",
        "X-Mailman-Version": "2.1.21",
        "Precedence": "list",
        "List-Id": "Linux MTD discussion mailing list <linux-mtd.lists.infradead.org>",
        "List-Unsubscribe": "<http://lists.infradead.org/mailman/options/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.infradead.org/pipermail/linux-mtd/>",
        "List-Post": "<mailto:linux-mtd@lists.infradead.org>",
        "List-Help": "<mailto:linux-mtd-request@lists.infradead.org?subject=help>",
        "List-Subscribe": "<http://lists.infradead.org/mailman/listinfo/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=subscribe>",
        "Cc": "\"Theodore Y . Ts'o\" <tytso@mit.edu>, Eric Biggers <ebiggers@google.com>, \n\tMichael Halcrow <mhalcrow@google.com>,\n\tlinux-f2fs-devel@lists.sourceforge.net, \n\tlinux-mtd@lists.infradead.org, linux-fsdevel@vger.kernel.org,\n\tJaegeuk Kim <jaegeuk@kernel.org>, linux-ext4@vger.kernel.org",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Sender": "\"linux-mtd\" <linux-mtd-bounces@lists.infradead.org>",
        "Errors-To": "linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"
    },
    "content": "From: Eric Biggers <ebiggers@google.com>\n\nIntroduce a flag S_ENCRYPTED which can be set in ->i_flags to indicate\nthat the inode is encrypted using the fscrypt (fs/crypto/) mechanism.\n\nChecking this flag will give the same information that\ninode->i_sb->s_cop->is_encrypted(inode) currently does, but will be more\nefficient.  This will be useful for adding higher-level helper functions\nfor filesystems to use.  For example we'll be able to replace this:\n\n\tif (ext4_encrypted_inode(inode)) {\n\t\tret = fscrypt_get_encryption_info(inode);\n\t\tif (ret)\n\t\t\treturn ret;\n\t\tif (!fscrypt_has_encryption_key(inode))\n\t\t\treturn -ENOKEY;\n\t}\n\nwith this:\n\n\tret = fscrypt_require_key(inode);\n\tif (ret)\n\t\treturn ret;\n\n... since we'll be able to retain the fast path for unencrypted files as\na single flag check, using an inline function.  This wasn't possible\nbefore because we'd have had to frequently call through the\n->i_sb->s_cop->is_encrypted function pointer, even when the encryption\nsupport was disabled or not being used.\n\nNote: we don't define S_ENCRYPTED to 0 if CONFIG_FS_ENCRYPTION is\ndisabled because we want to continue to return an error if an encrypted\nfile is accessed without encryption support, rather than pretending that\nit is unencrypted.\n\nSigned-off-by: Eric Biggers <ebiggers@google.com>\n---\n fs/ext4/inode.c    | 7 +++++--\n fs/ext4/super.c    | 8 ++++++--\n fs/f2fs/f2fs.h     | 1 +\n fs/f2fs/inode.c    | 5 ++++-\n fs/ubifs/ioctl.c   | 5 ++++-\n fs/ubifs/xattr.c   | 1 +\n include/linux/fs.h | 2 ++\n 7 files changed, 23 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c\nindex 31db875bc7a1..d5a471939fbc 100644\n--- a/fs/ext4/inode.c\n+++ b/fs/ext4/inode.c\n@@ -4589,10 +4589,13 @@ void ext4_set_inode_flags(struct inode *inode)\n \t\tnew_fl |= S_DIRSYNC;\n \tif (test_opt(inode->i_sb, DAX) && S_ISREG(inode->i_mode) &&\n \t    !ext4_should_journal_data(inode) && !ext4_has_inline_data(inode) &&\n-\t    !ext4_encrypted_inode(inode))\n+\t    !(flags & EXT4_ENCRYPT_FL))\n \t\tnew_fl |= S_DAX;\n+\tif (flags & EXT4_ENCRYPT_FL)\n+\t\tnew_fl |= S_ENCRYPTED;\n \tinode_set_flags(inode, new_fl,\n-\t\t\tS_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC|S_DAX);\n+\t\t\tS_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC|S_DAX|\n+\t\t\tS_ENCRYPTED);\n }\n \n static blkcnt_t ext4_inode_blocks(struct ext4_inode *raw_inode,\ndiff --git a/fs/ext4/super.c b/fs/ext4/super.c\nindex b104096fce9e..dcfb19539871 100644\n--- a/fs/ext4/super.c\n+++ b/fs/ext4/super.c\n@@ -1181,7 +1181,8 @@ static int ext4_set_context(struct inode *inode, const void *ctx, size_t len,\n \t\t\text4_clear_inode_state(inode,\n \t\t\t\t\tEXT4_STATE_MAY_INLINE_DATA);\n \t\t\t/*\n-\t\t\t * Update inode->i_flags - e.g. S_DAX may get disabled\n+\t\t\t * Update inode->i_flags - S_ENCRYPTED will be enabled,\n+\t\t\t * S_DAX may be disabled\n \t\t\t */\n \t\t\text4_set_inode_flags(inode);\n \t\t}\n@@ -1206,7 +1207,10 @@ static int ext4_set_context(struct inode *inode, const void *ctx, size_t len,\n \t\t\t\t    ctx, len, 0);\n \tif (!res) {\n \t\text4_set_inode_flag(inode, EXT4_INODE_ENCRYPT);\n-\t\t/* Update inode->i_flags - e.g. S_DAX may get disabled */\n+\t\t/*\n+\t\t * Update inode->i_flags - S_ENCRYPTED will be enabled,\n+\t\t * S_DAX may be disabled\n+\t\t */\n \t\text4_set_inode_flags(inode);\n \t\tres = ext4_mark_inode_dirty(handle, inode);\n \t\tif (res)\ndiff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h\nindex 9a7c90386947..beaefddf2ff8 100644\n--- a/fs/f2fs/f2fs.h\n+++ b/fs/f2fs/f2fs.h\n@@ -2949,6 +2949,7 @@ static inline void f2fs_set_encrypted_inode(struct inode *inode)\n {\n #ifdef CONFIG_F2FS_FS_ENCRYPTION\n \tfile_set_encrypt(inode);\n+\tinode->i_flags |= S_ENCRYPTED;\n #endif\n }\n \ndiff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c\nindex 50c88e37ed66..53fb08810ee9 100644\n--- a/fs/f2fs/inode.c\n+++ b/fs/f2fs/inode.c\n@@ -43,8 +43,11 @@ void f2fs_set_inode_flags(struct inode *inode)\n \t\tnew_fl |= S_NOATIME;\n \tif (flags & FS_DIRSYNC_FL)\n \t\tnew_fl |= S_DIRSYNC;\n+\tif (f2fs_encrypted_inode(inode))\n+\t\tnew_fl |= S_ENCRYPTED;\n \tinode_set_flags(inode, new_fl,\n-\t\t\tS_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC);\n+\t\t\tS_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC|\n+\t\t\tS_ENCRYPTED);\n }\n \n static void __get_inode_rdev(struct inode *inode, struct f2fs_inode *ri)\ndiff --git a/fs/ubifs/ioctl.c b/fs/ubifs/ioctl.c\nindex fdc311246807..0164bcc827f8 100644\n--- a/fs/ubifs/ioctl.c\n+++ b/fs/ubifs/ioctl.c\n@@ -38,7 +38,8 @@ void ubifs_set_inode_flags(struct inode *inode)\n {\n \tunsigned int flags = ubifs_inode(inode)->flags;\n \n-\tinode->i_flags &= ~(S_SYNC | S_APPEND | S_IMMUTABLE | S_DIRSYNC);\n+\tinode->i_flags &= ~(S_SYNC | S_APPEND | S_IMMUTABLE | S_DIRSYNC |\n+\t\t\t    S_ENCRYPTED);\n \tif (flags & UBIFS_SYNC_FL)\n \t\tinode->i_flags |= S_SYNC;\n \tif (flags & UBIFS_APPEND_FL)\n@@ -47,6 +48,8 @@ void ubifs_set_inode_flags(struct inode *inode)\n \t\tinode->i_flags |= S_IMMUTABLE;\n \tif (flags & UBIFS_DIRSYNC_FL)\n \t\tinode->i_flags |= S_DIRSYNC;\n+\tif (flags & UBIFS_CRYPT_FL)\n+\t\tinode->i_flags |= S_ENCRYPTED;\n }\n \n /*\ndiff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c\nindex c13eae819cbc..5ddc89d564fd 100644\n--- a/fs/ubifs/xattr.c\n+++ b/fs/ubifs/xattr.c\n@@ -170,6 +170,7 @@ static int create_xattr(struct ubifs_info *c, struct inode *host,\n \terr = ubifs_jnl_update(c, host, nm, inode, 0, 1);\n \tif (err)\n \t\tgoto out_cancel;\n+\tubifs_set_inode_flags(host);\n \tmutex_unlock(&host_ui->ui_mutex);\n \n \tubifs_release_budget(c, &req);\ndiff --git a/include/linux/fs.h b/include/linux/fs.h\nindex 339e73742e73..055d2fbf8eca 100644\n--- a/include/linux/fs.h\n+++ b/include/linux/fs.h\n@@ -1853,6 +1853,7 @@ struct super_operations {\n #else\n #define S_DAX\t\t0\t/* Make all the DAX code disappear */\n #endif\n+#define S_ENCRYPTED\t16384\t/* Encrypted file (using fs/crypto/) */\n \n /*\n  * Note that nosuid etc flags are inode-specific: setting some file-system\n@@ -1892,6 +1893,7 @@ static inline bool sb_rdonly(const struct super_block *sb) { return sb->s_flags\n #define IS_AUTOMOUNT(inode)\t((inode)->i_flags & S_AUTOMOUNT)\n #define IS_NOSEC(inode)\t\t((inode)->i_flags & S_NOSEC)\n #define IS_DAX(inode)\t\t((inode)->i_flags & S_DAX)\n+#define IS_ENCRYPTED(inode)\t((inode)->i_flags & S_ENCRYPTED)\n \n #define IS_WHITEOUT(inode)\t(S_ISCHR(inode->i_mode) && \\\n \t\t\t\t (inode)->i_rdev == WHITEOUT_DEV)\n",
    "prefixes": [
        "01/25"
    ]
}