<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/f2fs/compress.c, branch linux-6.5.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.5.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.5.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2023-11-28T17:15:13Z</updated>
<entry>
<title>f2fs: avoid format-overflow warning</title>
<updated>2023-11-28T17:15:13Z</updated>
<author>
<name>Su Hui</name>
</author>
<published>2023-10-08T06:39:30Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6fca08fd3085253b48fcb1bd243a0a5e18821a00'/>
<id>urn:sha1:6fca08fd3085253b48fcb1bd243a0a5e18821a00</id>
<content type='text'>
commit e0d4e8acb3789c5a8651061fbab62ca24a45c063 upstream.

With gcc and W=1 option, there's a warning like this:

fs/f2fs/compress.c: In function ‘f2fs_init_page_array_cache’:
fs/f2fs/compress.c:1984:47: error: ‘%u’ directive writing between
1 and 7 bytes into a region of size between 5 and 8
[-Werror=format-overflow=]
 1984 |  sprintf(slab_name, "f2fs_page_array_entry-%u:%u", MAJOR(dev),
		MINOR(dev));
      |                                               ^~

String "f2fs_page_array_entry-%u:%u" can up to 35. The first "%u" can up
to 4 and the second "%u" can up to 7, so total size is "24 + 4 + 7 = 35".
slab_name's size should be 35 rather than 32.

Cc: stable@vger.kernel.org
Signed-off-by: Su Hui &lt;suhui@nfschina.com&gt;
Reviewed-by: Chao Yu &lt;chao@kernel.org&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>f2fs: add helper to check compression level</title>
<updated>2023-06-26T13:07:09Z</updated>
<author>
<name>Sheng Yong</name>
</author>
<published>2023-06-12T03:01:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c571fbb5b59a3741e48014faa92c2f14bc59fe50'/>
<id>urn:sha1:c571fbb5b59a3741e48014faa92c2f14bc59fe50</id>
<content type='text'>
This patch adds a helper function to check if compression level is
valid.

Signed-off-by: Sheng Yong &lt;shengyong@oppo.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: assign default compression level</title>
<updated>2023-06-26T13:07:09Z</updated>
<author>
<name>Jaegeuk Kim</name>
</author>
<published>2023-06-12T19:58:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=00e120b5e4b5638cf19eee96d4332f2d100746ba'/>
<id>urn:sha1:00e120b5e4b5638cf19eee96d4332f2d100746ba</id>
<content type='text'>
Let's avoid any confusion from assigning compress_level=0 for LZ4HC and ZSTD.

Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
</entry>
<entry>
<title>f2fs: flush error flags in workqueue</title>
<updated>2023-06-12T20:04:08Z</updated>
<author>
<name>Chao Yu</name>
</author>
<published>2023-05-18T02:14:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=901c12d144570ed2558f4a6806201453c5b01bea'/>
<id>urn:sha1:901c12d144570ed2558f4a6806201453c5b01bea</id>
<content type='text'>
In IRQ context, it wakes up workqueue to record errors into on-disk
superblock fields rather than in-memory fields.

Fixes: 1aa161e43106 ("f2fs: fix scheduling while atomic in decompression path")
Fixes: 95fa90c9e5a7 ("f2fs: support recording errors into superblock")
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: fix potential deadlock due to unpaired node_write lock use</title>
<updated>2023-06-12T20:04:07Z</updated>
<author>
<name>Chao Yu</name>
</author>
<published>2023-05-14T08:07:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f082c6b205a06953f26c40bdc7621cc5a58ceb7c'/>
<id>urn:sha1:f082c6b205a06953f26c40bdc7621cc5a58ceb7c</id>
<content type='text'>
If S_NOQUOTA is cleared from inode during data page writeback of quota
file, it may miss to unlock node_write lock, result in potential
deadlock, fix to use the lock in paired.

Kworker					Thread
- writepage
 if (IS_NOQUOTA())
   f2fs_down_read(&amp;sbi-&gt;node_write);
					- vfs_cleanup_quota_inode
					 - inode-&gt;i_flags &amp;= ~S_NOQUOTA;
 if (IS_NOQUOTA())
   f2fs_up_read(&amp;sbi-&gt;node_write);

Fixes: 79963d967b49 ("f2fs: shrink node_write lock coverage")
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: fix the wrong condition to determine atomic context</title>
<updated>2023-05-24T01:37:42Z</updated>
<author>
<name>Jaegeuk Kim</name>
</author>
<published>2023-05-05T19:16:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=633c8b9409f564ce4b7f7944c595ffac27ed1ff4'/>
<id>urn:sha1:633c8b9409f564ce4b7f7944c595ffac27ed1ff4</id>
<content type='text'>
Should use !in_task for irq context.

Cc: stable@vger.kernel.org
Fixes: 1aa161e43106 ("f2fs: fix scheduling while atomic in decompression path")
Reviewed-by: Chao Yu &lt;chao@kernel.org&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
</entry>
<entry>
<title>f2fs: merge lz4hc_compress_pages() to lz4_compress_pages()</title>
<updated>2023-04-10T17:58:45Z</updated>
<author>
<name>Yangtao Li</name>
</author>
<published>2023-03-30T16:49:47Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3094e5579b4d5d8343fdb05e9a3a35cc85a14c1c'/>
<id>urn:sha1:3094e5579b4d5d8343fdb05e9a3a35cc85a14c1c</id>
<content type='text'>
Remove unnecessary lz4hc_compress_pages().

Signed-off-by: Yangtao Li &lt;frank.li@vivo.com&gt;
Reviewed-by: Chao Yu &lt;chao@kernel.org&gt;
[Jaegeuk Kim: clean up]
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
</entry>
<entry>
<title>f2fs: fix scheduling while atomic in decompression path</title>
<updated>2023-03-29T22:17:40Z</updated>
<author>
<name>Jaegeuk Kim</name>
</author>
<published>2023-03-23T22:37:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=1aa161e43106d46ca8e9a86f4aa28d420258134b'/>
<id>urn:sha1:1aa161e43106d46ca8e9a86f4aa28d420258134b</id>
<content type='text'>
[   16.945668][    C0] Call trace:
[   16.945678][    C0]  dump_backtrace+0x110/0x204
[   16.945706][    C0]  dump_stack_lvl+0x84/0xbc
[   16.945735][    C0]  __schedule_bug+0xb8/0x1ac
[   16.945756][    C0]  __schedule+0x724/0xbdc
[   16.945778][    C0]  schedule+0x154/0x258
[   16.945793][    C0]  bit_wait_io+0x48/0xa4
[   16.945808][    C0]  out_of_line_wait_on_bit+0x114/0x198
[   16.945824][    C0]  __sync_dirty_buffer+0x1f8/0x2e8
[   16.945853][    C0]  __f2fs_commit_super+0x140/0x1f4
[   16.945881][    C0]  f2fs_commit_super+0x110/0x28c
[   16.945898][    C0]  f2fs_handle_error+0x1f4/0x2f4
[   16.945917][    C0]  f2fs_decompress_cluster+0xc4/0x450
[   16.945942][    C0]  f2fs_end_read_compressed_page+0xc0/0xfc
[   16.945959][    C0]  f2fs_handle_step_decompress+0x118/0x1cc
[   16.945978][    C0]  f2fs_read_end_io+0x168/0x2b0
[   16.945993][    C0]  bio_endio+0x25c/0x2c8
[   16.946015][    C0]  dm_io_dec_pending+0x3e8/0x57c
[   16.946052][    C0]  clone_endio+0x134/0x254
[   16.946069][    C0]  bio_endio+0x25c/0x2c8
[   16.946084][    C0]  blk_update_request+0x1d4/0x478
[   16.946103][    C0]  scsi_end_request+0x38/0x4cc
[   16.946129][    C0]  scsi_io_completion+0x94/0x184
[   16.946147][    C0]  scsi_finish_command+0xe8/0x154
[   16.946164][    C0]  scsi_complete+0x90/0x1d8
[   16.946181][    C0]  blk_done_softirq+0xa4/0x11c
[   16.946198][    C0]  _stext+0x184/0x614
[   16.946214][    C0]  __irq_exit_rcu+0x78/0x144
[   16.946234][    C0]  handle_domain_irq+0xd4/0x154
[   16.946260][    C0]  gic_handle_irq.33881+0x5c/0x27c
[   16.946281][    C0]  call_on_irq_stack+0x40/0x70
[   16.946298][    C0]  do_interrupt_handler+0x48/0xa4
[   16.946313][    C0]  el1_interrupt+0x38/0x68
[   16.946346][    C0]  el1h_64_irq_handler+0x20/0x30
[   16.946362][    C0]  el1h_64_irq+0x78/0x7c
[   16.946377][    C0]  finish_task_switch+0xc8/0x3d8
[   16.946394][    C0]  __schedule+0x600/0xbdc
[   16.946408][    C0]  preempt_schedule_common+0x34/0x5c
[   16.946423][    C0]  preempt_schedule+0x44/0x48
[   16.946438][    C0]  process_one_work+0x30c/0x550
[   16.946456][    C0]  worker_thread+0x414/0x8bc
[   16.946472][    C0]  kthread+0x16c/0x1e0
[   16.946486][    C0]  ret_from_fork+0x10/0x20

Fixes: bff139b49d9f ("f2fs: handle decompress only post processing in softirq")
Fixes: 95fa90c9e5a7 ("f2fs: support recording errors into superblock")
Reviewed-by: Chao Yu &lt;chao@kernel.org&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
</entry>
<entry>
<title>f2fs: compress: fix to call f2fs_wait_on_page_writeback() in f2fs_write_raw_pages()</title>
<updated>2023-03-29T22:17:39Z</updated>
<author>
<name>Yangtao Li</name>
</author>
<published>2023-03-20T17:22:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=babedcbac164cec970872b8097401ca913a80e61'/>
<id>urn:sha1:babedcbac164cec970872b8097401ca913a80e61</id>
<content type='text'>
BUG_ON() will be triggered when writing files concurrently,
because the same page is writtenback multiple times.

1597 void folio_end_writeback(struct folio *folio)
1598 {
		......
1618     if (!__folio_end_writeback(folio))
1619         BUG();
		......
1625 }

kernel BUG at mm/filemap.c:1619!
Call Trace:
 &lt;TASK&gt;
 f2fs_write_end_io+0x1a0/0x370
 blk_update_request+0x6c/0x410
 blk_mq_end_request+0x15/0x130
 blk_complete_reqs+0x3c/0x50
 __do_softirq+0xb8/0x29b
 ? sort_range+0x20/0x20
 run_ksoftirqd+0x19/0x20
 smpboot_thread_fn+0x10b/0x1d0
 kthread+0xde/0x110
 ? kthread_complete_and_exit+0x20/0x20
 ret_from_fork+0x22/0x30
 &lt;/TASK&gt;

Below is the concurrency scenario:

[Process A]		[Process B]		[Process C]
f2fs_write_raw_pages()
  - redirty_page_for_writepage()
  - unlock page()
			f2fs_do_write_data_page()
			  - lock_page()
			  - clear_page_dirty_for_io()
			  - set_page_writeback() [1st writeback]
			    .....
			    - unlock page()

						generic_perform_write()
						  - f2fs_write_begin()
						    - wait_for_stable_page()

						  - f2fs_write_end()
						    - set_page_dirty()

  - lock_page()
    - f2fs_do_write_data_page()
      - set_page_writeback() [2st writeback]

This problem was introduced by the previous commit 7377e853967b ("f2fs:
compress: fix potential deadlock of compress file"). All pagelocks were
released in f2fs_write_raw_pages(), but whether the page was
in the writeback state was ignored in the subsequent writing process.
Let's fix it by waiting for the page to writeback before writing.

Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Fixes: 4c8ff7095bef ("f2fs: support data compression")
Fixes: 7377e853967b ("f2fs: compress: fix potential deadlock of compress file")
Signed-off-by: Qi Han &lt;hanqi@vivo.com&gt;
Signed-off-by: Yangtao Li &lt;frank.li@vivo.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: convert to use bitmap API</title>
<updated>2023-03-29T22:17:37Z</updated>
<author>
<name>Yangtao Li</name>
</author>
<published>2023-02-16T13:53:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=447286ebadaafa551550704ff0b42eb08b1d1cb2'/>
<id>urn:sha1:447286ebadaafa551550704ff0b42eb08b1d1cb2</id>
<content type='text'>
Let's use BIT() and GENMASK() instead of open it.

Signed-off-by: Yangtao Li &lt;frank.li@vivo.com&gt;
Reviewed-by: Chao Yu &lt;chao@kernel.org&gt;
Signed-off-by: Jaegeuk Kim &lt;jaegeuk@kernel.org&gt;
</content>
</entry>
</feed>
