From patchwork Wed May 9 11:45:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carlos Maiolino X-Patchwork-Id: 10389217 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 40AFE60236 for ; Wed, 9 May 2018 11:47:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2671728F21 for ; Wed, 9 May 2018 11:47:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B19928F23; Wed, 9 May 2018 11:47:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C09CB28F21 for ; Wed, 9 May 2018 11:47:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934209AbeEILrG (ORCPT ); Wed, 9 May 2018 07:47:06 -0400 Received: from mail-wm0-f47.google.com ([74.125.82.47]:38791 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934759AbeEILp6 (ORCPT ); Wed, 9 May 2018 07:45:58 -0400 Received: by mail-wm0-f47.google.com with SMTP id y189-v6so9011192wmc.3 for ; Wed, 09 May 2018 04:45:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:mime-version:content-disposition:user-agent; bh=A8vr8kCNkNBSry84IkOZPPhJSyA2gi/EixxJ9T2etZU=; b=CmQ+x3CQHb1WfqFsXuJ72ybmmbhWuEv9RX4nv5zbhiqLOiTGFrExgGgThzIEhNxY1b zdzUW2ZLzccKKWISVrxcHOF0gh4fNPD5Fki9wRlPa3MlII08FDdic5PcMLEmQyFZ2r3+ CHvJxuaxgyu2yyfZT8TrDWg7kjDQ2kfUbAIxtG8IhjwYMimOV3w+4WhkBcEq9Yd6oc/j uBbohst6imZsR85yiuNlMVoxj1g4NG9C7Zpcj03JLzP7mCXcViEt6udnpS919GmYQIJT ScRXq96BWs5UN4ejj+9ZKOK3SdjWF+Ptm+nWm72ooELZ+L9Ji7pN3Fa23LL8Fry4wizs dowA== X-Gm-Message-State: ALQs6tCJbHifde779X0+wGXpfTECZ0NeLFxSk5Fg4+9TIQ8BLRDtqnSv UiBlqO3oRtvi/FqfHs81d/IEMSOm3h0= X-Google-Smtp-Source: AB8JxZqR47RfLd5i3JiIecHkkCL3K0uKL1uq095uy1TV28AxF32A0AlgiwdouxXYUvc+KpJojk2byg== X-Received: by 2002:a50:ddc4:: with SMTP id x4-v6mr41934151edk.221.1525866357377; Wed, 09 May 2018 04:45:57 -0700 (PDT) Received: from odin.usersys.redhat.com (ip-86-49-61-71.net.upcbroadband.cz. [86.49.61.71]) by smtp.gmail.com with ESMTPSA id x49-v6sm7439442edb.5.2018.05.09.04.45.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 09 May 2018 04:45:56 -0700 (PDT) Date: Wed, 9 May 2018 13:45:54 +0200 From: Carlos Maiolino To: linux-xfs@vger.kernel.org Cc: sandeen@redhat.com Subject: xfs_db and ASSERT fails dur type mismatch Message-ID: <20180509114554.2slvfi3hqt4na6vy@odin.usersys.redhat.com> Mail-Followup-To: linux-xfs@vger.kernel.org, sandeen@redhat.com MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20180323 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hey folks, I've been thinking about different ways to fix those crashes on xfs_db due type mismatch, based on the previous discussion and a chat I had with Eric on irc. After thinking a bit more about it, I do think using unknown header types adds unneeded extra complexity to the code, to achieve the same result as an extra check on print_flist_1(). Adding an unknown type, will require a change to all types affected by this issue. I am not sure if a single unknown type can be used for all metadata types which is affected by this, but I think it requires an unknown type for each of these metadata. Or at least an entry for an unknown header type (in case of of the known ones are not found). While, the crash caused by unrecognized metadata when using these types, can be fixed by something like my original change. I wrote a slightly different patch like this: This will still keep printing "(empty)" where it should be printed, or print out a hint that something went wrong. I honestly think this the best solution for these crashes, what you guys think? Cheers Reviewed-by: Darrick J. Wong diff --git a/db/print.c b/db/print.c index 0da36c27..f8a48281 100644 --- a/db/print.c +++ b/db/print.c @@ -160,9 +160,10 @@ print_flist_1( (f->flags & FLD_ARRAY) != 0); if (neednl) dbprintf("\n"); - } else { - ASSERT(fa->arg & FTARG_OKEMPTY); + } else if (fa->arg & FTARG_OKEMPTY) { dbprintf(_("(empty)\n")); + } else { + dbprintf(_("Unrecognized metadata or type mismatch\n")); } } free_strvec(pfx);