From patchwork Mon Mar 9 03:00:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wanpeng Li X-Patchwork-Id: 5964351 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 C40DB9F380 for ; Mon, 9 Mar 2015 03:19:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F271420254 for ; Mon, 9 Mar 2015 03:19:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1F2592024C for ; Mon, 9 Mar 2015 03:19:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751195AbbCIDTK (ORCPT ); Sun, 8 Mar 2015 23:19:10 -0400 Received: from mga02.intel.com ([134.134.136.20]:20150 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750918AbbCIDTJ (ORCPT ); Sun, 8 Mar 2015 23:19:09 -0400 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 08 Mar 2015 20:19:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,365,1422950400"; d="scan'208";a="464420978" Received: from kernel.bj.intel.com ([10.238.154.97]) by FMSMGA003.fm.intel.com with ESMTP; 08 Mar 2015 20:12:30 -0700 From: Wanpeng Li To: Jaegeuk Kim Cc: Changman Lee , Chao Yu , linux-f2fs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Wanpeng Li Subject: [PATCH 1/3] f2fs: guarantee node/meta inode number won't be reused Date: Mon, 9 Mar 2015 11:00:53 +0800 Message-Id: <1425870055-27694-1-git-send-email-wanpeng.li@linux.intel.com> X-Mailer: git-send-email 1.9.1 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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 Node/Meta inode numbers are also should not be reused, this patch guarantee it. Signed-off-by: Wanpeng Li --- fs/f2fs/node.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 4687eae..1a7e925 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -1421,7 +1421,7 @@ static int add_free_nid(struct f2fs_sb_info *sbi, nid_t nid, bool build) return -1; /* 0 nid should not be used */ - if (unlikely(nid == 0)) + if (unlikely(nid == 0 || nid == 1 || nid == 2)) return 0; if (build) {