From patchwork Sat Oct 29 08:08:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9403171 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 19B4D6070F for ; Sat, 29 Oct 2016 08:14:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 056292A597 for ; Sat, 29 Oct 2016 08:14:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE7252A5F2; Sat, 29 Oct 2016 08:14:13 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 A7B102A615 for ; Sat, 29 Oct 2016 08:14:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S942642AbcJ2IOA (ORCPT ); Sat, 29 Oct 2016 04:14:00 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:34433 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S941516AbcJ2INS (ORCPT ); Sat, 29 Oct 2016 04:13:18 -0400 Received: by mail-pf0-f195.google.com with SMTP id u84so3377020pfj.1; Sat, 29 Oct 2016 01:13:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rDeBpsACVE4dX0MHsC11wohEnbPFrpYGGZ57d3Zdelw=; b=C6Hu3R6GPbmJIW+aSAYEmD1TqdCMsHxk5FS4/bLA6HMRNSc977f6kEERvN1lFEC7v1 eupI291ExHefupsBikrrukMApe2Ot9q08FWgdlReg76ti+GFfPWXFo+UsyrtCCoz60y6 nzx0V9NlyXKNwbapNA1kQevaWfOKu3/HrbwWJzVdDrXGSTbLnnXa+BMn6+tKt0wvNrrd MNp8aqFl6kWjfgZDTNm9okKTyngbs/H67XUpwJ/H6udn/fxL644HkecaRGBY4GgGOJcx RC9/lOyieLK04T1BondRJrCDizkr1yaDisKgJsN0benx6TDXyWP4jCg4Usifz8suZBDg 0Gbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rDeBpsACVE4dX0MHsC11wohEnbPFrpYGGZ57d3Zdelw=; b=dzrk0WE5Ha1Qk4zaTGi/NZW7CP9xNLL6vXAI5TjZOwJ7YgUKzyvJThh56MHmLNdQMx J7gWeAvukqgweIlFwEqDdC/7rUJPNt51qrkuRtMsuQaCMFZhdAaj2epap2wm/7UxGS+e riRmBjw9oT/L9NcpNxPzY64HJX2jyipa5UB2yUpzmW9GWVDKpqgdmHpFivnKzddGHIzG fD69FBf9fvjt2mZnSDuw8L/UDu4dFXbd1ia8jpMtASikY8i0ODMtiUigOhkJmHCCfC04 i0rR3yxUsKf5C+kxGFdSvofu/LVnAnva74r1a8WsNBlhfvRXL6e7avMepEMwUYP6ZuDE uZ4w== X-Gm-Message-State: ABUngvc46HyNAYZQ/7EzghNbi2l3ctImUiTxTb/faWAWTmZXKBwYKk11+VinLu2iGKJ2hw== X-Received: by 10.98.137.92 with SMTP id v89mr31615375pfd.64.1477728798243; Sat, 29 Oct 2016 01:13:18 -0700 (PDT) Received: from localhost ([45.34.23.101]) by smtp.gmail.com with ESMTPSA id 5sm23509370pfv.59.2016.10.29.01.13.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 29 Oct 2016 01:13:17 -0700 (PDT) From: Ming Lei To: Jens Axboe , linux-kernel@vger.kernel.org Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, Christoph Hellwig , "Kirill A . Shutemov" , Ming Lei , Alexander Viro Subject: [PATCH 19/60] fs/buffer: comment on direct access to bvec table Date: Sat, 29 Oct 2016 16:08:18 +0800 Message-Id: <1477728600-12938-20-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477728600-12938-1-git-send-email-tom.leiming@gmail.com> References: <1477728600-12938-1-git-send-email-tom.leiming@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Ming Lei --- fs/buffer.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/buffer.c b/fs/buffer.c index b205a629001d..81c3793948b4 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -3018,8 +3018,13 @@ static void end_bio_bh_io_sync(struct bio *bio) void guard_bio_eod(int op, struct bio *bio) { sector_t maxsector; - struct bio_vec *bvec = &bio->bi_io_vec[bio->bi_vcnt - 1]; unsigned truncated_bytes; + /* + * It is safe to truncate the last bvec in the following way + * even though multipage bvec is supported, but we need to + * fix the parameters passed to zero_user(). + */ + struct bio_vec *bvec = &bio->bi_io_vec[bio->bi_vcnt - 1]; maxsector = i_size_read(bio->bi_bdev->bd_inode) >> 9; if (!maxsector)