Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1635722lql; Wed, 13 Mar 2024 04:09:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW/ge1vQjcyrmpw8ib+c9rDobQB+nKxdxXzZDXz99nMaqMbYUUUXhW9EVrShmtls38Mft22r4vKnxLsV0g3hc8GRLTE/5lE0bPQ9Yox/Q== X-Google-Smtp-Source: AGHT+IFcYTxUiMHMB0OVo5yqbJldrJVQ8ZRXuPabNz5sqTKL/+hu5de1L6y0CEbZoazLyFKyX37t X-Received: by 2002:ad4:5bea:0:b0:690:c733:f0ab with SMTP id k10-20020ad45bea000000b00690c733f0abmr13418423qvc.37.1710328177615; Wed, 13 Mar 2024 04:09:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710328177; cv=pass; d=google.com; s=arc-20160816; b=eHW/2FUhFyZhTA4SnbteemP+WMfst6tojYcMMkYoDLe4KmygjKthoCOba6Io510ygX QEhbuJyOKEpBNFgywiWYS0tp/fnbYX2K7mTkm7clVhn0uqnYccYmdlj1JL7yknKsZJQU jB6c56/dgUfLAnDRW1ltfcpiGwrCXA9GLOuFOUQmYJvLLr/vu5HRhD1kCKkycBnH9KSX mCKZuPi2ivm42X7CD1tJPGXx/cq5MbcUc5Mpm/GbVAH3QnIkjgTI3xoaa3SMQ7tAj66X +30KIwiW3R+bIHH5sOoc+vKWSdkXY8/ffKHaMFdE+a5DT6fkhxhzXDXQ4fTJDI8oUclF QU4w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:message-id:date:references:in-reply-to:subject:cc:to :from; bh=FABPm+UJgWTmyrHD2VJeFokC1LKfMEyQ3RH71pJuYUo=; fh=8fMNz5XLes1q6KgZpQVNR7IFjb0t+7u9G1PE29ucuLE=; b=MH89qAfh8XX3qAeYMIHtKBWq5bi5ETTTWit1Y3sZnGUr4NJfTF2Al5g1dMkcCvabvn nxBe7nxsXuNJM0vDycZIaLvfzmaVyLtFOniWPRrCUosI/po+DRYP8zVw36Ak2/pqGTZY kApO+dtmlZ1/9ah1D7bDem7pycwe8lx3yTUIlrghJ6QebpCgrc/C1P1tLKVfNJMJzNqT TmeGfgUFlzS98+pHG9GBjqieJCaAerEH+agqWgiD+AiZUXQljmY+zgcb8amUq8yGWMKd eJ9VVgsED4DmemF1gylDZYfFCg/4RUGwlUrW8r2D8SDWZIC5hHccuKHOwtGkfMrQEyNN paug==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=parknet.co.jp); spf=pass (google.com: domain of linux-kernel+bounces-101409-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101409-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id fv3-20020a056214240300b0068fe3142f2bsi9708869qvb.336.2024.03.13.04.09.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 04:09:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-101409-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=parknet.co.jp); spf=pass (google.com: domain of linux-kernel+bounces-101409-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101409-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 4F5EB1C22B3D for ; Wed, 13 Mar 2024 11:09:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1FE8B3F9CC; Wed, 13 Mar 2024 11:06:53 +0000 (UTC) Received: from mail.parknet.co.jp (mail.parknet.co.jp [210.171.160.6]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A5BB03EA7B; Wed, 13 Mar 2024 11:06:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.171.160.6 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710328012; cv=none; b=QwcIrrWg46KQeU8grUJMDqGF9+amZUEOFvAwbdgEI44Z/oS+sLO+/SgM4IH+q0x4ZDz3l8WBIcA/L6bzocHcBNG8a+m46O9Qq7eEhLophGTvCe/EDsQMuwy/QcqwDtCAXUhbosdylQeYQ649FjOeQQ863nJJdUXbgV4yMzvd7XY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710328012; c=relaxed/simple; bh=QUK/mXJR9TF8U4K49/iweWEftEMp+8kuzVs1kUkVfQ0=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=cGelar/KQbuQ9Yhch2BtPOplFzGLp/c2Lf1b4JNjPDUekxxU5Fg5k0MXGUl8qk4xSWtRucigKLeysTbMV18rAOm5D/hXElz8oGfdlWWfEFnIiJtQLihRk7lkYPDiw/c4+Ssb+s4Sjkhfl9cSgOmNM89rgWb3pUey3Nf7KGKlnKU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mail.parknet.co.jp; spf=pass smtp.mailfrom=parknet.co.jp; arc=none smtp.client-ip=210.171.160.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mail.parknet.co.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=parknet.co.jp Received: from ibmpc.myhome.or.jp (server.parknet.ne.jp [210.171.168.39]) by mail.parknet.co.jp (Postfix) with ESMTPSA id 6A780205DB9A; Wed, 13 Mar 2024 20:06:48 +0900 (JST) Received: from devron.myhome.or.jp (foobar@devron.myhome.or.jp [192.168.0.3]) by ibmpc.myhome.or.jp (8.18.1/8.18.1/Debian-1) with ESMTPS id 42DB6gvD219176 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 13 Mar 2024 20:06:43 +0900 Received: from devron.myhome.or.jp (foobar@localhost [127.0.0.1]) by devron.myhome.or.jp (8.18.1/8.18.1/Debian-1) with ESMTPS id 42DB6gQj1312073 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 13 Mar 2024 20:06:42 +0900 Received: (from hirofumi@localhost) by devron.myhome.or.jp (8.18.1/8.18.1/Submit) id 42DB6fSW1312070; Wed, 13 Mar 2024 20:06:41 +0900 From: OGAWA Hirofumi To: Thadeu Lima de Souza Cascardo 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 In-Reply-To: (Thadeu Lima de Souza Cascardo's message of "Wed, 13 Mar 2024 05:41:32 -0300") References: <87v86fnz2o.fsf@mail.parknet.co.jp> <87le75s1fg.fsf@mail.parknet.co.jp> <87h6hek50l.fsf@mail.parknet.co.jp> <87cys2jfop.fsf@mail.parknet.co.jp> <878r2mk14a.fsf@mail.parknet.co.jp> Date: Wed, 13 Mar 2024 20:06:41 +0900 Message-ID: <874jdajsqm.fsf@mail.parknet.co.jp> User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Thadeu Lima de Souza Cascardo writes: >> So you break the mkdir/rmdir link counting, isn't it? >> > > It is off by one on those images with directories without ".." subdir. > Otherwise, everything else works fine. mkdir/rmdir inside such directories work > without any issues as rmdir that same directory. mkdir() increase link count, rmdir decrease link count. Your change set a dir link count always 2? So if there are 3 normal subdirs, and rmdir all those normal dirs, link count underflow. Thanks. > If, on the other hand, we left everything as is and only skipped the > validation, such directories would be created with a link count of 0. Then, > doing a mkdir inside them would crash the kernel with a BUG as we cannot > increment the link count of an inode with 0 links. > > So the idea of the fix here is that, independently of the existence of "..", > the link count will always be at least 1. -- OGAWA Hirofumi