From patchwork Thu May 14 00:24:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaegeuk Kim X-Patchwork-Id: 6401641 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 09F43BEEE1 for ; Thu, 14 May 2015 00:26:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4F224203B1 for ; Thu, 14 May 2015 00:26:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 65B43203B0 for ; Thu, 14 May 2015 00:26:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934609AbbENAZH (ORCPT ); Wed, 13 May 2015 20:25:07 -0400 Received: from mail.kernel.org ([198.145.29.136]:48544 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933091AbbENAYW (ORCPT ); Wed, 13 May 2015 20:24:22 -0400 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 72C6B203F3; Thu, 14 May 2015 00:24:21 +0000 (UTC) Received: from localhost (mobile-166-171-250-039.mycingular.net [166.171.250.39]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8834D203B0; Thu, 14 May 2015 00:24:20 +0000 (UTC) Date: Wed, 13 May 2015 17:24:17 -0700 From: Jaegeuk Kim To: hujianyang Cc: "linux-fsdevel@vger.kernel.org" , linux-f2fs-devel@lists.sourceforge.net Subject: Re: [f2fs-dev] Space leak in f2fs Message-ID: <20150514002417.GC68412@jaegeuk-mac02> References: <5552FA7D.7000704@huawei.com> <20150513174417.GA56247@jaegeuk-mac02.mot.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20150513174417.GA56247@jaegeuk-mac02.mot.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Hi Hu, Found a bug in the previous patch. Could you check this out? Thanks, --- fs/f2fs/super.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 19438f2..647591b 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -431,8 +431,17 @@ static int f2fs_drop_inode(struct inode *inode) * - f2fs_gc -> iput -> evict * - inode_wait_for_writeback(inode) */ - if (!inode_unhashed(inode) && inode->i_state & I_SYNC) + if (!inode_unhashed(inode) && inode->i_state & I_SYNC) { + if (!inode->i_nlink && !is_bad_inode(inode)) { + spin_unlock(&inode->i_lock); + i_size_write(inode, 0); + + if (F2FS_HAS_BLOCKS(inode)) + f2fs_truncate(inode); + spin_lock(&inode->i_lock); + } return 0; + } return generic_drop_inode(inode); }