Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2333270yba; Sat, 27 Apr 2019 21:31:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqzRn3Sk8VWsgqae4vVLDCiOk4hyfuUDqDtss3H5zQGzA3E9A52Cy1BMasJElg6XJGiqI9Kb X-Received: by 2002:a65:4c07:: with SMTP id u7mr9303pgq.93.1556425877936; Sat, 27 Apr 2019 21:31:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556425877; cv=none; d=google.com; s=arc-20160816; b=en2evT1OFQO6QJOwCKMN59/SmQVThNiaxPRsI7LoeI1OkccZPWpnbOCrRnjnoQ97hW kejlbcXx7e1hQ2RL5WcjgnPM6ip6sJQzgDSE5OLOX8uySNHvXVk2GL4FYnQnuKPBWQTO 6gcUIYrBNkYcInUhKiOnXbxqcvyCCBEHc6djT7tERJYWYKNdIuYE3ctzZel2oh64Uckh W1BJ2owUxpqzFfecP7C61vUAE0cAaGmYX6Ihh+LkkEvzxnb8j3umlDKuckEVTmNY5xKM msZ1krRPFUwJvuF0BQLlfI2Jypd/ZUGiof+pbOwrzSghxmhpaFsBCiyOO1pUtMhNNdst URoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:date:subject:cc:to:from; bh=glLeGValmg1uRMplZkkNUc3PXilYwjAKutP/rphWXpk=; b=Zh5uaFSBAYfqUZLr+SwBVQe5g3eoIrnyBv9ZnfxEGsTEOy3WHQrGwYNf6QoRvqytt9 fguVGpRTe91OmbzuJxf6/spFnsA114/yjq+yg4SIae5A3IyJTNgkGpq6FsaaUT0plbs3 GAvg8bpgrkEMAcc38lTFwcF6KIqiRD/wBy8xwNLazrRG8Cu/loCUyCnyJqi2cG7Kjcs0 aMvYHMLMmze5TQlWZi6c3PZTpC44IiYmPcO2bDPvxNuZ13ue2CawkTIohKzaKxosmwoX w36xyvDvJsnSxQafvZW4Dx//7rDzCGVATKI6s8DLcG5ghdKGTrBLauI2O6zuAiSgemys D7bg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j127si32011294pfb.25.2019.04.27.21.30.53; Sat, 27 Apr 2019 21:31:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726023AbfD1Eaj (ORCPT + 99 others); Sun, 28 Apr 2019 00:30:39 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:34986 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725818AbfD1Eaj (ORCPT ); Sun, 28 Apr 2019 00:30:39 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x3S4T9uH094691 for ; Sun, 28 Apr 2019 00:30:37 -0400 Received: from e14.ny.us.ibm.com (e14.ny.us.ibm.com [129.33.205.204]) by mx0b-001b2d01.pphosted.com with ESMTP id 2s54cgh4mh-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 28 Apr 2019 00:30:37 -0400 Received: from localhost by e14.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 28 Apr 2019 05:30:37 +0100 Received: from b01cxnp22035.gho.pok.ibm.com (9.57.198.25) by e14.ny.us.ibm.com (146.89.104.201) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sun, 28 Apr 2019 05:30:33 +0100 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x3S4UWhG26345526 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 28 Apr 2019 04:30:32 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 61A31112063; Sun, 28 Apr 2019 04:30:32 +0000 (GMT) Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7ED2F112073; Sun, 28 Apr 2019 04:30:28 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.85.75.21]) by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTP; Sun, 28 Apr 2019 04:30:28 +0000 (GMT) From: Chandan Rajendra To: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-fscrypt@vger.kernel.org Cc: Chandan Rajendra , tytso@mit.edu, adilger.kernel@dilger.ca, ebiggers@kernel.org, jaegeuk@kernel.org, yuchao0@huawei.com, hch@infradead.org Subject: [PATCH V2 00/13] Consolidate FS read I/O callbacks code Date: Sun, 28 Apr 2019 10:01:08 +0530 X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 19042804-0052-0000-0000-000003B41073 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00011008; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000285; SDB=6.01195431; UDB=6.00626836; IPR=6.00976273; MB=3.00026628; MTD=3.00000008; XFM=3.00000015; UTC=2019-04-28 04:30:36 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19042804-0053-0000-0000-000060ABB19F Message-Id: <20190428043121.30925-1-chandan@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-04-28_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904280030 Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org This patchset moves the "FS read I/O callbacks" code into a file of its own (i.e. fs/read_callbacks.c) and modifies the generic do_mpage_readpge() to make use of the functionality provided. "FS read I/O callbacks" code implements the state machine that needs to be executed after reading data from files that are encrypted and/or have verity metadata associated with them. With these changes in place, the patchset changes Ext4 to use mpage_readpage[s] instead of its own custom ext4_readpage[s]() functions. This is done to reduce duplicity of code across filesystems. Also, "FS read I/O callbacks" source files will be built only if one of CONFIG_FS_ENCRYPTION and CONFIG_FS_VERITY is enabled. The patchset also modifies fs/buffer.c and fscrypt functionality to get file encryption/decryption to work with subpage-sized blocks. The following fixes from Eric Biggers are prerequisites for this patchset, fscrypt: fix race where ->lookup() marks plaintext dentry as ciphertext fscrypt: only set dentry_operations on ciphertext dentries fscrypt: clear DCACHE_ENCRYPTED_NAME when unaliasing directory fscrypt: fix race allowing rename() and link() of ciphertext dentries fscrypt: clean up and improve dentry revalidation The patches can also be obtained from, "https://github.com/chandanr/linux.git subpage-encryption-v2" Changelog: V1 -> V2: 1. Removed the phrase "post_read_process" from file names and functions. Instead we now use the phrase "read_callbacks" in its place. 2. When performing changes associated with (1), the changes made by the patch "Remove the term 'bio' from post read processing" are made in the earlier patch "Consolidate 'read callbacks' into a new file". Hence the patch "Remove the term 'bio' from post read processing" is removed from the patchset. RFC V2 -> V1: 1. Test and verify FS_CFLG_OWN_PAGES subset of fscrypt_encrypt_page() code by executing fstests on UBIFS. 2. Implement F2fs function call back to check if the contents of a page holding a verity file's data needs to be verified. RFC V1 -> RFC V2: 1. Describe the purpose of "Post processing code" in the cover letter. 2. Fix build errors when CONFIG_FS_VERITY is enabled. Chandan Rajendra (13): ext4: Clear BH_Uptodate flag on decryption error Consolidate "read callbacks" into a new file fsverity: Add call back to decide if verity check has to be performed fsverity: Add call back to determine readpage limit fs/mpage.c: Integrate read callbacks ext4: Wire up ext4_readpage[s] to use mpage_readpage[s] Add decryption support for sub-pagesized blocks ext4: Decrypt all boundary blocks when doing buffered write ext4: Decrypt the block that needs to be partially zeroed fscrypt_encrypt_page: Loop across all blocks mapped by a page range ext4: Compute logical block and the page range to be encrypted fscrypt_zeroout_range: Encrypt all zeroed out blocks of a page ext4: Enable encryption for subpage-sized blocks Documentation/filesystems/fscrypt.rst | 4 +- fs/Kconfig | 4 + fs/Makefile | 4 + fs/buffer.c | 83 +++-- fs/crypto/Kconfig | 1 + fs/crypto/bio.c | 111 ++++--- fs/crypto/crypto.c | 73 +++-- fs/crypto/fscrypt_private.h | 3 + fs/ext4/Makefile | 2 +- fs/ext4/ext4.h | 2 - fs/ext4/inode.c | 47 ++- fs/ext4/page-io.c | 9 +- fs/ext4/readpage.c | 445 -------------------------- fs/ext4/super.c | 39 ++- fs/f2fs/data.c | 148 ++------- fs/f2fs/super.c | 15 +- fs/mpage.c | 51 ++- fs/read_callbacks.c | 155 +++++++++ fs/verity/Kconfig | 1 + fs/verity/verify.c | 12 + include/linux/buffer_head.h | 1 + include/linux/fscrypt.h | 20 +- include/linux/fsverity.h | 2 + include/linux/read_callbacks.h | 22 ++ 24 files changed, 522 insertions(+), 732 deletions(-) delete mode 100644 fs/ext4/readpage.c create mode 100644 fs/read_callbacks.c create mode 100644 include/linux/read_callbacks.h -- 2.19.1