Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3434716imu; Sun, 11 Nov 2018 15:02:30 -0800 (PST) X-Google-Smtp-Source: AJdET5fxtwheiznrX3v+w54I+pm0CB39k7SXyl5uPkCPnD9Nahal0Dw5x4GcYhzdsINybv7RYfpg X-Received: by 2002:a63:1c61:: with SMTP id c33mr1610674pgm.354.1541977350515; Sun, 11 Nov 2018 15:02:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541977350; cv=none; d=google.com; s=arc-20160816; b=Wb0/97H2w7cvpiU2Y+fqmn5iE+06bHQAatRnFK8ZnngnXKGLMMKgmzVIQD5zg0Zau4 TLA7w0W7Fljxtp7XzzIy98gbyoHGCqe86sazKilm6BAmdghHXCTfiEkj5+qNvs9QQ3iP jA/wibBEKua/cQT1XZEZY2GePkUPEGwBTb+vXkc8ydc3PjcrYLHfT7tVwxyqcsAt6kVD J+DCoQ6P3pa3bxz9UCFm8vntuyxh7a9/pXX0No06zGe9Hsm/4TdQiMajwxBJADZp6NR2 f0EV1LpLShh4luRpJJkN3iqR8dJOG8V0Gfj/Ngw7mwyCqGiVPe9IC9wWO8tcfWsNOqHn npKw== 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=zjLRNDj94rNpUg4T/bO8B7+QSkBUU+rbQfTChoqPkl0=; b=WvheDkpiu1ofPSIzcWwSPHDOD5IPD0wSwXN/MU20nUD2H1ezjymGldsgiUugrFn3mK 1it0MTmu2fN10LkrQy2jwvRRfd6W1IRZsVVRNnoLbMOzrCtjV7zWBpEnKdCIhJTSqeVC IEHthuvyjXwjycGL06W7FeowEHWlOzL+97ufo5rON2ytw5aELOzUS/MOhfRTSmKHgz0E TYWnOS1Gmk0EY+pOD7bMZGoliMgrY1wGJzz06dfq8FqUvu6p5xUXC+bP+/fjVVtIlhQo gYm3Kj/jX4xJYqx08Yg/pskmITDnvq16gk3O9Ww0ZaKU4zUuthWIxuxRo3bQbNgdpRyT pjkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WJ89S3b1; 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 t5si8290170pgc.369.2018.11.11.15.02.15; Sun, 11 Nov 2018 15:02:30 -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=WJ89S3b1; 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 S2389601AbeKLIus (ORCPT + 99 others); Mon, 12 Nov 2018 03:50:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:52752 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390709AbeKLIWe (ORCPT ); Mon, 12 Nov 2018 03:22:34 -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 15E4D2243E; Sun, 11 Nov 2018 22:32:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975557; bh=DNyXIbMJDFMh/uBByTzwN69iDd1sQ8HJ53bjsG14pqo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WJ89S3b1hEPljubdqV1S1THNnDbOicLSxyXqEOm73HZjWdt3KLCYhAZ9GcLIJdcQ/ comLzBrUuyPLD6VJTOP2wNvViaXGSNFrTKnopf4jtBXgXsXCVGbWyYbA8mwvES9BAJ qPRzNZkgeosviJSqA1frQcS1pPL9FkhouVv6uexM= 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.14 111/222] f2fs: fix to account IO correctly Date: Sun, 11 Nov 2018 14:23:28 -0800 Message-Id: <20181111221657.724249595@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221647.665769131@linuxfoundation.org> References: <20181111221647.665769131@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.14-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 @@ -381,10 +381,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; }