Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2333269yba; Sat, 27 Apr 2019 21:31:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqzhjRXo7mkuGx4P4pKQFuBGAd2roESrAlDv4uuvpfn8aDsS5Zpe+IMsWc8qlBs53hMSB+BA X-Received: by 2002:a17:902:bb90:: with SMTP id m16mr17850321pls.340.1556425877899; 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=dFolw65YQaNbYctrwhurm2uzPi3PjWyae8cErvFPnpCZMdJiKR3J8XHXv0thSTAb6I ZpSVijgr0UWrxGWjnvF315CfOWYp3GY9GeiKJ5cQ0DYD+WyOVF3mtD9sima5SRckJfY/ LXvr+QfmLSWMWuJPActFxrf/YkZ9Bsvn7yVn+Q40Z7ylagoKLxN80apa3NjX21PHrqqz f62pMvN+c7Qj5q7w4J7xWKTqsFaFn8A89bV9i2osFkgCJgI77ORYL451Sgnl7xTMqRCX 0cQZRi5Pt2RfRmg1gWt1xupSfOA72McDc11z+M2jGTLTu2sENHcThjKISRBzVRTMOX29 ZErQ== 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:references:in-reply-to:date:subject:cc:to:from; bh=MHV4pQqguddT76jH1t991v1vdZ+G6hCQ2AzOS9DudTo=; b=HgI5BirkghU8QP9liF9U6eeALBlKg1PDwgh6ppZ4DFijgmvypwFZ+F+neHAqUSzzbJ f2qIEAVsAMQDSvTc7tSZLVMuZTB/Gc0P9ogH4+a6zp07G7ks6DuBd6zsIrl6D9dpFQT/ Vfk3915pB49id3GDQtovRdpJt7MRi4ZwcPmOoaaB9r1fwUNhdIuY0WFTdMIe/g7SBe4F hXokB58l8I4PybFQLfRnEUp49p7a4XbKRUm31ZECFY0h+jBVuPkrkkya5MaEUXdpC8iq qaRjQt2wj3EvclSvqmsHAkE1IAWAididVGFJLlXu5/SYUJx+aw96C24+EUO3GLrSZEUp fQXQ== 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 m1si7086852pld.163.2019.04.27.21.31.01; 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 S1726401AbfD1Eas (ORCPT + 99 others); Sun, 28 Apr 2019 00:30:48 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:36624 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725909AbfD1Eas (ORCPT ); Sun, 28 Apr 2019 00:30:48 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x3S4TBT2029088 for ; Sun, 28 Apr 2019 00:30:46 -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 2s54h10yv0-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 28 Apr 2019 00:30:46 -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:41 +0100 Received: from b01cxnp23032.gho.pok.ibm.com (9.57.198.27) 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:37 +0100 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x3S4Uagl35258496 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 28 Apr 2019 04:30:37 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DDAD2112063; Sun, 28 Apr 2019 04:30:36 +0000 (GMT) Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 01BA2112061; Sun, 28 Apr 2019 04:30:33 +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:32 +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 01/13] ext4: Clear BH_Uptodate flag on decryption error Date: Sun, 28 Apr 2019 10:01:09 +0530 X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190428043121.30925-1-chandan@linux.ibm.com> References: <20190428043121.30925-1-chandan@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 19042804-0052-0000-0000-000003B41074 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:40 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19042804-0053-0000-0000-000060ABB1A6 Message-Id: <20190428043121.30925-2-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 On an error return from fscrypt_decrypt_page(), ext4_block_write_begin() can return with the page's buffer_head marked with BH_Uptodate flag. This commit clears the BH_Uptodate flag in such cases. Signed-off-by: Chandan Rajendra --- fs/ext4/inode.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 3c2e7f5a6c84..05b258db8673 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -1225,11 +1225,15 @@ static int ext4_block_write_begin(struct page *page, loff_t pos, unsigned len, if (!buffer_uptodate(*wait_bh)) err = -EIO; } - if (unlikely(err)) + if (unlikely(err)) { page_zero_new_buffers(page, from, to); - else if (decrypt) + } else if (decrypt) { err = fscrypt_decrypt_page(page->mapping->host, page, PAGE_SIZE, 0, page->index); + if (err) + clear_buffer_uptodate(*wait_bh); + } + return err; } #endif -- 2.19.1