From patchwork Fri Oct 10 20:57:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 5067391 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9D4CEC11AC for ; Fri, 10 Oct 2014 20:57:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C4E2C20212 for ; Fri, 10 Oct 2014 20:57:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F12E42020E for ; Fri, 10 Oct 2014 20:57:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755175AbaJJU5w (ORCPT ); Fri, 10 Oct 2014 16:57:52 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:34723 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755112AbaJJU5n (ORCPT ); Fri, 10 Oct 2014 16:57:43 -0400 Received: from pps.filterd (m0004003 [127.0.0.1]) by mx0b-00082601.pphosted.com (8.14.5/8.14.5) with SMTP id s9AKsFoM012653 for ; Fri, 10 Oct 2014 13:57:42 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=3WeteY8LUFPWxOLbdzFOlTfu0riqutje4SCGi4eq8yI=; b=Q0YdFBWPenKDMDPtZjv4+msylunjT1mQusJBWaq8shnUrWkXyzGgNajhXN0RKUTSGgP3 1og114VpnY3NMfTAgZ994rW9Cyov9Pwlp2D3NubZf26pUfAwsk3wcjSNmL2tQpIDlBJH rOLW4CH8AjgSWzgZwy+pQbCrlWl90DQ7wVY= Received: from mail.thefacebook.com (mailwest.thefacebook.com [173.252.71.148]) by mx0b-00082601.pphosted.com with ESMTP id 1pxmbv8mwc-2 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=OK) for ; Fri, 10 Oct 2014 13:57:42 -0700 Received: from localhost (192.168.57.29) by mail.thefacebook.com (192.168.16.21) with Microsoft SMTP Server (TLS) id 14.3.195.1; Fri, 10 Oct 2014 13:57:40 -0700 From: Josef Bacik To: Subject: [PATCH 09/12] Btrfs-progs: add a dummy backref if our location is wrong Date: Fri, 10 Oct 2014 16:57:14 -0400 Message-ID: <1412974637-31334-10-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1412974637-31334-1-git-send-email-jbacik@fb.com> References: <1412974637-31334-1-git-send-email-jbacik@fb.com> MIME-Version: 1.0 X-Originating-IP: [192.168.57.29] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.12.52, 1.0.28, 0.0.0000 definitions=2014-10-10_08:2014-10-10, 2014-10-10, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 kscore.is_bulkscore=3.22436945088267e-07 kscore.compositescore=0 circleOfTrustscore=514.84 compositescore=0.999775624998249 urlsuspect_oldscore=0.999775624998249 suspectscore=1 recipient_domain_to_sender_totalscore=0 phishscore=0 bulkscore=0 kscore.is_spamscore=0 recipient_to_sender_totalscore=0 recipient_domain_to_sender_domain_totalscore=64355 rbsscore=0.999775624998249 spamscore=0 recipient_to_sender_domain_totalscore=0 urlsuspectscore=0.9 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1410100175 X-FB-Internal: deliver Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If our location is bogus in our dir item we were just skipping the thing. However in this case we want to just delete the dir index, so create a dummy inode rec using BTRFS_MULTIPLE_OBJECTIDS and just add every backref we find to the list so we know to straight up delete all of these items. Thanks, Signed-off-by: Josef Bacik --- cmds-check.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmds-check.c b/cmds-check.c index 8fdc542..ca890cc 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -551,6 +551,8 @@ static struct inode_backref *get_inode_backref(struct inode_record *rec, struct inode_backref *backref; list_for_each_entry(backref, &rec->backrefs, list) { + if (rec->ino == BTRFS_MULTIPLE_OBJECTIDS) + break; if (backref->dir != dir || backref->namelen != namelen) continue; if (memcmp(name, backref->name, namelen)) @@ -990,7 +992,11 @@ static int process_dir_item(struct btrfs_root *root, namebuf, len, filetype, key->type, error); } else { - fprintf(stderr, "warning line %d\n", __LINE__); + fprintf(stderr, "invalid location in dir item %u\n", + location.type); + add_inode_backref(inode_cache, BTRFS_MULTIPLE_OBJECTIDS, + key->objectid, key->offset, namebuf, + len, filetype, key->type, error); } len = sizeof(*di) + name_len + data_len;