From patchwork Tue Oct 30 06:15:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Dongyang X-Patchwork-Id: 990667 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ddn.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 42khDd3QXqz9s4s for ; Tue, 30 Oct 2018 17:21:05 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726074AbeJ3PNN (ORCPT ); Tue, 30 Oct 2018 11:13:13 -0400 Received: from mail2-drop-p4.anu.edu.au ([130.56.64.42]:54586 "EHLO mail2-drop-p4.anu.edu.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726040AbeJ3PNN (ORCPT ); Tue, 30 Oct 2018 11:13:13 -0400 X-Greylist: delayed 338 seconds by postgrey-1.27 at vger.kernel.org; Tue, 30 Oct 2018 11:13:11 EDT Received: from mailpmx1.anu.edu.au (snatpool01-3.anu.edu.au [130.56.66.107]) by mail2-drop-p4.anu.edu.au (8.14.7/8.14.7) with ESMTP id w9U6FJjQ113082; Tue, 30 Oct 2018 17:15:19 +1100 Received: from mailpmx1.anu.edu.au (localhost [127.0.0.1]) by localhost (Postfix) with SMTP id 1ADE5805EE; Tue, 30 Oct 2018 17:15:19 +1100 (AEDT) Received: from smtphost1.anu.edu.au (snatpool01-2.anu.edu.au [130.56.66.106]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by mailpmx1.anu.edu.au (Postfix) with ESMTPS id CBA7B80379; Tue, 30 Oct 2018 17:15:17 +1100 (AEDT) Received: from X1C6.localdomain (8.25.220.111.sta.wbroadband.net.au [111.220.25.8]) (authenticated bits=0) by smtphost1.anu.edu.au (8.13.8/8.13.8) with ESMTP id w9U6F1PJ012903 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 30 Oct 2018 17:15:17 +1100 From: Li Dongyang To: linux-ext4@vger.kernel.org Cc: Andreas Dilger Subject: [PATCH] e2fsck: check xattr 'system.data' before setting inline_data feature Date: Tue, 30 Oct 2018 17:15:01 +1100 Message-Id: <20181030061501.24406-1-dongyangli@ddn.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-PMX-Version: 6.4.5.2775670, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2018.10.30.60917, AntiVirus-Engine: 5.53.0, AntiVirus-Data: 2018.10.30.5530000 internal X-OriginatorOrg: anu.edu.au X-PerlMx-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1000_1099 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, LEGITIMATE_SIGNS 0, MULTIPLE_REAL_RCPTS 0, NO_URI_HTTPS 0, RDNS_GENERIC_POOLED 0, RDNS_SUSP 0, RDNS_SUSP_GENERIC 0, SPF_UNKNOWN 0, __ANY_URI 0, __CC_NAME 0, __CC_NAME_DIFF_FROM_ACC 0, __CC_REAL_NAMES 0, __CTE 0, __HAS_CC_HDR 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __INVOICE_MULTILINGUAL 0, __MIME_TEXT_ONLY 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __MIME_VERSION 0, __NO_HTML_TAG_RAW 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS ' Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org ext2fs_inline_data_size will happy return 0 and set size to EXT4_MIN_INLINE_DATA_SIZE even when inode doesn't have xattr 'system.data', a corrupted i_flags could make e2fsck enable the inline_data on the superblock. We should only offer to enable inline_data when i_flags is set and xattr 'system.data' can be found. Signed-off-by: Li Dongyang --- e2fsck/pass1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index 8abf0c33..45534388 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -1496,8 +1496,8 @@ void e2fsck_pass1(e2fsck_t ctx) (ino >= EXT2_FIRST_INODE(fs->super))) { size_t size = 0; - pctx.errcode = ext2fs_inline_data_size(fs, ino, &size); - if (!pctx.errcode && size && + pctx.errcode = get_inline_data_ea_size(fs, ino, &size); + if (!pctx.errcode && fix_problem(ctx, PR_1_INLINE_DATA_FEATURE, &pctx)) { ext2fs_set_feature_inline_data(sb); ext2fs_mark_super_dirty(fs);