[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <874jdajsqm.fsf@mail.parknet.co.jp>
Date: Wed, 13 Mar 2024 20:06:41 +0900
From: OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
To: Thadeu Lima de Souza Cascardo <cascardo@...lia.com>
Cc: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
Gwendal
Grignou <gwendal@...omium.org>, dlunev@...omium.org
Subject: Re: [PATCH] fat: ignore .. subdir and always add a link to dirs
Thadeu Lima de Souza Cascardo <cascardo@...lia.com> 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 <hirofumi@...l.parknet.co.jp>
Powered by blists - more mailing lists