From patchwork Tue May 23 00:53:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 9741623 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 E183B60388 for ; Tue, 23 May 2017 00:54:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4E842869A for ; Tue, 23 May 2017 00:54:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C777928779; Tue, 23 May 2017 00:54:30 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 6913F2869A for ; Tue, 23 May 2017 00:54:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759674AbdEWAya (ORCPT ); Mon, 22 May 2017 20:54:30 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:32830 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752580AbdEWAy3 (ORCPT ); Mon, 22 May 2017 20:54:29 -0400 Received: by mail-pf0-f193.google.com with SMTP id f27so23507690pfe.0; Mon, 22 May 2017 17:54:29 -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; bh=5s1C9yCBT7Jjk+QtaFO8Mk79g02xhIFEDbSBCOYG1iA=; b=LxuGg7S3AGu+k2y78VwiaiwN0zNRnHydU1x/1uZqxhmkWhHWEJ2Fg3c5g2E4J6GnCF mH1tZdKLP52HiHeRcWVI7STarKhSyfvS+HmoU2olLxywonunoOfjkXJyqd/+FoF8tCL9 gkX/K5fMjildFVuOv3ecb63HH12PPHLJTGdZDE8EyfPsqmzsqll6HTVD6SZZpTpP2RiN 6GuAQLlYSh4RTpupzKApGEWo6u2bMDDJdyd4ynDbqfeRhG9cxid1GQv9PZqyzWs10hRb S3aLEQ4T5xSbU5N7pgTgM/ZapH/x6zhDnToGYUdiuFdttl0yLOBKuozUXhcz6mVKXEFl +jiQ== 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; bh=5s1C9yCBT7Jjk+QtaFO8Mk79g02xhIFEDbSBCOYG1iA=; b=rJSDsu9RCVLh14ish/Vvz98gnJH//yK/TLZ3Dea0DZQ8Nq57wWyFvwyOvmvFuTnKOo SpMeW/uSTRM6t4GyUL4pobFT4aBaEqcULU/MUvfWd2/bwfdcabj6t30FSx+9wq0MQh+Y EPwXSLHgAfCU83DyqOPZKvOr+muOoOxrRbA3G1nDAd5LE4KFq354iesPL5eLMDbmvdYg Hc4sTm4CnmYQE+Yd+OEfQuuBGoha/ks6FwuD3hFLB+3Jzby0SWXtjGoECFEV/DzK0S+3 1V9OgN/ocCLPvOw//wYeE6QtV3zDwJG4XSy9syBlfvUWGYjyQuaxqkaXERXnMJmUXc9g KFhA== X-Gm-Message-State: AODbwcDg2GeBwJMtp5pvS05p4Aq22V2UJbZ3Y7QAJPaLhZyv5MsS9ODr AUUEacJGj/0+Eg== X-Received: by 10.98.163.152 with SMTP id q24mr28521170pfl.217.1495500868643; Mon, 22 May 2017 17:54:28 -0700 (PDT) Received: from ebiggers-linuxstation.kir.corp.google.com ([100.66.174.39]) by smtp.gmail.com with ESMTPSA id e16sm31136194pfk.100.2017.05.22.17.54.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 May 2017 17:54:28 -0700 (PDT) From: Eric Biggers To: linux-ext4@vger.kernel.org Cc: Theodore Ts'o , linux-fscrypt@vger.kernel.org, Eric Biggers Subject: [PATCH] ext4: remove redundant check for encrypted file on dio write path Date: Mon, 22 May 2017 17:53:16 -0700 Message-Id: <20170523005316.18996-1-ebiggers3@gmail.com> X-Mailer: git-send-email 2.13.0.303.g4ebf302169-goog Sender: linux-fscrypt-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Biggers Currently we don't allow direct I/O on encrypted regular files, so in such cases we return 0 early in ext4_direct_IO(). There was also an additional BUG_ON() check in ext4_direct_IO_write(), but it can never be hit because of the earlier check for the exact same condition in ext4_direct_IO(). There was also no matching check on the read path, which made the write path specific check seem very ad-hoc. Just remove the unnecessary BUG_ON(). Signed-off-by: Eric Biggers Reviewed-by: David Gstir Reviewed-by: Jan Kara --- fs/ext4/inode.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 1bd0bfa547f6..7c6e715b4d2e 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -3629,9 +3629,6 @@ static ssize_t ext4_direct_IO_write(struct kiocb *iocb, struct iov_iter *iter) get_block_func = ext4_dio_get_block_unwritten_async; dio_flags = DIO_LOCKING; } -#ifdef CONFIG_EXT4_FS_ENCRYPTION - BUG_ON(ext4_encrypted_inode(inode) && S_ISREG(inode->i_mode)); -#endif ret = __blockdev_direct_IO(iocb, inode, inode->i_sb->s_bdev, iter, get_block_func, ext4_end_io_dio, NULL, dio_flags);