Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1978653pxb; Fri, 5 Mar 2021 04:38:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJxIaKkIsbp4tb+VnGGDBOW5khcXQPChu10D4p2+0M9Gez3UjjvOxgbn33Ks8FLk5kyXyENT X-Received: by 2002:aa7:dd99:: with SMTP id g25mr8725457edv.230.1614947915051; Fri, 05 Mar 2021 04:38:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614947915; cv=none; d=google.com; s=arc-20160816; b=wSBdMd6b/alAYjV6SwyZnNM0FCwJ+qJ+I54skLp4cmj+3N1wh0R8itchWnwUCbbg68 Fu9kM/sghXCJaXX8eisM9eC1ixBwt/13IVRyafHi7xgQ1BqWpGI/eHgKScAf5pOx3tN7 w1w1pfrG8cvcOlHv/77SE0EFEvRkwMziZO8g8a/ALcKVrf4PZhydb87O+nMQSjOyL9g2 GuoZL6ZM+w8czwPCzebPtNvwNJjkt41Z/9NMJgH0cp+E2YScDi611wECwHJLTyM5ae5e 1/2o2D0BaBOdySuvhBvqRAJvvAlZ6femsJyopMv7nRiUi1dKGUWgS7UCjnNy8oIIdq7O Xaow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mD4tfC/GYYP4HwmaTXjZ8wcs+gI0oYpz8VfDkUqC+ws=; b=kPl7U5Z44PtpPCdihbxAIXeCKdAvkXQYgbZOGVFY5ZjQZstMxW2yrKSufLutK+vWwn zsA0YToQ31hzn9ULw03Z5+oQPIq2zOrDD5F2IaTStWfEKsEm+OE0OBhfx1Fc+mxgat4C n03wANNDo7p1w8V/Mh2BStbAEw5e4hbf8WenyQRVV2fGQYrLFd+3WI83C25JrQhKgiNj zvGSBHos3el19EcThYpZMd4n2cPIccd4Ntqmf4W6vhI675nfSLm/BJtOnMfgWVhvZOLE Sz6xuZE75qQyQSTLYHPnMNtaWvELARL+C4ig+c2TTVk1+TM3RmaeKS9kkhTly9rj8QYq ihQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PDYrzOvz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o9si1176279eja.264.2021.03.05.04.38.11; Fri, 05 Mar 2021 04:38:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PDYrzOvz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231330AbhCEMfU (ORCPT + 99 others); Fri, 5 Mar 2021 07:35:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:46426 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232416AbhCEMeq (ORCPT ); Fri, 5 Mar 2021 07:34:46 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 08E0165012; Fri, 5 Mar 2021 12:34:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614947686; bh=ncUlp5/Ewe/nJo/evmWUyWBBqbmFOCyhlo53JqmdYxQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PDYrzOvz+Lf6AhXmHL5lDON51yryukSEPkJjK6xHfPtv1xJQG0Mh8nCMbQ0WpB3IZ 8Z5GdzsPQMvPqPZ7vdfUDDxP62tUZVMT/IQfZ4OdF+WydPG9gRWnrbQpfE4GDUoZrc dskt/wJKJJQQ60KOtOldpMQotHo35mqctpT4QPBg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 5.4 47/72] f2fs: handle unallocated section and zone on pinned/atgc Date: Fri, 5 Mar 2021 13:21:49 +0100 Message-Id: <20210305120859.641720674@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210305120857.341630346@linuxfoundation.org> References: <20210305120857.341630346@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jaegeuk Kim [ Upstream commit 632faca72938f9f63049e48a8c438913828ac7a9 ] If we have large section/zone, unallocated segment makes them corrupted. E.g., - Pinned file: -1 119304647 119304647 - ATGC data: -1 119304647 119304647 Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- fs/f2fs/segment.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index 325781a1ae4d..2034b9a07d63 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -88,11 +88,11 @@ #define BLKS_PER_SEC(sbi) \ ((sbi)->segs_per_sec * (sbi)->blocks_per_seg) #define GET_SEC_FROM_SEG(sbi, segno) \ - ((segno) / (sbi)->segs_per_sec) + (((segno) == -1) ? -1: (segno) / (sbi)->segs_per_sec) #define GET_SEG_FROM_SEC(sbi, secno) \ ((secno) * (sbi)->segs_per_sec) #define GET_ZONE_FROM_SEC(sbi, secno) \ - ((secno) / (sbi)->secs_per_zone) + (((secno) == -1) ? -1: (secno) / (sbi)->secs_per_zone) #define GET_ZONE_FROM_SEG(sbi, segno) \ GET_ZONE_FROM_SEC(sbi, GET_SEC_FROM_SEG(sbi, segno)) -- 2.30.1