* [tytso-ext4:dev 40/41] fs/ext4/inode.c:4518 ext4_iomap_writepages() warn: missing error code? 'ret'
@ 2026-10-16 1:38 kernel test robot
0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2026-10-16 1:38 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp, Dan Carpenter
Unfiltered warning: this smatch report is sent as-is and has not been
reviewed for false positives, so please treat it with due skepticism.
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-ext4@vger.kernel.org
TO: Zhang Yi <yi.zhang@huawei.com>
CC: "Theodore Ts'o" <tytso@mit.edu>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev
head: 8c4f6e3376348fc3162eed86a05b933921c8f9ed
commit: bdcbb0f19e921c7ea3241f55922032dff23d1d26 [40/41] ext4: partially enable iomap for the buffered I/O path of regular files
:::::: branch date: 11 hours ago
:::::: commit date: 11 hours ago
config: x86_64-randconfig-2200-20261016 (https://download.01.org/0day-ci/archive/20261016/202610160314.PLMEXaOJ-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch: v0.5.0-9187-g5189e3fb
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202610160314.PLMEXaOJ-lkp@intel.com/
New smatch warnings:
fs/ext4/inode.c:4518 ext4_iomap_writepages() warn: missing error code? 'ret'
Old smatch warnings:
fs/ext4/inode.c:2785 mpage_prepare_extent_to_map() warn: missing error code 'err'
fs/ext4/inode.c:6085 check_igot_inode() warn: missing unwind goto?
vim +/ret +4518 fs/ext4/inode.c
53fe71a6bcad0f Zhang Yi 2026-10-09 4487
a304299a40d92c Zhang Yi 2026-10-09 4488 static int ext4_iomap_writepages(struct address_space *mapping,
a304299a40d92c Zhang Yi 2026-10-09 4489 struct writeback_control *wbc)
a304299a40d92c Zhang Yi 2026-10-09 4490 {
a2e096bf59634f Zhang Yi 2026-10-09 4491 struct inode *inode = mapping->host;
a2e096bf59634f Zhang Yi 2026-10-09 4492 struct super_block *sb = inode->i_sb;
a2e096bf59634f Zhang Yi 2026-10-09 4493 long nr = wbc->nr_to_write;
a2e096bf59634f Zhang Yi 2026-10-09 4494 int alloc_ctx, ret;
a2e096bf59634f Zhang Yi 2026-10-09 4495 struct iomap_writepage_ctx wpc = {
a2e096bf59634f Zhang Yi 2026-10-09 4496 .inode = inode,
a2e096bf59634f Zhang Yi 2026-10-09 4497 .wbc = wbc,
a2e096bf59634f Zhang Yi 2026-10-09 4498 .ops = &ext4_writeback_ops,
a2e096bf59634f Zhang Yi 2026-10-09 4499 };
a2e096bf59634f Zhang Yi 2026-10-09 4500
a2e096bf59634f Zhang Yi 2026-10-09 4501 ret = ext4_emergency_state(sb);
a2e096bf59634f Zhang Yi 2026-10-09 4502 if (unlikely(ret))
a2e096bf59634f Zhang Yi 2026-10-09 4503 return ret;
a2e096bf59634f Zhang Yi 2026-10-09 4504
53fe71a6bcad0f Zhang Yi 2026-10-09 4505 /*
53fe71a6bcad0f Zhang Yi 2026-10-09 4506 * Submit the pending zeroed EOF block range if the entire
53fe71a6bcad0f Zhang Yi 2026-10-09 4507 * writeback range lies beyond it.
53fe71a6bcad0f Zhang Yi 2026-10-09 4508 */
53fe71a6bcad0f Zhang Yi 2026-10-09 4509 ext4_iomap_wb_submit_zeroed_eof(inode, wbc);
53fe71a6bcad0f Zhang Yi 2026-10-09 4510
a2e096bf59634f Zhang Yi 2026-10-09 4511 alloc_ctx = ext4_writepages_down_read(sb);
bdcbb0f19e921c Zhang Yi 2026-10-09 4512 /*
bdcbb0f19e921c Zhang Yi 2026-10-09 4513 * Does ext4_change_inode_journal_flag() change the inode's
bdcbb0f19e921c Zhang Yi 2026-10-09 4514 * buffered I/O path?
bdcbb0f19e921c Zhang Yi 2026-10-09 4515 */
bdcbb0f19e921c Zhang Yi 2026-10-09 4516 if (!ext4_inode_buffered_iomap(inode)) {
bdcbb0f19e921c Zhang Yi 2026-10-09 4517 ext4_writepages_up_read(sb, alloc_ctx);
bdcbb0f19e921c Zhang Yi 2026-10-09 @4518 return ret;
bdcbb0f19e921c Zhang Yi 2026-10-09 4519 }
bdcbb0f19e921c Zhang Yi 2026-10-09 4520
a2e096bf59634f Zhang Yi 2026-10-09 4521 trace_ext4_writepages(inode, wbc);
a2e096bf59634f Zhang Yi 2026-10-09 4522 ret = iomap_writepages(&wpc);
a2e096bf59634f Zhang Yi 2026-10-09 4523 trace_ext4_writepages_result(inode, wbc, ret, nr - wbc->nr_to_write);
a2e096bf59634f Zhang Yi 2026-10-09 4524 ext4_writepages_up_read(sb, alloc_ctx);
a2e096bf59634f Zhang Yi 2026-10-09 4525
a2e096bf59634f Zhang Yi 2026-10-09 4526 return ret;
a304299a40d92c Zhang Yi 2026-10-09 4527 }
a304299a40d92c Zhang Yi 2026-10-09 4528
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 5+ messages in thread* [tytso-ext4:dev 40/41] fs/ext4/inode.c:4518 ext4_iomap_writepages() warn: missing error code? 'ret'
@ 2026-10-16 7:58 Dan Carpenter
2026-10-16 8:49 ` Zhang Yi
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2026-10-16 7:58 UTC (permalink / raw)
To: oe-kbuild, Zhang Yi; +Cc: lkp, oe-kbuild-all, linux-ext4, Theodore Ts'o
tree: https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev
head: 8c4f6e3376348fc3162eed86a05b933921c8f9ed
commit: bdcbb0f19e921c7ea3241f55922032dff23d1d26 [40/41] ext4: partially enable iomap for the buffered I/O path of regular files
config: x86_64-randconfig-2200-20261016 (https://download.01.org/0day-ci/archive/20261016/202610160314.PLMEXaOJ-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch: v0.5.0-9187-g5189e3fb
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202610160314.PLMEXaOJ-lkp@intel.com/
New smatch warnings:
fs/ext4/inode.c:4518 ext4_iomap_writepages() warn: missing error code? 'ret'
vim +/ret +4518 fs/ext4/inode.c
a304299a40d92c Zhang Yi 2026-10-09 4488 static int ext4_iomap_writepages(struct address_space *mapping,
a304299a40d92c Zhang Yi 2026-10-09 4489 struct writeback_control *wbc)
a304299a40d92c Zhang Yi 2026-10-09 4490 {
a2e096bf59634f Zhang Yi 2026-10-09 4491 struct inode *inode = mapping->host;
a2e096bf59634f Zhang Yi 2026-10-09 4492 struct super_block *sb = inode->i_sb;
a2e096bf59634f Zhang Yi 2026-10-09 4493 long nr = wbc->nr_to_write;
a2e096bf59634f Zhang Yi 2026-10-09 4494 int alloc_ctx, ret;
a2e096bf59634f Zhang Yi 2026-10-09 4495 struct iomap_writepage_ctx wpc = {
a2e096bf59634f Zhang Yi 2026-10-09 4496 .inode = inode,
a2e096bf59634f Zhang Yi 2026-10-09 4497 .wbc = wbc,
a2e096bf59634f Zhang Yi 2026-10-09 4498 .ops = &ext4_writeback_ops,
a2e096bf59634f Zhang Yi 2026-10-09 4499 };
a2e096bf59634f Zhang Yi 2026-10-09 4500
a2e096bf59634f Zhang Yi 2026-10-09 4501 ret = ext4_emergency_state(sb);
a2e096bf59634f Zhang Yi 2026-10-09 4502 if (unlikely(ret))
a2e096bf59634f Zhang Yi 2026-10-09 4503 return ret;
a2e096bf59634f Zhang Yi 2026-10-09 4504
53fe71a6bcad0f Zhang Yi 2026-10-09 4505 /*
53fe71a6bcad0f Zhang Yi 2026-10-09 4506 * Submit the pending zeroed EOF block range if the entire
53fe71a6bcad0f Zhang Yi 2026-10-09 4507 * writeback range lies beyond it.
53fe71a6bcad0f Zhang Yi 2026-10-09 4508 */
53fe71a6bcad0f Zhang Yi 2026-10-09 4509 ext4_iomap_wb_submit_zeroed_eof(inode, wbc);
53fe71a6bcad0f Zhang Yi 2026-10-09 4510
a2e096bf59634f Zhang Yi 2026-10-09 4511 alloc_ctx = ext4_writepages_down_read(sb);
bdcbb0f19e921c Zhang Yi 2026-10-09 4512 /*
bdcbb0f19e921c Zhang Yi 2026-10-09 4513 * Does ext4_change_inode_journal_flag() change the inode's
bdcbb0f19e921c Zhang Yi 2026-10-09 4514 * buffered I/O path?
bdcbb0f19e921c Zhang Yi 2026-10-09 4515 */
bdcbb0f19e921c Zhang Yi 2026-10-09 4516 if (!ext4_inode_buffered_iomap(inode)) {
bdcbb0f19e921c Zhang Yi 2026-10-09 4517 ext4_writepages_up_read(sb, alloc_ctx);
bdcbb0f19e921c Zhang Yi 2026-10-09 @4518 return ret;
Either return 0 or an error code here, but not ret.
bdcbb0f19e921c Zhang Yi 2026-10-09 4519 }
bdcbb0f19e921c Zhang Yi 2026-10-09 4520
a2e096bf59634f Zhang Yi 2026-10-09 4521 trace_ext4_writepages(inode, wbc);
a2e096bf59634f Zhang Yi 2026-10-09 4522 ret = iomap_writepages(&wpc);
a2e096bf59634f Zhang Yi 2026-10-09 4523 trace_ext4_writepages_result(inode, wbc, ret, nr - wbc->nr_to_write);
a2e096bf59634f Zhang Yi 2026-10-09 4524 ext4_writepages_up_read(sb, alloc_ctx);
a2e096bf59634f Zhang Yi 2026-10-09 4525
a2e096bf59634f Zhang Yi 2026-10-09 4526 return ret;
a304299a40d92c Zhang Yi 2026-10-09 4527 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [tytso-ext4:dev 40/41] fs/ext4/inode.c:4518 ext4_iomap_writepages() warn: missing error code? 'ret'
2026-10-16 7:58 Dan Carpenter
@ 2026-10-16 8:49 ` Zhang Yi
2026-10-16 9:05 ` Dan Carpenter
0 siblings, 1 reply; 5+ messages in thread
From: Zhang Yi @ 2026-10-16 8:49 UTC (permalink / raw)
To: Dan Carpenter, oe-kbuild
Cc: lkp, oe-kbuild-all, linux-ext4, Theodore Ts'o
On 10/16/2026 3:58 PM, Dan Carpenter wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev
> head: 8c4f6e3376348fc3162eed86a05b933921c8f9ed
> commit: bdcbb0f19e921c7ea3241f55922032dff23d1d26 [40/41] ext4: partially enable iomap for the buffered I/O path of regular files
> config: x86_64-randconfig-2200-20261016 (https://download.01.org/0day-ci/archive/20261016/202610160314.PLMEXaOJ-lkp@intel.com/config)
> compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
> smatch: v0.5.0-9187-g5189e3fb
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Reported-by: Dan Carpenter <error27@gmail.com>
> | Closes: https://lore.kernel.org/r/202610160314.PLMEXaOJ-lkp@intel.com/
>
> New smatch warnings:
> fs/ext4/inode.c:4518 ext4_iomap_writepages() warn: missing error code? 'ret'
>
> vim +/ret +4518 fs/ext4/inode.c
>
> a304299a40d92c Zhang Yi 2026-10-09 4488 static int ext4_iomap_writepages(struct address_space *mapping,
> a304299a40d92c Zhang Yi 2026-10-09 4489 struct writeback_control *wbc)
> a304299a40d92c Zhang Yi 2026-10-09 4490 {
> a2e096bf59634f Zhang Yi 2026-10-09 4491 struct inode *inode = mapping->host;
> a2e096bf59634f Zhang Yi 2026-10-09 4492 struct super_block *sb = inode->i_sb;
> a2e096bf59634f Zhang Yi 2026-10-09 4493 long nr = wbc->nr_to_write;
> a2e096bf59634f Zhang Yi 2026-10-09 4494 int alloc_ctx, ret;
> a2e096bf59634f Zhang Yi 2026-10-09 4495 struct iomap_writepage_ctx wpc = {
> a2e096bf59634f Zhang Yi 2026-10-09 4496 .inode = inode,
> a2e096bf59634f Zhang Yi 2026-10-09 4497 .wbc = wbc,
> a2e096bf59634f Zhang Yi 2026-10-09 4498 .ops = &ext4_writeback_ops,
> a2e096bf59634f Zhang Yi 2026-10-09 4499 };
> a2e096bf59634f Zhang Yi 2026-10-09 4500
> a2e096bf59634f Zhang Yi 2026-10-09 4501 ret = ext4_emergency_state(sb);
> a2e096bf59634f Zhang Yi 2026-10-09 4502 if (unlikely(ret))
> a2e096bf59634f Zhang Yi 2026-10-09 4503 return ret;
> a2e096bf59634f Zhang Yi 2026-10-09 4504
> 53fe71a6bcad0f Zhang Yi 2026-10-09 4505 /*
> 53fe71a6bcad0f Zhang Yi 2026-10-09 4506 * Submit the pending zeroed EOF block range if the entire
> 53fe71a6bcad0f Zhang Yi 2026-10-09 4507 * writeback range lies beyond it.
> 53fe71a6bcad0f Zhang Yi 2026-10-09 4508 */
> 53fe71a6bcad0f Zhang Yi 2026-10-09 4509 ext4_iomap_wb_submit_zeroed_eof(inode, wbc);
> 53fe71a6bcad0f Zhang Yi 2026-10-09 4510
> a2e096bf59634f Zhang Yi 2026-10-09 4511 alloc_ctx = ext4_writepages_down_read(sb);
> bdcbb0f19e921c Zhang Yi 2026-10-09 4512 /*
> bdcbb0f19e921c Zhang Yi 2026-10-09 4513 * Does ext4_change_inode_journal_flag() change the inode's
> bdcbb0f19e921c Zhang Yi 2026-10-09 4514 * buffered I/O path?
> bdcbb0f19e921c Zhang Yi 2026-10-09 4515 */
> bdcbb0f19e921c Zhang Yi 2026-10-09 4516 if (!ext4_inode_buffered_iomap(inode)) {
> bdcbb0f19e921c Zhang Yi 2026-10-09 4517 ext4_writepages_up_read(sb, alloc_ctx);
> bdcbb0f19e921c Zhang Yi 2026-10-09 @4518 return ret;
>
> Either return 0 or an error code here, but not ret.
Thanks for pointing that out, but this is a false positive. No error
code needs to be set here. This path is only taken when the writeback
races with a concurrent journal flag switch, and since the switch will
write back all dirty data, there is nothing to be done for the leftover
writeback here and we can just return directly. So the 'ret' will simply
be 0 here.
Thanks,
Yi.
>
> bdcbb0f19e921c Zhang Yi 2026-10-09 4519 }
> bdcbb0f19e921c Zhang Yi 2026-10-09 4520
> a2e096bf59634f Zhang Yi 2026-10-09 4521 trace_ext4_writepages(inode, wbc);
> a2e096bf59634f Zhang Yi 2026-10-09 4522 ret = iomap_writepages(&wpc);
> a2e096bf59634f Zhang Yi 2026-10-09 4523 trace_ext4_writepages_result(inode, wbc, ret, nr - wbc->nr_to_write);
> a2e096bf59634f Zhang Yi 2026-10-09 4524 ext4_writepages_up_read(sb, alloc_ctx);
> a2e096bf59634f Zhang Yi 2026-10-09 4525
> a2e096bf59634f Zhang Yi 2026-10-09 4526 return ret;
> a304299a40d92c Zhang Yi 2026-10-09 4527 }
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [tytso-ext4:dev 40/41] fs/ext4/inode.c:4518 ext4_iomap_writepages() warn: missing error code? 'ret'
2026-10-16 8:49 ` Zhang Yi
@ 2026-10-16 9:05 ` Dan Carpenter
2026-10-16 9:20 ` Zhang Yi
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2026-10-16 9:05 UTC (permalink / raw)
To: Zhang Yi; +Cc: oe-kbuild, lkp, oe-kbuild-all, linux-ext4, Theodore Ts'o
On Fri, Oct 16, 2026 at 04:49:10PM +0800, Zhang Yi wrote:
> On 10/16/2026 3:58 PM, Dan Carpenter wrote:
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev
> > head: 8c4f6e3376348fc3162eed86a05b933921c8f9ed
> > commit: bdcbb0f19e921c7ea3241f55922032dff23d1d26 [40/41] ext4: partially enable iomap for the buffered I/O path of regular files
> > config: x86_64-randconfig-2200-20261016 (https://download.01.org/0day-ci/archive/20261016/202610160314.PLMEXaOJ-lkp@intel.com/config)
> > compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
> > smatch: v0.5.0-9187-g5189e3fb
> >
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <lkp@intel.com>
> > | Reported-by: Dan Carpenter <error27@gmail.com>
> > | Closes: https://lore.kernel.org/r/202610160314.PLMEXaOJ-lkp@intel.com/
> >
> > New smatch warnings:
> > fs/ext4/inode.c:4518 ext4_iomap_writepages() warn: missing error code? 'ret'
> >
> > vim +/ret +4518 fs/ext4/inode.c
> >
> > a304299a40d92c Zhang Yi 2026-10-09 4488 static int ext4_iomap_writepages(struct address_space *mapping,
> > a304299a40d92c Zhang Yi 2026-10-09 4489 struct writeback_control *wbc)
> > a304299a40d92c Zhang Yi 2026-10-09 4490 {
> > a2e096bf59634f Zhang Yi 2026-10-09 4491 struct inode *inode = mapping->host;
> > a2e096bf59634f Zhang Yi 2026-10-09 4492 struct super_block *sb = inode->i_sb;
> > a2e096bf59634f Zhang Yi 2026-10-09 4493 long nr = wbc->nr_to_write;
> > a2e096bf59634f Zhang Yi 2026-10-09 4494 int alloc_ctx, ret;
> > a2e096bf59634f Zhang Yi 2026-10-09 4495 struct iomap_writepage_ctx wpc = {
> > a2e096bf59634f Zhang Yi 2026-10-09 4496 .inode = inode,
> > a2e096bf59634f Zhang Yi 2026-10-09 4497 .wbc = wbc,
> > a2e096bf59634f Zhang Yi 2026-10-09 4498 .ops = &ext4_writeback_ops,
> > a2e096bf59634f Zhang Yi 2026-10-09 4499 };
> > a2e096bf59634f Zhang Yi 2026-10-09 4500
> > a2e096bf59634f Zhang Yi 2026-10-09 4501 ret = ext4_emergency_state(sb);
> > a2e096bf59634f Zhang Yi 2026-10-09 4502 if (unlikely(ret))
> > a2e096bf59634f Zhang Yi 2026-10-09 4503 return ret;
> > a2e096bf59634f Zhang Yi 2026-10-09 4504
> > 53fe71a6bcad0f Zhang Yi 2026-10-09 4505 /*
> > 53fe71a6bcad0f Zhang Yi 2026-10-09 4506 * Submit the pending zeroed EOF block range if the entire
> > 53fe71a6bcad0f Zhang Yi 2026-10-09 4507 * writeback range lies beyond it.
> > 53fe71a6bcad0f Zhang Yi 2026-10-09 4508 */
> > 53fe71a6bcad0f Zhang Yi 2026-10-09 4509 ext4_iomap_wb_submit_zeroed_eof(inode, wbc);
> > 53fe71a6bcad0f Zhang Yi 2026-10-09 4510
> > a2e096bf59634f Zhang Yi 2026-10-09 4511 alloc_ctx = ext4_writepages_down_read(sb);
> > bdcbb0f19e921c Zhang Yi 2026-10-09 4512 /*
> > bdcbb0f19e921c Zhang Yi 2026-10-09 4513 * Does ext4_change_inode_journal_flag() change the inode's
> > bdcbb0f19e921c Zhang Yi 2026-10-09 4514 * buffered I/O path?
> > bdcbb0f19e921c Zhang Yi 2026-10-09 4515 */
> > bdcbb0f19e921c Zhang Yi 2026-10-09 4516 if (!ext4_inode_buffered_iomap(inode)) {
> > bdcbb0f19e921c Zhang Yi 2026-10-09 4517 ext4_writepages_up_read(sb, alloc_ctx);
> > bdcbb0f19e921c Zhang Yi 2026-10-09 @4518 return ret;
> >
> > Either return 0 or an error code here, but not ret.
>
> Thanks for pointing that out, but this is a false positive. No error
> code needs to be set here. This path is only taken when the writeback
> races with a concurrent journal flag switch, and since the switch will
> write back all dirty data, there is nothing to be done for the leftover
> writeback here and we can just return directly. So the 'ret' will simply
> be 0 here.
>
Yes, please change it to "return 0;" so it's more readable.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [tytso-ext4:dev 40/41] fs/ext4/inode.c:4518 ext4_iomap_writepages() warn: missing error code? 'ret'
2026-10-16 9:05 ` Dan Carpenter
@ 2026-10-16 9:20 ` Zhang Yi
0 siblings, 0 replies; 5+ messages in thread
From: Zhang Yi @ 2026-10-16 9:20 UTC (permalink / raw)
To: Dan Carpenter
Cc: oe-kbuild, lkp, oe-kbuild-all, linux-ext4, Theodore Ts'o
On 10/16/2026 5:05 PM, Dan Carpenter wrote:
> On Fri, Oct 16, 2026 at 04:49:10PM +0800, Zhang Yi wrote:
>> On 10/16/2026 3:58 PM, Dan Carpenter wrote:
>>> tree: https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev
>>> head: 8c4f6e3376348fc3162eed86a05b933921c8f9ed
>>> commit: bdcbb0f19e921c7ea3241f55922032dff23d1d26 [40/41] ext4: partially enable iomap for the buffered I/O path of regular files
>>> config: x86_64-randconfig-2200-20261016 (https://download.01.org/0day-ci/archive/20261016/202610160314.PLMEXaOJ-lkp@intel.com/config)
>>> compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
>>> smatch: v0.5.0-9187-g5189e3fb
>>>
>>> If you fix the issue in a separate patch/commit (i.e. not just a new version of
>>> the same patch/commit), kindly add following tags
>>> | Reported-by: kernel test robot <lkp@intel.com>
>>> | Reported-by: Dan Carpenter <error27@gmail.com>
>>> | Closes: https://lore.kernel.org/r/202610160314.PLMEXaOJ-lkp@intel.com/
>>>
>>> New smatch warnings:
>>> fs/ext4/inode.c:4518 ext4_iomap_writepages() warn: missing error code? 'ret'
>>>
>>> vim +/ret +4518 fs/ext4/inode.c
>>>
>>> a304299a40d92c Zhang Yi 2026-10-09 4488 static int ext4_iomap_writepages(struct address_space *mapping,
>>> a304299a40d92c Zhang Yi 2026-10-09 4489 struct writeback_control *wbc)
>>> a304299a40d92c Zhang Yi 2026-10-09 4490 {
>>> a2e096bf59634f Zhang Yi 2026-10-09 4491 struct inode *inode = mapping->host;
>>> a2e096bf59634f Zhang Yi 2026-10-09 4492 struct super_block *sb = inode->i_sb;
>>> a2e096bf59634f Zhang Yi 2026-10-09 4493 long nr = wbc->nr_to_write;
>>> a2e096bf59634f Zhang Yi 2026-10-09 4494 int alloc_ctx, ret;
>>> a2e096bf59634f Zhang Yi 2026-10-09 4495 struct iomap_writepage_ctx wpc = {
>>> a2e096bf59634f Zhang Yi 2026-10-09 4496 .inode = inode,
>>> a2e096bf59634f Zhang Yi 2026-10-09 4497 .wbc = wbc,
>>> a2e096bf59634f Zhang Yi 2026-10-09 4498 .ops = &ext4_writeback_ops,
>>> a2e096bf59634f Zhang Yi 2026-10-09 4499 };
>>> a2e096bf59634f Zhang Yi 2026-10-09 4500
>>> a2e096bf59634f Zhang Yi 2026-10-09 4501 ret = ext4_emergency_state(sb);
>>> a2e096bf59634f Zhang Yi 2026-10-09 4502 if (unlikely(ret))
>>> a2e096bf59634f Zhang Yi 2026-10-09 4503 return ret;
>>> a2e096bf59634f Zhang Yi 2026-10-09 4504
>>> 53fe71a6bcad0f Zhang Yi 2026-10-09 4505 /*
>>> 53fe71a6bcad0f Zhang Yi 2026-10-09 4506 * Submit the pending zeroed EOF block range if the entire
>>> 53fe71a6bcad0f Zhang Yi 2026-10-09 4507 * writeback range lies beyond it.
>>> 53fe71a6bcad0f Zhang Yi 2026-10-09 4508 */
>>> 53fe71a6bcad0f Zhang Yi 2026-10-09 4509 ext4_iomap_wb_submit_zeroed_eof(inode, wbc);
>>> 53fe71a6bcad0f Zhang Yi 2026-10-09 4510
>>> a2e096bf59634f Zhang Yi 2026-10-09 4511 alloc_ctx = ext4_writepages_down_read(sb);
>>> bdcbb0f19e921c Zhang Yi 2026-10-09 4512 /*
>>> bdcbb0f19e921c Zhang Yi 2026-10-09 4513 * Does ext4_change_inode_journal_flag() change the inode's
>>> bdcbb0f19e921c Zhang Yi 2026-10-09 4514 * buffered I/O path?
>>> bdcbb0f19e921c Zhang Yi 2026-10-09 4515 */
>>> bdcbb0f19e921c Zhang Yi 2026-10-09 4516 if (!ext4_inode_buffered_iomap(inode)) {
>>> bdcbb0f19e921c Zhang Yi 2026-10-09 4517 ext4_writepages_up_read(sb, alloc_ctx);
>>> bdcbb0f19e921c Zhang Yi 2026-10-09 @4518 return ret;
>>>
>>> Either return 0 or an error code here, but not ret.
>>
>> Thanks for pointing that out, but this is a false positive. No error
>> code needs to be set here. This path is only taken when the writeback
>> races with a concurrent journal flag switch, and since the switch will
>> write back all dirty data, there is nothing to be done for the leftover
>> writeback here and we can just return directly. So the 'ret' will simply
>> be 0 here.
>>
>
> Yes, please change it to "return 0;" so it's more readable.
>
> regards,
> dan carpenter
Sure, I'll send a separate patch for this.
Thanks,
Yi.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-10-16 9:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-16 1:38 [tytso-ext4:dev 40/41] fs/ext4/inode.c:4518 ext4_iomap_writepages() warn: missing error code? 'ret' kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2026-10-16 7:58 Dan Carpenter
2026-10-16 8:49 ` Zhang Yi
2026-10-16 9:05 ` Dan Carpenter
2026-10-16 9:20 ` Zhang Yi
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.