From patchwork Tue Aug 5 01:07:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Darrick Wong X-Patchwork-Id: 376509 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id DA0F1140080 for ; Tue, 5 Aug 2014 11:07:18 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753493AbaHEBHQ (ORCPT ); Mon, 4 Aug 2014 21:07:16 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:44565 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753235AbaHEBHO (ORCPT ); Mon, 4 Aug 2014 21:07:14 -0400 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s7517BMR001792 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 5 Aug 2014 01:07:12 GMT Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s7517BjM015856 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 5 Aug 2014 01:07:11 GMT Received: from abhmp0020.oracle.com (abhmp0020.oracle.com [141.146.116.26]) by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s7517Bm2018307; Tue, 5 Aug 2014 01:07:11 GMT Received: from localhost (/24.21.154.84) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 04 Aug 2014 18:07:10 -0700 Subject: [PATCH 20/21] e2fsck: don't set prev after processing '..' on an inline dir From: "Darrick J. Wong" To: tytso@mit.edu, darrick.wong@oracle.com Cc: linux-ext4@vger.kernel.org Date: Mon, 04 Aug 2014 18:07:09 -0700 Message-ID: <20140805010709.2611.18449.stgit@birch.djwong.org> In-Reply-To: <20140805010457.2611.89813.stgit@birch.djwong.org> References: <20140805010457.2611.89813.stgit@birch.djwong.org> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Source-IP: acsinet22.oracle.com [141.146.126.238] Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org In an inline directory, the '..' entry is compacted down to just the inode number; there is no full '..' entry. Therefore, it makes no sense to assign 'prev' to the fake dotdot entry we put on the stack, as this could confuse a salvage_directory call on a corrupted next entry into modifying stack contents (the fake dotdot entry). Signed-off-by: Darrick J. Wong --- e2fsck/pass2.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c index ed2c4d7..fb98af5 100644 --- a/e2fsck/pass2.c +++ b/e2fsck/pass2.c @@ -1330,8 +1330,19 @@ skip_checksum: if (!inline_data_size || dot_state > 1) { offset += rec_len; } else { - if (dot_state == 1) + if (dot_state == 1) { offset = 4; + /* + * If we get here, we're checking an inline + * directory and we've just checked a (fake) + * dotdot entry that we created on the stack. + * Therefore set 'prev' to NULL so that if we + * call salvage_directory on the next entry, + * it won't try to absorb the next entry into + * the on-stack dotdot entry. + */ + prev = NULL; + } } dot_state++; } while (is_last_entry(fs, inline_data_size, offset, de_csum_size));