{"id":814406,"url":"http://patchwork.ozlabs.org/api/1.2/patches/814406/?format=json","web_url":"http://patchwork.ozlabs.org/project/ubuntu-kernel/patch/1505511880-19182-2-git-send-email-marcelo.cerri@canonical.com/","project":{"id":15,"url":"http://patchwork.ozlabs.org/api/1.2/projects/15/?format=json","name":"Ubuntu Kernel","link_name":"ubuntu-kernel","list_id":"kernel-team.lists.ubuntu.com","list_email":"kernel-team@lists.ubuntu.com","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1505511880-19182-2-git-send-email-marcelo.cerri@canonical.com>","list_archive_url":null,"date":"2017-09-15T21:44:38","name":"[azure,1/3] ext4: fix fault handling when mounted with -o dax, ro","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"17c01719e82ce8faf8a96561aaa02784625685bb","submitter":{"id":69981,"url":"http://patchwork.ozlabs.org/api/1.2/people/69981/?format=json","name":"Marcelo Henrique Cerri","email":"marcelo.cerri@canonical.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/ubuntu-kernel/patch/1505511880-19182-2-git-send-email-marcelo.cerri@canonical.com/mbox/","series":[{"id":3388,"url":"http://patchwork.ozlabs.org/api/1.2/series/3388/?format=json","web_url":"http://patchwork.ozlabs.org/project/ubuntu-kernel/list/?series=3388","date":"2017-09-15T21:44:37","name":"linux-azure: persistent memory is not working","version":1,"mbox":"http://patchwork.ozlabs.org/series/3388/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/814406/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/814406/checks/","tags":{},"related":[],"headers":{"Return-Path":"<kernel-team-bounces@lists.ubuntu.com>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com\n\t(client-ip=91.189.94.19; helo=huckleberry.canonical.com;\n\tenvelope-from=kernel-team-bounces@lists.ubuntu.com;\n\treceiver=<UNKNOWN>)","Received":["from huckleberry.canonical.com (huckleberry.canonical.com\n\t[91.189.94.19])\n\tby ozlabs.org (Postfix) with ESMTP id 3xv87p6vkfz9sPm;\n\tSat, 16 Sep 2017 07:44:54 +1000 (AEST)","from localhost ([127.0.0.1] helo=huckleberry.canonical.com)\n\tby huckleberry.canonical.com with esmtp (Exim 4.86_2)\n\t(envelope-from <kernel-team-bounces@lists.ubuntu.com>)\n\tid 1dsyPr-0002Rz-3w; Fri, 15 Sep 2017 21:44:51 +0000","from youngberry.canonical.com ([91.189.89.112])\n\tby huckleberry.canonical.com with esmtps\n\t(TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128)\n\t(Exim 4.86_2) (envelope-from <marcelo.cerri@canonical.com>)\n\tid 1dsyPp-0002RB-Aa\n\tfor kernel-team@lists.ubuntu.com; Fri, 15 Sep 2017 21:44:49 +0000","from mail-pg0-f70.google.com ([74.125.83.70])\n\tby youngberry.canonical.com with esmtps\n\t(TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.76) (envelope-from <marcelo.cerri@canonical.com>)\n\tid 1dsyPo-0006m8-VQ\n\tfor kernel-team@lists.ubuntu.com; Fri, 15 Sep 2017 21:44:49 +0000","by mail-pg0-f70.google.com with SMTP id p5so6615210pgn.7\n\tfor <kernel-team@lists.ubuntu.com>;\n\tFri, 15 Sep 2017 14:44:48 -0700 (PDT)","from localhost.localdomain ([12.145.98.253])\n\tby smtp.gmail.com with ESMTPSA id\n\tz26sm4262212pfa.49.2017.09.15.14.44.45\n\tfor <kernel-team@lists.ubuntu.com>\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tFri, 15 Sep 2017 14:44:46 -0700 (PDT)"],"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:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=fi3mUIAyaPD+nqwIaPCEkKr6b1to20R/M5E3D7HbUWc=;\n\tb=kXSsrNTdl0d+pCZQjOTQzmwWtWYJxP2mT6KAOgRojC79iNSVQnpohr4a9X9sk+ZipO\n\tRhWIQx7CnPZ6O9gHcwrkU70FE80F65nDVjosKkniRiXnumEMV4lFLdlJEoRHZW2RAk/+\n\tPPZD9mI3yJ8JEtIQJ7pzh7RCLY/jDWd4QZlGyglMy7/JPzyGe0wXbYA/WsYZIRCHIBqZ\n\tes/nnmgxjUdHsBvpzMgAGCkgt7nKocIDslw73kph++ttcZcem/P+YXEK1RcUQBMD4iEn\n\taL/oUaATsBpVucSYe/ow5YykogH7QgUuMxJxLkTymeE22lWk7WaSv8ipIrFbT4kZQqxH\n\tkrfw==","X-Gm-Message-State":"AHPjjUiygdM7dewr/MSABsEChNX+2jSclfy/e/MpDqVugpo/ez7xsZpe\n\ttZLmaJnV7PGrqivNi2qTSPN5H4zFZ6rmVnb9+RpLuAXR6lOdhHeIIe2FDkLDiu0PdJo9hVGlirJ\n\t9ghpLw59Woeuw6Qy4srFOm6P8WTX4nGDb","X-Received":["by 10.99.114.29 with SMTP id n29mr25531508pgc.258.1505511887340; \n\tFri, 15 Sep 2017 14:44:47 -0700 (PDT)","by 10.99.114.29 with SMTP id n29mr25531498pgc.258.1505511887151; \n\tFri, 15 Sep 2017 14:44:47 -0700 (PDT)"],"X-Google-Smtp-Source":"ADKCNb6FAK1PmGDqgiIJN2WhFxKw2RJgnCVbo+AiFbEPV2WtGFbKB6cXFlKqVh0H6Kx/zf7YjwG/5g==","From":"Marcelo Henrique Cerri <marcelo.cerri@canonical.com>","To":"kernel-team@lists.ubuntu.com","Subject":"[azure][PATCH 1/3] ext4: fix fault handling when mounted with -o\n\tdax, ro","Date":"Fri, 15 Sep 2017 18:44:38 -0300","Message-Id":"<1505511880-19182-2-git-send-email-marcelo.cerri@canonical.com>","X-Mailer":"git-send-email 2.7.4","In-Reply-To":"<1505511880-19182-1-git-send-email-marcelo.cerri@canonical.com>","References":"<1505511880-19182-1-git-send-email-marcelo.cerri@canonical.com>","X-BeenThere":"kernel-team@lists.ubuntu.com","X-Mailman-Version":"2.1.20","Precedence":"list","List-Id":"Kernel team discussions <kernel-team.lists.ubuntu.com>","List-Unsubscribe":"<https://lists.ubuntu.com/mailman/options/kernel-team>,\n\t<mailto:kernel-team-request@lists.ubuntu.com?subject=unsubscribe>","List-Archive":"<https://lists.ubuntu.com/archives/kernel-team>","List-Post":"<mailto:kernel-team@lists.ubuntu.com>","List-Help":"<mailto:kernel-team-request@lists.ubuntu.com?subject=help>","List-Subscribe":"<https://lists.ubuntu.com/mailman/listinfo/kernel-team>,\n\t<mailto:kernel-team-request@lists.ubuntu.com?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"kernel-team-bounces@lists.ubuntu.com","Sender":"\"kernel-team\" <kernel-team-bounces@lists.ubuntu.com>"},"content":"From: Randy Dodgen <dodgen@google.com>\n\nBugLink: http://bugs.launchpad.net/bugs/1715755\n\nIf an ext4 filesystem is mounted with both the DAX and read-only\noptions, executables on that filesystem will fail to start (claiming\n'Segmentation fault') due to the fault handler returning\nVM_FAULT_SIGBUS.\n\nThis is due to the DAX fault handler (see ext4_dax_huge_fault)\nattempting to write to the journal when FAULT_FLAG_WRITE is set. This is\nthe wrong behavior for write faults which will lead to a COW page; in\nparticular, this fails for readonly mounts.\n\nThis change avoids journal writes for faults that are expected to COW.\n\nIt might be the case that this could be better handled in\next4_iomap_begin / ext4_iomap_end (called via iomap_ops inside\ndax_iomap_fault). These is some overlap already (e.g. grabbing journal\nhandles).\n\nSigned-off-by: Randy Dodgen <dodgen@google.com>\nSigned-off-by: Theodore Ts'o <tytso@mit.edu>\nReviewed-by: Jan Kara <jack@suse.cz>\nReviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>\n(cherry picked from commit fd96b8da68d32a9403726db09b229f4b5ac849c7)\nSigned-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>\n---\n fs/ext4/file.c | 15 ++++++++++++++-\n 1 file changed, 14 insertions(+), 1 deletion(-)","diff":"diff --git a/fs/ext4/file.c b/fs/ext4/file.c\nindex bbea2dccd584..2ac020b3cbf8 100644\n--- a/fs/ext4/file.c\n+++ b/fs/ext4/file.c\n@@ -260,7 +260,20 @@ static int ext4_dax_huge_fault(struct vm_fault *vmf,\n \thandle_t *handle = NULL;\n \tstruct inode *inode = file_inode(vmf->vma->vm_file);\n \tstruct super_block *sb = inode->i_sb;\n-\tbool write = vmf->flags & FAULT_FLAG_WRITE;\n+\n+\t/*\n+\t * We have to distinguish real writes from writes which will result in a\n+\t * COW page; COW writes should *not* poke the journal (the file will not\n+\t * be changed). Doing so would cause unintended failures when mounted\n+\t * read-only.\n+\t *\n+\t * We check for VM_SHARED rather than vmf->cow_page since the latter is\n+\t * unset for pe_size != PE_SIZE_PTE (i.e. only in do_cow_fault); for\n+\t * other sizes, dax_iomap_fault will handle splitting / fallback so that\n+\t * we eventually come back with a COW page.\n+\t */\n+\tbool write = (vmf->flags & FAULT_FLAG_WRITE) &&\n+\t\t(vmf->vma->vm_flags & VM_SHARED);\n \n \tif (write) {\n \t\tsb_start_pagefault(sb);\n","prefixes":["azure","1/3"]}