Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1554230lql; Wed, 13 Mar 2024 00:58:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXjN1KBl00zaA6E4Tw57tfj2ff2YSzUU01U01uePQSSk1MuWXBCdz/nuFYu2G6LU+k7oRBPcSvd2p1OKE784JLQgIK+niQ74hhWAA22ig== X-Google-Smtp-Source: AGHT+IFuInSBaDcWNQSw3vzrsnAwKyjczjOO2ryUDjHnrb3u+NP17o55c+WPwhp2kSizUXPcVlI3 X-Received: by 2002:a05:6a20:4aa8:b0:1a1:6b78:d70 with SMTP id fn40-20020a056a204aa800b001a16b780d70mr7073500pzb.61.1710316739526; Wed, 13 Mar 2024 00:58:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710316739; cv=pass; d=google.com; s=arc-20160816; b=yjnG1DN2939SnR6IwUfGKFjAW9Hg/I3zzY4tlcVY5xAiqvJ1B8tsDBgTEir+mkLXDG m+dxhVdAvgnYg+TA6zyKVcfwkX1uFtj0Xue6YOyzekzv6woF3E/lawg7p11dQeuhhzXL gLNHmOKA2Fsy9BYRHvLWXeXwqCP760JvZU7b4FYJoDrtuiikSwjkIz6E9CysKyf1x0vv CuS2lVk9cv5XCo3bRzZeD3y/7pFSrRAKMr/Z7cfN0M0fPd1iwA2P3igc9TaivuZ0pGYK W5dU7SLZHyRyaQ7rYeMHJNcukoXjpmzOyHj3V5A83S+9WNdgH6pdCOVJmmjRtYHiq3yg XtLw== 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=y3By8P/lmmAckKltg6fI83BkWW0s7sRt/a2ltlsOLZk=; fh=nIP8SQRmPmENrERmvbItxwJ1ZXcGbCSzfAoKPtB+zfU=; b=T2lem3uUIvwbN/bq9K+u1FjMFBFrIUbf+MPwWOMaxIsDlr9ZwCYyTr6g2BCgqXWTBW LoRYMgIPLsEJ0+293bUXy+odLwGknc5ao7/a1flhBsA7dddXa0LE+rKN+/dOeWFTJLbV jkm8agpo7AkDbaTx4ZZysgeksoai/jlctLqF2vI1arbpMMvldC6Yl7jJI7P3u2M3NzSQ TqvtQLYjDM8jgG9m2w/VIa1x3vIgtQU86rHCiBTtb1mVqyL8E2cRArmhjoETqN7cawnO 7IOavcX9xr+mE9Es/jqL/Iajf+bTQ3HbYujhqAauDCwMp/yYbT/w5nJ72GlAY/DTEZz6 l7/w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=UzxXb4FR; arc=pass (i=1 spf=pass spfdomain=igalia.com dkim=pass dkdomain=igalia.com); spf=pass (google.com: domain of linux-kernel+bounces-101186-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101186-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id fa18-20020a056a002d1200b006e67bf06180si8258906pfb.185.2024.03.13.00.58.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 00:58:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-101186-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=UzxXb4FR; arc=pass (i=1 spf=pass spfdomain=igalia.com dkim=pass dkdomain=igalia.com); spf=pass (google.com: domain of linux-kernel+bounces-101186-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101186-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 3AC2F282E30 for ; Wed, 13 Mar 2024 07:58:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BC24017588; Wed, 13 Mar 2024 07:58:51 +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="UzxXb4FR" 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 04D94171A6; Wed, 13 Mar 2024 07:58:46 +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=1710316730; cv=none; b=iAszUwPUbjYTTy2XcTfWyMY5GcgH4pAvfDBd1bFXZOg5LWYno5Ns49jV6fhvz1mOAeW6oHw+mfuV5AviAqrKe10z6y5MKYT6p1vh9iNSHcGzUAvXC8mTHTeQFhz4j0CPdBFTkO1acUXSczoACxKquMRsuloXAh6HcUNHCEB6nMA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710316730; c=relaxed/simple; bh=JlKuSkPUwrhxX3vqcCM8N8UvB8OUNHKL9iWYmIFdDv0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZZUiUx6claVs/uV9KjMtk5QdctsczuCA3iUEnoEpppbOZahmnZVYpy6IutHRfF5sM7ytCqh0AcgeYjzWxAgTtfOfEZEDMdL3QyhkvtK+DD18s1OKSRvoBNLoc+SrhtMAujaKKNslmU1SZoO0lCPg3y4mugbaGME9Oi+L5glr7QE= 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=UzxXb4FR; 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=y3By8P/lmmAckKltg6fI83BkWW0s7sRt/a2ltlsOLZk=; b=UzxXb4FRlE4diPpaDJny1V+AWK dfW6zRl/Iv9JQU5BF5DJv2ry0lyLUkLXk3hU+pQgE7hjTneLobsBDyE3cQ4CXbmwq3IUsgwlewcGF eifIniIDRAMDhewe14wFwLlta6vrH1S5atV1LZ+6v/tI1WbmP52fsx6FxpC8/5xdOXcGQ8X9d1Fco mqAAg0KPuvsYS29psALFTCjuTA/KUHyD5BdhyWFjfeBz4AMHzBScAapaMGzzmU7Kos1bw2UKu5IP3 j/9S+F04aq1rgGFLUSAo9Y1ORlI2cEHtdny1oop8a0iWoF3S4CGH3NHg+9Z1a6AbCkB/TsPAQuPU9 t7IjzWjQ==; 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 1rkJVT-009lNI-Pu; Wed, 13 Mar 2024 08:58:36 +0100 Date: Wed, 13 Mar 2024 04:58:29 -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: <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> <87cys2jfop.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: <87cys2jfop.fsf@mail.parknet.co.jp> On Sun, Mar 10, 2024 at 11:59:34PM +0900, OGAWA Hirofumi wrote: > Thadeu Lima de Souza Cascardo writes: > > >> 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. > > You are forgetting to count about normal dirs other than "." and ".."? > Yes, I was not counting those. The patch simply ignores ".." when counting dirs (which is used only for determining the number of links), and always adds one link. Then, when validating the inode, it also only requires that at least one link exists instead of two. There is only one other instance of fat_subdirs being called and that's when the root dir link count is determined. I left that one unchanged, as usually "." and ".." does not exist there and we always add two links there. Cascardo. > Thanks. > > > 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. > -- > OGAWA Hirofumi