mbox series

[00/18] fs: fat: fix long name support

Message ID 20201129020216.4865-1-xypron.glpk@gmx.de
Headers show
Series fs: fat: fix long name support | expand

Message

Heinrich Schuchardt Nov. 29, 2020, 2:01 a.m. UTC
Since long name support was added to U-Boot's implementation of the
FAT file system corruption of the directories was observed when running
the UEFI Self Certifification Test.

The following problems are addressed by this series.

* short names were not unique
* long names directory entries were not deleted when a file was deleted
* directory entries released by file deletion were not reused

The first four patches are just resent to indicate the import sequence.

The following problems need to be addressed in further patches:

* When extending a file only available FAT entries after the last cluster
  of the file are considered. Available FAT entries before are ignored.
* The case of no FAT entry found is not treated correctly.
* The free FAT count is not updated on FAT32.
* Some FAT related tests are not run on Gitlab CI.
* Add tests to detect directory corruption.

Heinrich Schuchardt (18):
  fs: fat: avoid NULL dereference when root dir is full
  fs: fat: directory entries starting with 0x05
  fs: fat: use ATTR_ARCH instead of anonymous 0x20
  fs: fat: correct first cluster for '..'
  fs: fat: export fat_next_cluster()
  fs: fat: create correct short names
  fs: fat: pass shortname to fill_dir_slot
  fs: fat: call set_name() only once
  fs: fat: generate unique short names
  fs: fat: dentry iterator for fill_dir_slot()
  fs: fat: set start cluster for root directory
  fs: fat: flush new directory cluster
  fs: fat: fat_find_empty_dentries()
  fs: fat: reuse deleted directory entries
  fs: fat: search file should not allocate cluster
  fs: fat: use constant DELETED_FLAG
  fs: fat: first dentry of long name in FAT iterator
  fs: fat: deletion of long file names

 fs/fat/fat.c       | 133 ++++++++----
 fs/fat/fat_write.c | 532 +++++++++++++++++++++++++++++++++------------
 include/fat.h      |   7 +-
 lib/Kconfig        |   2 +-
 4 files changed, 494 insertions(+), 180 deletions(-)

--
2.29.2

Comments

Marek Szyprowski Dec. 8, 2020, 9:40 a.m. UTC | #1
Hi

On 29.11.2020 03:01, Heinrich Schuchardt wrote:
> Since long name support was added to U-Boot's implementation of the
> FAT file system corruption of the directories was observed when running
> the UEFI Self Certifification Test.
>
> The following problems are addressed by this series.
>
> * short names were not unique
> * long names directory entries were not deleted when a file was deleted
> * directory entries released by file deletion were not reused
>
> The first four patches are just resent to indicate the import sequence.

I've noticed some of those FAT issues over a year ago, but I never had 
enough time to start fixing it. Thanks for doing it! Feel free to add:

Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>

> The following problems need to be addressed in further patches:
>
> * When extending a file only available FAT entries after the last cluster
>    of the file are considered. Available FAT entries before are ignored.
> * The case of no FAT entry found is not treated correctly.
> * The free FAT count is not updated on FAT32.
> * Some FAT related tests are not run on Gitlab CI.
> * Add tests to detect directory corruption.
>
> Heinrich Schuchardt (18):
>    fs: fat: avoid NULL dereference when root dir is full
>    fs: fat: directory entries starting with 0x05
>    fs: fat: use ATTR_ARCH instead of anonymous 0x20
>    fs: fat: correct first cluster for '..'
>    fs: fat: export fat_next_cluster()
>    fs: fat: create correct short names
>    fs: fat: pass shortname to fill_dir_slot
>    fs: fat: call set_name() only once
>    fs: fat: generate unique short names
>    fs: fat: dentry iterator for fill_dir_slot()
>    fs: fat: set start cluster for root directory
>    fs: fat: flush new directory cluster
>    fs: fat: fat_find_empty_dentries()
>    fs: fat: reuse deleted directory entries
>    fs: fat: search file should not allocate cluster
>    fs: fat: use constant DELETED_FLAG
>    fs: fat: first dentry of long name in FAT iterator
>    fs: fat: deletion of long file names
>
>   fs/fat/fat.c       | 133 ++++++++----
>   fs/fat/fat_write.c | 532 +++++++++++++++++++++++++++++++++------------
>   include/fat.h      |   7 +-
>   lib/Kconfig        |   2 +-
>   4 files changed, 494 insertions(+), 180 deletions(-)
>
> --
> 2.29.2
>
>
Best regards