Received: by 10.223.164.221 with SMTP id h29csp803470wrb; Thu, 26 Oct 2017 07:22:58 -0700 (PDT) X-Google-Smtp-Source: ABhQp+T6t4B3Geu7GTMGXp14imDWy3BlkURPHVepFuqpNz+AfshFULyqNlROgPR3r4XQ8VuLQ1Jo X-Received: by 10.84.235.202 with SMTP id m10mr4459591plt.57.1509027778622; Thu, 26 Oct 2017 07:22:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509027778; cv=none; d=google.com; s=arc-20160816; b=k9CdRK8FuehIKggwsGDJhfOcpV02NZpymHbgxpjc1napYqeKIZScupw91EqCQJABN6 BDgEcDdRLxZQJUER7GwYUcg8Xu0aDStQt8f9YNoeJmIxTyxvnm+okvMDQ3tl8OPLL3M4 V2j313KP2vffPUAvYr6DEgFj0p6hiI+UZIMkJG94voTs/F6+9KjuCmLwCqu5H5Ksorwv BxGg57zTa6IrbHJh/Bd8ErVk/3bF2AmIuFS4ZAXdgM8B0FbsaMAAhLVdxC8cqdQUbTYD bbXI3rW8B0Tmp1tLXg0cLb286a5JEny2qTaYVH8zUYV6kuUjhgIhyp4Sc4S/aeVGyACO WkRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=PHifZpUCXAKlBGVOGA+uFoTrUm1tD7wjipCUK1OQUpE=; b=VVg7YsCdL9cIcwWX+1QZ9KYkeQL1ZbjQfh+O4zlcVDfX2950wVg4iuZYtHq+QIBM0O JAt+zoZ9G6xraIz33CKF293e+a1+zkjUMKDws+8n5kWvEx16oiZQ+dBncIbsYpkuOQ0A mavrkh3xb771yEuoO4lsOyLQj4FgA74aI/6bIhiFgTZgOpbP3lhUsesd3lUisTPtdBtm axEPq/jorFtktGlU6coytjmBMgRXj0bEzfJIwBww+36MgfU0p+S99ZBjZmvhdrhdffzP oCHa9j8kXt0/CHnH+jr59s35z5ypWy2HIkRQirJaiBTcOGMEGuLJ1mnhgTV6W8aXyXUv QAhw== ARC-Authentication-Results: i=1; mx.google.com; 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 d2si3019930plh.216.2017.10.26.07.22.45; Thu, 26 Oct 2017 07:22:58 -0700 (PDT) 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; 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 S932458AbdJZOWU (ORCPT + 99 others); Thu, 26 Oct 2017 10:22:20 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:9430 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932410AbdJZOWN (ORCPT ); Thu, 26 Oct 2017 10:22:13 -0400 Received: from 172.30.72.58 (EHLO DGGEMS402-HUB.china.huawei.com) ([172.30.72.58]) by dggrg04-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id DJV82136; Thu, 26 Oct 2017 22:22:08 +0800 (CST) Received: from huawei.com (10.107.193.250) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.361.1; Thu, 26 Oct 2017 22:22:01 +0800 From: Yunlong Song To: , , , , CC: , , , , Subject: [PATCH] f2fs: fix out-of-free problem caused by atomic write Date: Thu, 26 Oct 2017 22:21:55 +0800 Message-ID: <1509027715-80477-1-git-send-email-yunlong.song@huawei.com> X-Mailer: git-send-email 1.8.5.2 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.107.193.250] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.59F1EF91.0010,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 53b355d4dfa19253cb951f3a07761696 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org f2fs_balance_fs only actives once in the commit_inmem_pages, but there are more than one page to commit, so all the other pages will miss the check. This will lead to out-of-free problem when commit a very large file. To fix it, we should do f2fs_balance_fs for each inmem page. Signed-off-by: Yunlong Song --- fs/f2fs/segment.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 46dfbca..fa2c36b 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -384,6 +384,9 @@ static int __commit_inmem_pages(struct inode *inode, unlock_page(page); break; } + f2fs_unlock_op(sbi); + f2fs_balance_fs(sbi, true); + f2fs_lock_op(sbi); /* record old blkaddr for revoking */ cur->old_addr = fio.old_blkaddr; last_idx = page->index; @@ -409,7 +412,6 @@ int commit_inmem_pages(struct inode *inode) int err; INIT_LIST_HEAD(&revoke_list); - f2fs_balance_fs(sbi, true); f2fs_lock_op(sbi); set_inode_flag(inode, FI_ATOMIC_COMMIT); -- 1.8.5.2 From 1583756891187348148@xxx Sat Nov 11 08:17:50 +0000 2017 X-GM-THRID: 1583756891187348148 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread