From patchwork Fri Dec 6 09:58:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zheng Liu X-Patchwork-Id: 297685 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 6DD332C00A0 for ; Fri, 6 Dec 2013 20:56:42 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757752Ab3LFJ4c (ORCPT ); Fri, 6 Dec 2013 04:56:32 -0500 Received: from mail-pb0-f47.google.com ([209.85.160.47]:52494 "EHLO mail-pb0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757739Ab3LFJ40 (ORCPT ); Fri, 6 Dec 2013 04:56:26 -0500 Received: by mail-pb0-f47.google.com with SMTP id um1so781274pbc.6 for ; Fri, 06 Dec 2013 01:56:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8xd3WhZ8QZPGqwS9TbDESxW1hoQBdNB2c63gJog+LMQ=; b=BdrONKbfyOW8R+i1MDcAVFVmTmJrmJv4Kc4VPcSPLtZOxx/tf6k6vdT2Ra6oNbuqfS 4GKT9AeZxp7xfUvWui1uX9HEfxywTTGggFV4faLzBzKPCMcZyZHli/mJ0ooO8S26l7Vl 2hNngFdVR+fdH39XcFp9NlTXtoPr/Z2N9g7/oSsRlqVe7SdjRFXm+9Pmo4w9KETBCSZl 1ZKq/AGwVUC9WLFPH5vr6zfTbL4MikkP/lL2/4lXbKA8AMF3vU3YoTlBS9ITX1jx36Mc 4gf/AOweUNcGyulL5MW/zMgTCXDJTk8UBsP0JV7tE18WHNkZp8Mo47MBmNIWtIcvZyX4 Hj1w== X-Received: by 10.68.204.136 with SMTP id ky8mr2229104pbc.33.1386323785882; Fri, 06 Dec 2013 01:56:25 -0800 (PST) Received: from alpha.taobao.ali.com ([182.92.247.2]) by mx.google.com with ESMTPSA id m2sm56582620pbn.19.2013.12.06.01.56.23 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 06 Dec 2013 01:56:25 -0800 (PST) From: Zheng Liu To: linux-ext4@vger.kernel.org Cc: Theodore Ts'o , "Darrick J. Wong" , Zheng Liu Subject: [PATCH v3 26/30] e2fsck: check inline_data in pass3 Date: Fri, 6 Dec 2013 17:58:13 +0800 Message-Id: <1386323897-2354-27-git-send-email-wenqing.lz@taobao.com> X-Mailer: git-send-email 1.7.9.7 In-Reply-To: <1386323897-2354-1-git-send-email-wenqing.lz@taobao.com> References: <1386323897-2354-1-git-send-email-wenqing.lz@taobao.com> Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Zheng Liu In e2fsck_expand_directory() we don't handle a dir with inline data because when this function is called the directory inode shouldn't contains inline data. Signed-off-by: Theodore Ts'o Signed-off-by: Zheng Liu --- e2fsck/pass3.c | 12 ++++++++++++ e2fsck/problem.c | 5 +++++ e2fsck/problem.h | 3 +++ e2fsck/rehash.c | 2 ++ 4 files changed, 22 insertions(+) diff --git a/e2fsck/pass3.c b/e2fsck/pass3.c index 2dd414b..2cab41d 100644 --- a/e2fsck/pass3.c +++ b/e2fsck/pass3.c @@ -375,6 +375,17 @@ ext2_ino_t e2fsck_get_lost_and_found(e2fsck_t ctx, int fix) if (retval && !fix) return 0; if (!retval) { + /* Lost+found shouldn't have inline data */ + retval = ext2fs_read_inode(fs, ino, &inode); + if (fix && retval) + return 0; + + if (fix && (inode.i_flags & EXT4_INLINE_DATA_FL)) { + if (!fix_problem(ctx, PR_3_LPF_INLINE_DATA, &pctx)) + return 0; + goto unlink; + } + if (ext2fs_check_directory(fs, ino) == 0) { ctx->lost_and_found = ino; return ino; @@ -387,6 +398,7 @@ ext2_ino_t e2fsck_get_lost_and_found(e2fsck_t ctx, int fix) if (!fix_problem(ctx, PR_3_LPF_NOTDIR, &pctx)) return 0; +unlink: /* OK, unlink the old /lost+found file. */ pctx.errcode = ext2fs_unlink(fs, EXT2_ROOT_INO, name, ino, 0); if (pctx.errcode) { diff --git a/e2fsck/problem.c b/e2fsck/problem.c index a4f7749..471cec7 100644 --- a/e2fsck/problem.c +++ b/e2fsck/problem.c @@ -1597,6 +1597,11 @@ static struct e2fsck_problem problem_table[] = { N_("/@l is not a @d (ino=%i)\n"), PROMPT_UNLINK, 0 }, + /* Lost+found has inline data */ + { PR_3_LPF_INLINE_DATA, + N_("/@l has inline data\n"), + PROMPT_CLEAR, 0 }, + /* Pass 3A Directory Optimization */ /* Pass 3A: Optimizing directories */ diff --git a/e2fsck/problem.h b/e2fsck/problem.h index 9d41cea..8219b84 100644 --- a/e2fsck/problem.h +++ b/e2fsck/problem.h @@ -955,6 +955,9 @@ struct problem_context { /* Lost+found is not a directory */ #define PR_3_LPF_NOTDIR 0x030017 +/* Lost+found has inline data */ +#define PR_3_LPF_INLINE_DATA 0x030018 + /* * Pass 3a --- rehashing diretories */ diff --git a/e2fsck/rehash.c b/e2fsck/rehash.c index 6ef3568..b254e81 100644 --- a/e2fsck/rehash.c +++ b/e2fsck/rehash.c @@ -814,6 +814,8 @@ retry_nohash: /* Read in the entire directory into memory */ retval = ext2fs_block_iterate3(fs, ino, 0, 0, fill_dir_block, &fd); + if (retval == EXT2_ET_INLINE_DATA_CANT_ITERATE) + goto errout; if (fd.err) { retval = fd.err; goto errout;