Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759063AbcCVRzm (ORCPT ); Tue, 22 Mar 2016 13:55:42 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:17943 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750721AbcCVRzc (ORCPT ); Tue, 22 Mar 2016 13:55:32 -0400 From: Jens Axboe To: , , CC: Jens Axboe Subject: [PATCH 2/6] writeback: wb_start_writeback() should use WB_SYNC_ALL for WB_REASON_SYNC Date: Tue, 22 Mar 2016 11:55:16 -0600 Message-ID: <1458669320-6819-3-git-send-email-axboe@fb.com> X-Mailer: git-send-email 2.4.1.168.g1ea28e1 In-Reply-To: <1458669320-6819-1-git-send-email-axboe@fb.com> References: <1458669320-6819-1-git-send-email-axboe@fb.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [192.168.54.13] X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-03-22_09:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 876 Lines: 28 If you call sync, the initial call to wakeup_flusher_threads() ends up calling wb_start_writeback() with reason=WB_REASON_SYNC, but wb_start_writeback() always uses WB_SYNC_NONE as the writeback mode. Ensure that we use WB_SYNC_ALL for a sync operation. Signed-off-by: Jens Axboe --- fs/fs-writeback.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 5c46ed9f3e14..97a9e9987134 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -936,7 +936,10 @@ void wb_start_writeback(struct bdi_writeback *wb, long nr_pages, return; } - work->sync_mode = WB_SYNC_NONE; + if (reason == WB_REASON_SYNC) + work->sync_mode = WB_SYNC_ALL; + else + work->sync_mode = WB_SYNC_NONE; work->nr_pages = nr_pages; work->range_cyclic = range_cyclic; work->reason = reason; -- 2.4.1.168.g1ea28e1