Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp811043ybi; Fri, 31 May 2019 09:13:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqxtY6HSqz0FJK7Idvwy5E0gbJJSTiBZdlMRdtA7+QjOFtjc27IYQ4LdveL5c4FkjFqMAPk9 X-Received: by 2002:a17:90a:36d0:: with SMTP id t74mr10334078pjb.4.1559319201462; Fri, 31 May 2019 09:13:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559319201; cv=none; d=google.com; s=arc-20160816; b=E0kBV6ZOvpFJUFjrxbAbzUDEoeOS+2p6CV12x0TUs0yuUov7L86JNe0PrRuV48jtOB 9l/6LxwyICM+QJOQCPkhdwfGux2Eq+wBxwHYJGZfVRxzdr+nYKDdX0rDpMAlJCVNM3hv 5OldYJSQd2fk40C6uh5wnSpBqdIWXDeh7zWVZRQgnBlxIjmT1l1Ub/mgWI0PQ15EW1nX Lw89hvmOcxpATwBYL0Lv8KPselS4z3caHTgNLKBN1gAa+0OTuGgVY/FORPID7Nsv34zS 8LgZRvrVYrP2vz/unoAYXAEj5tkZXbzINoEGzNNT0igiBu3rICGd7X6lSIh/igLu6qCQ IYZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=9YquwEBqeBHxQ787bvAM6ELtHyRo2hGDTHERD7gcEp0=; b=DgUo1i9/jeazmYkhiNeF5CryL+/5SvAnWjTK9j7hbhpSgDRrokldhfkt2jPeqQZA8W h/xebHe41JyMjhCppEReq6lNMoc7DrH16qUn3JI/uqPvWjGjTRak1TJbR/W0rVp938V/ dKejWzNlxeACV/t2gJA2o8ZnvwULjFUQ17134Cq4bZjPFEF4l5LZpXMBwBn3fYX0Yin3 Ehp8qKFfDPDgcKp4WMyxezPAMHnzYw+9LqbiGsZD857/m/hU6+QDVESS7Gb2STo0Itz0 BJrHz8IAv3amHoin+sqpQsfBdiHX1tvfxLiDK6MLIO7IWz+K2XzpjVhGzYUk03FyGHOI N5yg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v21si7157802pfm.18.2019.05.31.09.13.04; Fri, 31 May 2019 09:13:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726683AbfEaQLr (ORCPT + 99 others); Fri, 31 May 2019 12:11:47 -0400 Received: from smtprz14.163.net ([106.3.154.247]:36482 "EHLO smtp.tom.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726037AbfEaQLr (ORCPT ); Fri, 31 May 2019 12:11:47 -0400 Received: from my-app01.tom.com (my-app01.tom.com [127.0.0.1]) by freemail01.tom.com (Postfix) with ESMTP id 38A5B1C81BB1 for ; Fri, 31 May 2019 23:50:59 +0800 (CST) Received: from my-app01.tom.com (HELO smtp.tom.com) ([127.0.0.1]) by my-app01 (TOM SMTP Server) with SMTP ID 390728459 for ; Fri, 31 May 2019 23:50:59 +0800 (CST) Received: from antispam1.tom.com (unknown [172.25.16.55]) by freemail01.tom.com (Postfix) with ESMTP id 5CFC71C81B97 for ; Fri, 31 May 2019 23:50:58 +0800 (CST) Received: from antispam1.tom.com (antispam1.tom.com [127.0.0.1]) by antispam1.tom.com (Postfix) with ESMTP id 583E510018B7 for ; Fri, 31 May 2019 23:50:58 +0800 (CST) X-Virus-Scanned: Debian amavisd-new at antispam1.tom.com Received: from antispam1.tom.com ([127.0.0.1]) by antispam1.tom.com (antispam1.tom.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PcrpKDZU1KxI for ; Fri, 31 May 2019 23:50:57 +0800 (CST) Received: from localhost (unknown [222.209.18.96]) by antispam1.tom.com (Postfix) with ESMTPA id 317E3100112A; Fri, 31 May 2019 23:50:57 +0800 (CST) From: Liu Xiang To: viro@zeniv.linux.org.uk Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, liuxiang_1999@126.com, Liu Xiang Subject: [PATCH v2] fs: buffer: fix fully_mapped reset in block_read_full_page() Date: Fri, 31 May 2019 23:50:51 +0800 Message-Id: <1559317851-3861-1-git-send-email-liu.xiang6@zte.com.cn> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Because get_block() might set the buffer mapped, fully_mapped reset should be done according to the result of buffer_mapped(bh) which check the buffer mapped attribute again after get_block(). Signed-off-by: Liu Xiang --- Changes in v2: change comment fs/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/buffer.c b/fs/buffer.c index e450c55..987aadb 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -2243,7 +2243,6 @@ int block_read_full_page(struct page *page, get_block_t *get_block) if (!buffer_mapped(bh)) { int err = 0; - fully_mapped = 0; if (iblock < lblock) { WARN_ON(bh->b_size != blocksize); err = get_block(inode, iblock, bh, 0); @@ -2251,6 +2250,7 @@ int block_read_full_page(struct page *page, get_block_t *get_block) SetPageError(page); } if (!buffer_mapped(bh)) { + fully_mapped = 0; zero_user(page, i * blocksize, blocksize); if (!err) set_buffer_uptodate(bh); -- 1.9.1