Re: [PATCH] fat: ignore .. subdir and always add a link to dirs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Mar 10, 2024 at 02:52:26PM +0900, OGAWA Hirofumi wrote:
> Thadeu Lima de Souza Cascardo <cascardo@xxxxxxxxxx> 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 <hirofumi@xxxxxxxxxxxxxxxxxx>




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux