<feed xmlns='http://www.w3.org/2005/Atom'>
<title>pm24.git/fs/f2fs/inline.c, branch v6.4</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<id>https://git.kobert.dev/pm24.git/atom?h=v6.4</id>
<link rel='self' href='https://git.kobert.dev/pm24.git/atom?h=v6.4'/>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/'/>
<updated>2023-04-10T17:58:45Z</updated>
<entry>
<title>f2fs: use common implementation of file type</title>
<updated>2023-04-10T17:58:45Z</updated>
<author>
<name>Weizhao Ouyang</name>
<email>o451686892@gmail.com</email>
</author>
<published>2023-04-04T03:28:44Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=0c9f4521958ff52b74967c8a39a8b5747ba8df41'/>
<id>urn:sha1:0c9f4521958ff52b74967c8a39a8b5747ba8df41</id>
<content type='text'>
Use common implementation of file type conversion helpers.

Signed-off-by: Weizhao Ouyang &lt;o451686892@gmail.com&gt;
Reviewed-by: Chao Yu &lt;chao@kernel.org&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
</entry>
<entry>
<title>f2fs: fix information leak in f2fs_move_inline_dirents()</title>
<updated>2023-01-31T18:47:46Z</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2023-01-23T07:04:14Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=9a5571cff4ffcfc24847df9fd545cc5799ac0ee5'/>
<id>urn:sha1:9a5571cff4ffcfc24847df9fd545cc5799ac0ee5</id>
<content type='text'>
When converting an inline directory to a regular one, f2fs is leaking
uninitialized memory to disk because it doesn't initialize the entire
directory block.  Fix this by zero-initializing the block.

This bug was introduced by commit 4ec17d688d74 ("f2fs: avoid unneeded
initializing when converting inline dentry"), which didn't consider the
security implications of leaking uninitialized memory to disk.

This was found by running xfstest generic/435 on a KMSAN-enabled kernel.

Fixes: 4ec17d688d74 ("f2fs: avoid unneeded initializing when converting inline dentry")
Cc: &lt;stable@vger.kernel.org&gt; # v4.3+
Signed-off-by: Eric Biggers &lt;ebiggers@google.com&gt;
Reviewed-by: Chao Yu &lt;chao@kernel.org&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
</entry>
<entry>
<title>f2fs: avoid to check PG_error flag</title>
<updated>2023-01-06T23:13:41Z</updated>
<author>
<name>Chao Yu</name>
<email>chao@kernel.org</email>
</author>
<published>2022-12-15T06:05:06Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=8358014d6be8f3cb507d247d6a623e5961f848d0'/>
<id>urn:sha1:8358014d6be8f3cb507d247d6a623e5961f848d0</id>
<content type='text'>
After below changes:
commit 14db0b3c7b83 ("fscrypt: stop using PG_error to track error status")
commit 98dc08bae678 ("fsverity: stop using PG_error to track error status")

There is no place in f2fs we will set PG_error flag in page, let's remove
other PG_error usage in f2fs, as a step towards freeing the PG_error flag
for other uses.

Cc: Eric Biggers &lt;ebiggers@kernel.org&gt;
Signed-off-by: Chao Yu &lt;chao@kernel.org&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
</entry>
<entry>
<title>f2fs: support recording errors into superblock</title>
<updated>2022-10-04T20:31:45Z</updated>
<author>
<name>Chao Yu</name>
<email>chao@kernel.org</email>
</author>
<published>2022-09-28T15:38:54Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=95fa90c9e5a7f14c2497d5b032544478c9377c3a'/>
<id>urn:sha1:95fa90c9e5a7f14c2497d5b032544478c9377c3a</id>
<content type='text'>
This patch supports to record detail reason of FSCORRUPTED error into
f2fs_super_block.s_errors[].

Signed-off-by: Chao Yu &lt;chao@kernel.org&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
</entry>
<entry>
<title>f2fs: use memcpy_{to,from}_page() where possible</title>
<updated>2022-08-30T04:15:51Z</updated>
<author>
<name>Eric Biggers</name>
<email>ebiggers@google.com</email>
</author>
<published>2022-08-19T22:33:00Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=b87846bd61c7c09560617da416208a5454530d57'/>
<id>urn:sha1:b87846bd61c7c09560617da416208a5454530d57</id>
<content type='text'>
This is simpler, and as a side effect it replaces several uses of
kmap_atomic() with its recommended replacement kmap_local_page().

Signed-off-by: Eric Biggers &lt;ebiggers@google.com&gt;
Reviewed-by: Fabio M. De Francesco &lt;fmdefrancesco@gmail.com&gt;
Reviewed-by: Chao Yu &lt;chao@kernel.org&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
</entry>
<entry>
<title>f2fs: fix to do sanity check for inline inode</title>
<updated>2022-05-18T22:36:11Z</updated>
<author>
<name>Chao Yu</name>
<email>chao@kernel.org</email>
</author>
<published>2022-05-18T12:28:41Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=677a82b44ebf263d4f9a0cfbd576a6ade797a07b'/>
<id>urn:sha1:677a82b44ebf263d4f9a0cfbd576a6ade797a07b</id>
<content type='text'>
Yanming reported a kernel bug in Bugzilla kernel [1], which can be
reproduced. The bug message is:

The kernel message is shown below:

kernel BUG at fs/inode.c:611!
Call Trace:
 evict+0x282/0x4e0
 __dentry_kill+0x2b2/0x4d0
 dput+0x2dd/0x720
 do_renameat2+0x596/0x970
 __x64_sys_rename+0x78/0x90
 do_syscall_64+0x3b/0x90

[1] https://bugzilla.kernel.org/show_bug.cgi?id=215895

The bug is due to fuzzed inode has both inline_data and encrypted flags.
During f2fs_evict_inode(), as the inode was deleted by rename(), it
will cause inline data conversion due to conflicting flags. The page
cache will be polluted and the panic will be triggered in clear_inode().

Try fixing the bug by doing more sanity checks for inline data inode in
sanity_check_inode().

Cc: stable@vger.kernel.org
Reported-by: Ming Yan &lt;yanming@tju.edu.cn&gt;
Signed-off-by: Chao Yu &lt;chao.yu@oppo.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
</entry>
<entry>
<title>f2fs: move f2fs to use reader-unfair rwsems</title>
<updated>2022-01-25T01:40:04Z</updated>
<author>
<name>Tim Murray</name>
<email>timmurray@google.com</email>
</author>
<published>2022-01-07T20:48:44Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=e4544b63a7ee49e7fbebf35ece0a6acd3b9617ae'/>
<id>urn:sha1:e4544b63a7ee49e7fbebf35ece0a6acd3b9617ae</id>
<content type='text'>
f2fs rw_semaphores work better if writers can starve readers,
especially for the checkpoint thread, because writers are strictly
more important than reader threads. This prevents significant priority
inversion between low-priority readers that blocked while trying to
acquire the read lock and a second acquisition of the write lock that
might be blocking high priority work.

Signed-off-by: Tim Murray &lt;timmurray@google.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
</entry>
<entry>
<title>f2fs: do not bother checkpoint by f2fs_get_node_info</title>
<updated>2022-01-04T21:20:49Z</updated>
<author>
<name>Jaegeuk Kim</name>
<email>jaegeuk@kernel.org</email>
</author>
<published>2021-12-13T22:16:32Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=a9419b63bf414775e8aeee95d8c4a5e0df690748'/>
<id>urn:sha1:a9419b63bf414775e8aeee95d8c4a5e0df690748</id>
<content type='text'>
This patch tries to mitigate lock contention between f2fs_write_checkpoint and
f2fs_get_node_info along with nat_tree_lock.

The idea is, if checkpoint is currently running, other threads that try to grab
nat_tree_lock would be better to wait for checkpoint.

Reviewed-by: Chao Yu &lt;chao@kernel.org&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
</entry>
<entry>
<title>f2fs: support fault injection for dquot_initialize()</title>
<updated>2021-10-29T17:38:53Z</updated>
<author>
<name>Chao Yu</name>
<email>chao@kernel.org</email>
</author>
<published>2021-10-28T13:03:05Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=10a26878564f27327b12e8f4b4d8d7b43065fae5'/>
<id>urn:sha1:10a26878564f27327b12e8f4b4d8d7b43065fae5</id>
<content type='text'>
This patch adds a new function f2fs_dquot_initialize() to wrap
dquot_initialize(), and it supports to inject fault into
f2fs_dquot_initialize() to simulate inner failure occurs in
dquot_initialize().

Usage:
a) echo 65536 &gt; /sys/fs/f2fs/&lt;dev&gt;/inject_type or
b) mount -o fault_type=65536 &lt;dev&gt; &lt;mountpoint&gt;

Signed-off-by: Chao Yu &lt;chao@kernel.org&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
</entry>
<entry>
<title>f2fs: restructure f2fs page.private layout</title>
<updated>2021-05-14T18:22:08Z</updated>
<author>
<name>Chao Yu</name>
<email>yuchao0@huawei.com</email>
</author>
<published>2021-04-28T09:20:31Z</published>
<link rel='alternate' type='text/html' href='https://git.kobert.dev/pm24.git/commit/?id=b763f3bedc2da2edf81bba550430847f561eae0e'/>
<id>urn:sha1:b763f3bedc2da2edf81bba550430847f561eae0e</id>
<content type='text'>
Restruct f2fs page private layout for below reasons:

There are some cases that f2fs wants to set a flag in a page to
indicate a specified status of page:
a) page is in transaction list for atomic write
b) page contains dummy data for aligned write
c) page is migrating for GC
d) page contains inline data for inline inode flush
e) page belongs to merkle tree, and is verified for fsverity
f) page is dirty and has filesystem/inode reference count for writeback
g) page is temporary and has decompress io context reference for compression

There are existed places in page structure we can use to store
f2fs private status/data:
- page.flags: PG_checked, PG_private
- page.private

However it was a mess when we using them, which may cause potential
confliction:
		page.private	PG_private	PG_checked	page._refcount (+1 at most)
a)		-1		set				+1
b)		-2		set
c), d), e)					set
f)		0		set				+1
g)		pointer		set

The other problem is page.flags has no free slot, if we can avoid set
zero to page.private and set PG_private flag, then we use non-zero value
to indicate PG_private status, so that we may have chance to reclaim
PG_private slot for other usage. [1]

The other concern is f2fs has bad scalability in aspect of indicating
more page status.

So in this patch, let's restructure f2fs' page.private as below to
solve above issues:

Layout A: lowest bit should be 1
| bit0 = 1 | bit1 | bit2 | ... | bit MAX | private data .... |
 bit 0	PAGE_PRIVATE_NOT_POINTER
 bit 1	PAGE_PRIVATE_ATOMIC_WRITE
 bit 2	PAGE_PRIVATE_DUMMY_WRITE
 bit 3	PAGE_PRIVATE_ONGOING_MIGRATION
 bit 4	PAGE_PRIVATE_INLINE_INODE
 bit 5	PAGE_PRIVATE_REF_RESOURCE
 bit 6-	f2fs private data

Layout B: lowest bit should be 0
 page.private is a wrapped pointer.

After the change:
		page.private	PG_private	PG_checked	page._refcount (+1 at most)
a)		11		set				+1
b)		101		set				+1
c)		1001		set				+1
d)		10001		set				+1
e)						set
f)		100001		set				+1
g)		pointer		set				+1

[1] https://lore.kernel.org/linux-f2fs-devel/20210422154705.GO3596236@casper.infradead.org/T/#u

Cc: Matthew Wilcox &lt;willy@infradead.org&gt;
Signed-off-by: Chao Yu &lt;yuchao0@huawei.com&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
</entry>
</feed>
