From patchwork Mon Feb 2 22:51:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaegeuk Kim X-Patchwork-Id: 5765281 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 037DE9F2ED for ; Mon, 2 Feb 2015 22:51:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 35625209EF for ; Mon, 2 Feb 2015 22:51:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5DB06209E9 for ; Mon, 2 Feb 2015 22:51:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965384AbbBBWvX (ORCPT ); Mon, 2 Feb 2015 17:51:23 -0500 Received: from mail.kernel.org ([198.145.29.136]:41004 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965327AbbBBWvX (ORCPT ); Mon, 2 Feb 2015 17:51:23 -0500 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 15A25209EF; Mon, 2 Feb 2015 22:51:22 +0000 (UTC) Received: from localhost (unknown [166.170.40.129]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1DB1B209E9; Mon, 2 Feb 2015 22:51:21 +0000 (UTC) From: Jaegeuk Kim To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Cc: Jaegeuk Kim Subject: [PATCH 1/2] f2fs: keep PagePrivate during releasepage Date: Mon, 2 Feb 2015 14:51:18 -0800 Message-Id: <1422917479-36393-1-git-send-email-jaegeuk@kernel.org> X-Mailer: git-send-email 2.1.1 X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 If PagePrivate is removed by releasepage, f2fs loses counting dirty pages. e.g., try_to_release_page will not release page when the page is dirty, but our releasepage removes PagePrivate. [] try_to_release_page+0x35/0x50 [] invalidate_inode_pages2_range+0x2f9/0x3b0 [] ? truncate_blocks+0x384/0x4d0 [f2fs] [] ? f2fs_direct_IO+0x283/0x290 [f2fs] [] ? get_data_block_fiemap+0x20/0x20 [f2fs] [] generic_file_direct_write+0x163/0x170 [] __generic_file_write_iter+0x2a6/0x350 [] generic_file_write_iter+0x3f/0xb0 [] new_sync_write+0x81/0xb0 [] vfs_write+0xb7/0x1f0 [] SyS_write+0x49/0xb0 [] system_call_fastpath+0x16/0x1b Signed-off-by: Jaegeuk Kim Reviewed-by: Chao Yu --- fs/f2fs/checkpoint.c | 4 ++++ fs/f2fs/data.c | 4 ++++ fs/f2fs/node.c | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index f7cdcad..470fa58 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -321,6 +321,10 @@ static void f2fs_invalidate_meta_page(struct page *page, unsigned int offset, static int f2fs_release_meta_page(struct page *page, gfp_t wait) { + /* If this is dirty page, keep PagePrivate */ + if (PageDirty(page)) + return 0; + ClearPagePrivate(page); return 1; } diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 6d9e6e4..27dc3fd 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -1130,6 +1130,10 @@ static void f2fs_invalidate_data_page(struct page *page, unsigned int offset, static int f2fs_release_data_page(struct page *page, gfp_t wait) { + /* If this is dirty page, keep PagePrivate */ + if (PageDirty(page)) + return 0; + ClearPagePrivate(page); return 1; } diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 05e6faa..9feda38 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1381,6 +1381,10 @@ static void f2fs_invalidate_node_page(struct page *page, unsigned int offset, static int f2fs_release_node_page(struct page *page, gfp_t wait) { + /* If this is dirty page, keep PagePrivate */ + if (PageDirty(page)) + return 0; + ClearPagePrivate(page); return 1; }