Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3478992imu; Sun, 11 Nov 2018 16:02:48 -0800 (PST) X-Google-Smtp-Source: AJdET5fs4nYAiPcOgpDEWdQ/F4GJubz6QuzLZn3l08gmPtH770jFlj9Bn22U9e+xzlGCwgue4lYy X-Received: by 2002:a63:4d0e:: with SMTP id a14mr12696452pgb.408.1541980968762; Sun, 11 Nov 2018 16:02:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541980968; cv=none; d=google.com; s=arc-20160816; b=SPAnoxc+o77+4P0DueSshJLkInQcR2QSPVFt6Qmvy1OMa774i5iuJ4LytCIeVPUuVg y6jRbwernHVb+MB8uccUktNguYqeHBq49XTrl1IjN993jdyyPwm/FvCovJXxCc3JamCI KB50HmEv65GySHi9Rk8FKnjCIQKe3BSbUvxXi/EHBdHykQSU4KinWlPG/WlkMGNGoKAY kyqHCSQAcK0oI96ThR5xKkfiQJnOLwRyn5KZVECSH+umLR5fQ20f1iv9pbuy+NPgN76m KEQhkMfvLOZ5GUv+MOOXC8/nimqVOalzXDCe9eeSDKysZUoUdWXNUNDydcJ8BhQdI4tp frgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Pps87iz9p8BE9QQAldPWC/CAkCkGyUrvbeapsENjSOM=; b=KpNnKt2AzZuKlJn/YpdcEhA4Nn0CXKXPDZBAEgBLXlDvPy9H+/nOYP7hfoDApfOqBs owUwnQzAPxeiGA4eMwVwu7CwMqSGqZdKQJuwhqUb8SShRGrU9bQhiKqw1mmBrmCUb1qd 0NjYvkZu+CYAeWavNZoRQTqXcPz+ny8BCnUtA0GqtwffEY9n3f6n8LhDaQupJRzcLaxD /MEHv/tORmaLC6mQdNDT4ikTV3JF+JdUxissRRGiHxb+9ZT0cH4NIgysZ+lJiJwDHLdH qWtrLb4zRdqfPZE1o0XpMvLcdxMKkOy8GvGr0kcCwwAHygdGL2id3ppDTqUhTeJl3fia oxNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nH24c+1N; 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 22si14827001pgr.356.2018.11.11.16.02.33; Sun, 11 Nov 2018 16:02:48 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=nH24c+1N; 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 S1732367AbeKLJw3 (ORCPT + 99 others); Mon, 12 Nov 2018 04:52:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:35268 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732159AbeKLIRy (ORCPT ); Mon, 12 Nov 2018 03:17:54 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2789C21104; Sun, 11 Nov 2018 22:27:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975279; bh=4zW2bKzTn7Rp+duCPgx8uFFfY4kVczZkJre7t5PiL0o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nH24c+1NCIYUkLj+56++aMAbunKNdQ771g1RhSpdi9ADWCxPJqW6/0dnqIOO3Wkiq ERKqUZs5Tr5pQ3j9sznI0cFi6+UvIfogGy8GpQazMBiDTUojhqng0RtiCcrOHilvdW AaejngOKtg37g6pxxpXlqQyI17Tk/bE1ckG2tkB8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim Subject: [PATCH 4.19 195/361] f2fs: fix to account IO correctly Date: Sun, 11 Nov 2018 14:19:02 -0800 Message-Id: <20181111221647.825819091@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chao Yu commit 4c58ed076875f36dae0f240da1e25e99e5d4afb8 upstream. Below race can cause reversed reference on dirty count, fix it by relocating __submit_bio() and inc_page_count(). Thread A Thread B - f2fs_inplace_write_data - f2fs_submit_page_bio - __submit_bio - f2fs_write_end_io - dec_page_count - inc_page_count Cc: Fixes: d1b3e72d5490 ("f2fs: submit bio of in-place-update pages") Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/data.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -463,10 +463,10 @@ int f2fs_submit_page_bio(struct f2fs_io_ bio_set_op_attrs(bio, fio->op, fio->op_flags); - __submit_bio(fio->sbi, bio, fio->type); - if (!is_read_io(fio->op)) inc_page_count(fio->sbi, WB_DATA_TYPE(fio->page)); + + __submit_bio(fio->sbi, bio, fio->type); return 0; }