Received: by 2002:a05:6500:1b8a:b0:1ef:a0f1:aef6 with SMTP id df10csp20601lqb; Sun, 10 Mar 2024 03:14:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXzyI0J1pfLvRzoN6GQyOAW6tFVQudDuMEzqph+wtsmB+IoFMwVPuo0Ev4rNPbYE0zHcU/1ZW5s7seZfq+tU6UeMo9Y3G+BK7hed3QDGg== X-Google-Smtp-Source: AGHT+IFBQuU4EAav8vAHw6hfg5NozQQ2K9cAg4VCvmIOT4z4yaU62QTrdL4GqimBGinlbNkKeSx5 X-Received: by 2002:a17:903:442:b0:1dd:1c6f:aec6 with SMTP id iw2-20020a170903044200b001dd1c6faec6mr2991908plb.46.1710065695178; Sun, 10 Mar 2024 03:14:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710065695; cv=pass; d=google.com; s=arc-20160816; b=DJpmxZXaEnyi2USLFB/3/1S/yskggyae5P9iW0YCl9Gg9X6fdxtosKkJBh7a5CxVzD Te0JcolwrV6pIGg7vImLJbP85aZ8n3FCdlt+B70UFjsa13lnkGHDu52jNKDzcUJhz1vp pTzj4OvteKvP0GJ66pJ7JES2QSE6RfdIpUcXGR1MGAgsIPZ2TpvObGCIdbmDc74B19k0 ap0z2Dgo2K8AichHv3nxbuReN6VHuHn324Wu5iLWR4ScoLfaUdwoRatCx55kdvwHo6Mz L/ByDpBobqTmh/DhkiSh1lhLOEYCWyNBCH6w/F27Zj/ZmIJO6oc1hwTfXmA5Ww7PSIJi Wnpw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=9n6Mr0vp6AEBfoJ3O6pzMaPZQWdOBPdvAee8P3mpHbs=; fh=nIP8SQRmPmENrERmvbItxwJ1ZXcGbCSzfAoKPtB+zfU=; b=HRL+TcWlkAaNDVkfJvZy/Zj8mi2aDHI5dwPOu2DGMR9BB19FTEtsdcMgaur6N7ipcj lpg2t0NoFYQVUgedokpHWV5rcqBYZnP6H+JFKQ3/GKzFLB2YI5kZ6g2m3lfOhEPgUUgk 1qs/TYu33g3g4kuibQzkm5IrfX6YkMU0EajBMNgoz3xmD+YfLBd766jsTfnlt/+6qoPn +c/xRRGliRRc/qJhE0UCQPgb6gW95OSaU24xJOdwg2jPnYA3vPGAPPZFPLetcD/I897X fNT2/LoUENEVmIfzNmiWClvvcf10Hll4Cu9cIuuBqgqrcJI4sK46cH1XgGVGlo7PpxAt P1FQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=mmD8ObTy; arc=pass (i=1 spf=pass spfdomain=igalia.com dkim=pass dkdomain=igalia.com); spf=pass (google.com: domain of linux-kernel+bounces-98175-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98175-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id q6-20020a170902a3c600b001dd1b37191asi2713977plb.642.2024.03.10.03.14.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Mar 2024 03:14:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-98175-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=mmD8ObTy; arc=pass (i=1 spf=pass spfdomain=igalia.com dkim=pass dkdomain=igalia.com); spf=pass (google.com: domain of linux-kernel+bounces-98175-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98175-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id D7377281CEE for ; Sun, 10 Mar 2024 10:14:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 950C81F608; Sun, 10 Mar 2024 10:14:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="mmD8ObTy" Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1A76F1EA7D; Sun, 10 Mar 2024 10:14:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710065684; cv=none; b=tQkurPkJlBe+sJ/iyVHEFrVvEGqZVHmPqS8BS3RFGbDVyqS1cJtvHFvk+H7kmuJaX098fInnV3rYlg0F78nXp68Xwi0RbVS7yPvrIK+q2djmPnppnHutcL2i1pqXceWViEFOUPTaJKqWzk4ydTZwskKRFeQrj/145tOY0gpqhCw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710065684; c=relaxed/simple; bh=umNLI3N00wBqjHZiPRTScScF1B97iqyA11vXQdaU6PQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=AGFUpEZE1KMAxHgg1qV+wt2t4NYpWfuDAvbo979T6MUrfUgn1Xgy8y715WdxQxp0QpARWmpLchLci2STWPMbWfwHwbBconEIL25AFF9uupJyRe9PGX5No5P4dm3+uRMfsr18crn8vMy3TEHZJyL4DhahVNUPg5St5hhdZXI6NRs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=mmD8ObTy; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=9n6Mr0vp6AEBfoJ3O6pzMaPZQWdOBPdvAee8P3mpHbs=; b=mmD8ObTysK4ZHXLDcoVg+hucIp WG4Cx5r5DNfTVrttUrRnf7EsGU9v+loejKquJYxpPpwoF1/wjYkvXN58wEbKJ0FBfFeMmhanhVOFb gg/HD3idnIFpE6adSq/j2AO00R4PZijd40v/pMK2c00VSPsLUTI3WVkEBi2aeRLcUuQUnokJUmct6 gNQqgSv26AsZhwz6ArAv5oyhBeyx1sr72Ho3Zk5HejoXdcG2qHHXR63S0Il9BCNwtuBRqeSMNkmy6 HgwamtBY/AaNDkzh226YASlKz7QjjyPgoiy+MpvX/qc1y5fQ7YEcQe2AzwgsEo010GNhQVZRw72Ot O0IAR45A==; Received: from [179.93.183.242] (helo=quatroqueijos.cascardo.eti.br) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1rjGCO-008TBC-2v; Sun, 10 Mar 2024 11:14:32 +0100 Date: Sun, 10 Mar 2024 07:14:26 -0300 From: Thadeu Lima de Souza Cascardo To: OGAWA Hirofumi Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Gwendal Grignou , dlunev@chromium.org Subject: Re: [PATCH] fat: ignore .. subdir and always add a link to dirs Message-ID: References: <87bk88oskz.fsf@mail.parknet.co.jp> <874jdzpov7.fsf@mail.parknet.co.jp> <87zfvroa1c.fsf@mail.parknet.co.jp> <87v86fnz2o.fsf@mail.parknet.co.jp> <87le75s1fg.fsf@mail.parknet.co.jp> <87h6hek50l.fsf@mail.parknet.co.jp> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87h6hek50l.fsf@mail.parknet.co.jp> On Sun, Mar 10, 2024 at 02:52:26PM +0900, OGAWA Hirofumi wrote: > Thadeu Lima de Souza Cascardo writes: > > >> Can you share the image somehow? And fsck (chkdsk, etc.) works without > >> any complain? > > > > Checking the filesystem on Windows runs without any complains, but it turns the > > directory into an useless lump of data. Without checking the filesystem, > > creating and reading files from that directory works just fine. > > > > I tried to use gzip or xz to compress the very sparse filesystem image that I > > got, but they made it larger on disk than it really was. So here is a script > > and pieces of the filesystem that will create a sparse 8GB image. > > I tested a your image with some tweaks. Windows's chkdsk complains about > "BADDIR" directory, and it was fixed by converting it to normal > file. Probably, chkdsk thought that "BADDIR" got ATTR_DIR bit by > corruption. IOW, Windows FATFS driver may accept this image, but > Windows also think this image as corrupt, like chkdsk says. > > I think the app that make this should be fixed. Windows accepts more > than linux though, it looks also think as corrupt. > > If we really want to accept this image, we have to change the fat driver > without affecting good image. And your patch affects to good image, > because that patch doesn't count directory correctly, so bad link count. > Well, it does behave the same on a correct image. It ignores the existence of ".." when counting subdirs, but always adds an extra link count. So, images that have both "." and ".." subdirs, will have the 2 links, both with the patch and without the patch. Images with neither dirs will be rejected before the patch and have a link count of 1 after the patch. Still, creating and removing subdirs will work. Removing the bad dir itself also works. Images with only "." or only ".." would have a link count of 1 and be rejected without the patch. With the patch, directories with only ".." should behave the same as if they had neither subdirs. That is, link count of 1. And directories with only "." will have a link count of 2. Cascardo. > Thanks. > -- > OGAWA Hirofumi