<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/exfat/dir.c, branch linux-6.10.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.10.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.10.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2024-08-03T07:00:30Z</updated>
<entry>
<title>exfat: fix potential deadlock on __exfat_get_dentry_set</title>
<updated>2024-08-03T07:00:30Z</updated>
<author>
<name>Sungjong Seo</name>
</author>
<published>2024-05-31T10:14:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1d1970493c289e3f44b9ec847ed26a5dbdf56a62'/>
<id>urn:sha1:1d1970493c289e3f44b9ec847ed26a5dbdf56a62</id>
<content type='text'>
commit 89fc548767a2155231128cb98726d6d2ea1256c9 upstream.

When accessing a file with more entries than ES_MAX_ENTRY_NUM, the bh-array
is allocated in __exfat_get_entry_set. The problem is that the bh-array is
allocated with GFP_KERNEL. It does not make sense. In the following cases,
a deadlock for sbi-&gt;s_lock between the two processes may occur.

       CPU0                CPU1
       ----                ----
  kswapd
   balance_pgdat
    lock(fs_reclaim)
                      exfat_iterate
                       lock(&amp;sbi-&gt;s_lock)
                       exfat_readdir
                        exfat_get_uniname_from_ext_entry
                         exfat_get_dentry_set
                          __exfat_get_dentry_set
                           kmalloc_array
                            ...
                            lock(fs_reclaim)
    ...
    evict
     exfat_evict_inode
      lock(&amp;sbi-&gt;s_lock)

To fix this, let's allocate bh-array with GFP_NOFS.

Fixes: a3ff29a95fde ("exfat: support dynamic allocate bh for exfat_entry_set_cache")
Cc: stable@vger.kernel.org # v6.2+
Reported-by: syzbot+412a392a2cd4a65e71db@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/lkml/000000000000fef47e0618c0327f@google.com
Signed-off-by: Sungjong Seo &lt;sj1557.seo@samsung.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>exfat: zero the reserved fields of file and stream extension dentries</title>
<updated>2024-04-25T12:59:59Z</updated>
<author>
<name>Yuezhang Mo</name>
</author>
<published>2024-01-12T06:48:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f19257997d9c31864b4cf3fcef6e2d2b9ede148d'/>
<id>urn:sha1:f19257997d9c31864b4cf3fcef6e2d2b9ede148d</id>
<content type='text'>
From exFAT specification, the reserved fields should initialize
to zero and should not use for any purpose.

If create a new dentry set in the UNUSED dentries, all fields
had been zeroed when allocating cluster to parent directory.

But if create a new dentry set in the DELETED dentries, the
reserved fields in file and stream extension dentries may be
non-zero. Because only the valid bit of the type field of the
dentry is cleared in exfat_remove_entries(), if the type of
dentry is different from the original(For example, a dentry that
was originally a file name dentry, then set to deleted dentry,
and then set as a file dentry), the reserved fields is non-zero.

So this commit initializes the dentry to 0 before createing file
dentry and stream extension dentry.

Signed-off-by: Yuezhang Mo &lt;Yuezhang.Mo@sony.com&gt;
Reviewed-by: Andy Wu &lt;Andy.Wu@sony.com&gt;
Reviewed-by: Aoyama Wataru &lt;wataru.aoyama@sony.com&gt;
Reviewed-by: Sungjong Seo &lt;sj1557.seo@samsung.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
</content>
</entry>
<entry>
<title>exfat: remove unused functions</title>
<updated>2024-03-19T11:56:01Z</updated>
<author>
<name>Yuezhang Mo</name>
</author>
<published>2022-08-05T08:57:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4d714559768911b4738dca521ca38be84a8444b5'/>
<id>urn:sha1:4d714559768911b4738dca521ca38be84a8444b5</id>
<content type='text'>
exfat_count_ext_entries() is no longer called, remove it.
exfat_update_dir_chksum() is no longer called, remove it and
rename exfat_update_dir_chksum_with_entry_set() to it.

Signed-off-by: Yuezhang Mo &lt;Yuezhang.Mo@sony.com&gt;
Reviewed-by: Andy Wu &lt;Andy.Wu@sony.com&gt;
Reviewed-by: Aoyama Wataru &lt;wataru.aoyama@sony.com&gt;
Reviewed-by: Sungjong Seo &lt;sj1557.seo@samsung.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
</content>
</entry>
<entry>
<title>exfat: convert exfat_init_ext_entry() to use dentry cache</title>
<updated>2024-03-19T11:55:49Z</updated>
<author>
<name>Yuezhang Mo</name>
</author>
<published>2022-08-05T08:42:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d97e060673906d16f2b146dfd862c5e8a1afe2e4'/>
<id>urn:sha1:d97e060673906d16f2b146dfd862c5e8a1afe2e4</id>
<content type='text'>
Before this conversion, in exfat_init_ext_entry(), to init
the dentries in a dentry set, the sync times is equals the
dentry number if 'dirsync' or 'sync' is enabled.
That affects not only performance but also device life.

After this conversion, only needs to be synchronized once if
'dirsync' or 'sync' is enabled.

Signed-off-by: Yuezhang Mo &lt;Yuezhang.Mo@sony.com&gt;
Reviewed-by: Andy Wu &lt;Andy.Wu@sony.com&gt;
Reviewed-by: Aoyama Wataru &lt;wataru.aoyama@sony.com&gt;
Reviewed-by: Sungjong Seo &lt;sj1557.seo@samsung.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
</content>
</entry>
<entry>
<title>exfat: move free cluster out of exfat_init_ext_entry()</title>
<updated>2024-03-19T11:55:45Z</updated>
<author>
<name>Yuezhang Mo</name>
</author>
<published>2023-02-01T10:53:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4e1aa22fea106014397455506d1383d519c4d3d1'/>
<id>urn:sha1:4e1aa22fea106014397455506d1383d519c4d3d1</id>
<content type='text'>
exfat_init_ext_entry() is an init function, it's a bit strange
to free cluster in it. And the argument 'inode' will be removed
from exfat_init_ext_entry(). So this commit changes to free the
cluster in exfat_remove_entries().

Code refinement, no functional changes.

Signed-off-by: Yuezhang Mo &lt;Yuezhang.Mo@sony.com&gt;
Reviewed-by: Andy Wu &lt;Andy.Wu@sony.com&gt;
Reviewed-by: Aoyama Wataru &lt;wataru.aoyama@sony.com&gt;
Reviewed-by: Sungjong Seo &lt;sj1557.seo@samsung.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
</content>
</entry>
<entry>
<title>exfat: convert exfat_remove_entries() to use dentry cache</title>
<updated>2024-03-19T11:55:40Z</updated>
<author>
<name>Yuezhang Mo</name>
</author>
<published>2022-08-05T07:55:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ff4343da02e8918deca8ddc91f3855a454e96868'/>
<id>urn:sha1:ff4343da02e8918deca8ddc91f3855a454e96868</id>
<content type='text'>
Before this conversion, in exfat_remove_entries(), to mark the
dentries in a dentry set as deleted, the sync times is equals
the dentry numbers if 'dirsync' or 'sync' is enabled.
That affects not only performance but also device life.

After this conversion, only needs to be synchronized once if
'dirsync' or 'sync' is enabled.

Signed-off-by: Yuezhang Mo &lt;Yuezhang.Mo@sony.com&gt;
Reviewed-by: Andy Wu &lt;Andy.Wu@sony.com&gt;
Reviewed-by: Aoyama Wataru &lt;wataru.aoyama@sony.com&gt;
Reviewed-by: Sungjong Seo &lt;sj1557.seo@samsung.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
</content>
</entry>
<entry>
<title>exfat: convert exfat_add_entry() to use dentry cache</title>
<updated>2024-03-19T11:55:36Z</updated>
<author>
<name>Yuezhang Mo</name>
</author>
<published>2022-08-04T08:01:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=cf8663fa994343941fbbd5c1a7f4d131c366ef2f'/>
<id>urn:sha1:cf8663fa994343941fbbd5c1a7f4d131c366ef2f</id>
<content type='text'>
After this conversion, if "dirsync" or "sync" is enabled, the
number of synchronized dentries in exfat_add_entry() will change
from 2 to 1.

Signed-off-by: Yuezhang Mo &lt;Yuezhang.Mo@sony.com&gt;
Reviewed-by: Andy Wu &lt;Andy.Wu@sony.com&gt;
Reviewed-by: Aoyama Wataru &lt;wataru.aoyama@sony.com&gt;
Reviewed-by: Sungjong Seo &lt;sj1557.seo@samsung.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
</content>
</entry>
<entry>
<title>exfat: add exfat_get_empty_dentry_set() helper</title>
<updated>2024-03-19T11:55:33Z</updated>
<author>
<name>Yuezhang Mo</name>
</author>
<published>2023-10-30T09:25:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=01da3a5176c62a3310573f593579ebf88b6af5c0'/>
<id>urn:sha1:01da3a5176c62a3310573f593579ebf88b6af5c0</id>
<content type='text'>
This helper is used to lookup empty dentry set. If there are
no enough empty dentries at the input location, this helper will
return the number of dentries that need to be skipped for the
next lookup.

Signed-off-by: Yuezhang Mo &lt;Yuezhang.Mo@sony.com&gt;
Reviewed-by: Andy Wu &lt;Andy.Wu@sony.com&gt;
Reviewed-by: Aoyama Wataru &lt;wataru.aoyama@sony.com&gt;
Reviewed-by: Sungjong Seo &lt;sj1557.seo@samsung.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
</content>
</entry>
<entry>
<title>exfat: add __exfat_get_dentry_set() helper</title>
<updated>2024-03-19T11:55:28Z</updated>
<author>
<name>Yuezhang Mo</name>
</author>
<published>2023-12-08T11:17:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7b6bab2359e34a85359771a9837b1f44c37e82d2'/>
<id>urn:sha1:7b6bab2359e34a85359771a9837b1f44c37e82d2</id>
<content type='text'>
Since exfat_get_dentry_set() invokes the validate functions of
exfat_validate_entry(), it only supports getting a directory
entry set of an existing file, doesn't support getting an empty
entry set.

To remove the limitation, add this helper.

Signed-off-by: Yuezhang Mo &lt;Yuezhang.Mo@sony.com&gt;
Reviewed-by: Andy Wu &lt;Andy.Wu@sony.com&gt;
Reviewed-by: Aoyama Wataru &lt;wataru.aoyama@sony.com&gt;
Reviewed-by: Sungjong Seo &lt;sj1557.seo@samsung.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
</content>
</entry>
<entry>
<title>exfat: support create zero-size directory</title>
<updated>2023-10-31T01:01:45Z</updated>
<author>
<name>Yuezhang Mo</name>
</author>
<published>2023-07-20T06:40:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ee785c15b5906a69d4007b4754e8ae40fb41e0b4'/>
<id>urn:sha1:ee785c15b5906a69d4007b4754e8ae40fb41e0b4</id>
<content type='text'>
This commit adds mount option 'zero_size_dir'. If this option
enabled, don't allocate a cluster to directory when creating
it, and set the directory size to 0.

On Windows, a cluster is allocated for a directory when it is
created, so the mount option is disabled by default.

Signed-off-by: Yuezhang Mo &lt;Yuezhang.Mo@sony.com&gt;
Reviewed-by: Andy Wu &lt;Andy.Wu@sony.com&gt;
Reviewed-by: Aoyama Wataru &lt;wataru.aoyama@sony.com&gt;
Signed-off-by: Namjae Jeon &lt;linkinjeon@kernel.org&gt;
</content>
</entry>
</feed>
