From patchwork Fri Aug 31 03:59:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ernesto_A=2E_Fern=C3=A1ndez?= X-Patchwork-Id: 10583081 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B056714BD for ; Fri, 31 Aug 2018 03:59:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A0F1E2BD94 for ; Fri, 31 Aug 2018 03:59:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 939492BDC8; Fri, 31 Aug 2018 03:59:45 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 470622BD94 for ; Fri, 31 Aug 2018 03:59:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727197AbeHaIFI (ORCPT ); Fri, 31 Aug 2018 04:05:08 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:43742 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726974AbeHaIFI (ORCPT ); Fri, 31 Aug 2018 04:05:08 -0400 Received: by mail-qk1-f195.google.com with SMTP id 130-v6so619373qkd.10 for ; Thu, 30 Aug 2018 20:59:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=OJFs6gF3+e58cXu72JYPTumN7Q0KTEPJT/Uillr6/Vo=; b=EsskqemcLm+IO4O9xvtjE4kKaomb/4Dg2qVSoSPyKdGgOhX4YrBcNr3BucNwGXbkdT XHa439lhCZLmu+tPF7R7w1jx8oIoGtGXfyQ2hMFkgSvtvwkbTGYiK235q1TffvBZWWBs rwwSa0iNsxuQuJdV9xWOo/P21p/8Vqzu/B2SIdd7hpNmnl5evEZ4K6Br0MPbl8LDht+k +TsTIuYPQPGBm8CfPn6KoCWDWJGlpBU4S9O+NWUo1XTQXN6iS11TJ7FTOezbdZ6/rxez JiHpD0fSov6+VY/CbE6EQOfgfy1EfCNGQLPQUzLnEaZs68oIKpIwZub9sznelSKpcoNJ eX9A== 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:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=OJFs6gF3+e58cXu72JYPTumN7Q0KTEPJT/Uillr6/Vo=; b=tN8gaEAUbjgeMnHEgoAhch1R/rJmeFMax5PsNGDkGENsEn0yMwpcBHqSq0ZZ49G4Rm 71MDuVLHd8h+wO1+VPF1A9h8K3V2V/H3tG1HvI7obUg6wn+8erWKx9tfo6j9rENaVrMA 6ZIRijl2yaJoM/bgMfjsjbOp9u9NxUKaG71ruq15662vq9rg7pEci5PvoiQKnrxJk1gS 1WHMD1wjNeUfxMtEV5TYpI4Zq8bYUKwmrQ/gr8llMZYl/Htbsi86Qu6X9v6cYqYZLqcb 7JCvsJAhDjDA3ioTuQlx1ttmHfsXScPs8XmXaa7NZ/syw4uj6w5OfrHnb1Sz6v3edZvu tydA== X-Gm-Message-State: APzg51B3yQXt6G0hpC0RmQjlyPngVbq5p9tEF9dDokqnd9nvpFTbdlqD ZYahD0pE1zpOsBm8B6zk45aEpf/O X-Google-Smtp-Source: ANB0VdZXl4PJjkPXSrwTxqhd4RuSzq2UtyIjxYGScs6sRjNSXNklyWX1SmpoGx/c1W4x0FRDLqQj/g== X-Received: by 2002:a37:d0c:: with SMTP id 12-v6mr13801270qkn.148.1535687983008; Thu, 30 Aug 2018 20:59:43 -0700 (PDT) Received: from eaf ([181.47.179.0]) by smtp.gmail.com with ESMTPSA id v50-v6sm5693118qtc.28.2018.08.30.20.59.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 30 Aug 2018 20:59:42 -0700 (PDT) Date: Fri, 31 Aug 2018 00:59:39 -0300 From: Ernesto =?utf-8?q?A=2E_Fern=C3=A1ndez?= To: linux-fsdevel@vger.kernel.org Cc: Andrew Morton Subject: [PATCH 2/6] hfsplus: fix BUG on bnode parent update Message-ID: <5ee1db09b60373a15890f6a7c835d00e76bf601d.1535682461.git.ernesto.mnd.fernandez@gmail.com> References: <26d882184fc43043a810114258f45277752186c7.1535682461.git.ernesto.mnd.fernandez@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <26d882184fc43043a810114258f45277752186c7.1535682461.git.ernesto.mnd.fernandez@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Creating, renaming or deleting a file may hit BUG_ON() if the first record of both a leaf node and its parent are changed, and if this forces the parent to be split. This bug is triggered by xfstests generic/027, somewhat rarely; here is a more reliable reproducer: truncate -s 50M fs.iso mkfs.hfsplus fs.iso mount fs.iso /mnt i=1000 while [ $i -le 2400 ]; do touch /mnt/$i &>/dev/null ((++i)) done i=2400 while [ $i -ge 1000 ]; do mv /mnt/$i /mnt/$(perl -e "print $i x61") &>/dev/null ((--i)) done The issue is that a newly created bnode is being put twice. Reset new_node to NULL in hfs_brec_update_parent() before reaching goto again. Signed-off-by: Ernesto A. Fernández --- fs/hfsplus/brec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/hfsplus/brec.c b/fs/hfsplus/brec.c index aa17a392b414..1918544a7871 100644 --- a/fs/hfsplus/brec.c +++ b/fs/hfsplus/brec.c @@ -449,6 +449,7 @@ static int hfs_brec_update_parent(struct hfs_find_data *fd) /* restore search_key */ hfs_bnode_read_key(node, fd->search_key, 14); } + new_node = NULL; } if (!rec && node->parent)