Skip to contentSkip to conversation

Patch "orangefs_readahead: don't overflow the bufmap slot." has been added to the 7.0-stable tree

DISCUSSION Mike Marshall 1 participant 1 message May 26 1 message not in the archive Stable branch

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

The kernel test robot sent me this warning from compiling on powerpc... I've pasted it onto the end of this message. I think if I refactor to get rid of the goto it will clear the problem. In case this factors into whether this patch should go to stable as is...

-Mike
--------------------------------------------------------------
From: kernel test robot <[email protected]>

To: Mike Marshall <[email protected]>
Cc: [email protected], [email protected]
Subject: fs/orangefs/inode.o: error: objtool:
orangefs_readahead+0x21c: can't find jump dest instruction at .text.orangefs_readahead+0x2dc
Message-ID: <[email protected]>
User-Agent: s-nail v14.9.25

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
master

head:   4d3a2a466b8d68d852a1f3bbf11204b718428dc4
commit: 415e507cdefc510c01de8ab6644163327ee9a5d0 orangefs_readahead:
don't overflow the bufmap slot.
date:   6 weeks ago
config: powerpc-randconfig-r072-20260519

(https://download.01.org/0day-ci/archive/20260519/[email protected]/config)
compiler: powerpc-linux-gcc (GCC) 11.5.0
smatch: v0.5.0-9185-gbcc58b9c
reproduce (this is a W=1 build):
(https://download.01.org/0day-ci/archive/20260519/[email protected]/reproduce)

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

| Fixes: 415e507cdefc ("orangefs_readahead: don't overflow the bufmap slot.")
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

Quoted 1 line
Quoted 1 line

fs/orangefs/inode.o: error: objtool: orangefs_readahead+0x21c: can't find jump dest instruction at .text.orangefs_readahead+0x2dc

Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for HOTPLUG_CPU Depends on [n]: SMP [=y] && (PPC_PSERIES [=n] || PPC_PMAC [=n] ||
PPC_POWERNV [=n] || FSL_SOC_BOOKE [=n])
Selected by [y]:
- PM_SLEEP_SMP [=y] && SMP [=y] && (ARCH_SUSPEND_POSSIBLE [=y] ||
ARCH_HIBERNATION_POSSIBLE [=y]) && PM_SLEEP [=y]

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

-------------------------------------------------------------------

Quoted 88 lines · Sasha Levin

This is a note to let you know that I've just added the patch titled

orangefs_readahead: don't overflow the bufmap slot.

to the 7.0-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
orangefs_readahead-don-t-overflow-the-bufmap-slot.patch
and it can be found in the queue-7.0 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

commit ee1b4cffc18f986a3287260db59e38d82d99e188

Author: Mike Marshall <[email protected]>
Date:   Thu Apr 2 18:07:25 2026 -0400

orangefs_readahead: don't overflow the bufmap slot.

[ Upstream commit 415e507cdefc510c01de8ab6644163327ee9a5d0 ]

generic/340 showed that this caller of wait_for_direct_io was sometimes asking for more than a bufmap slot could hold. This splits the calls up if needed.

fs/orangefs/inode.c +27 -9
index 2d4710d0e05e1..af7c9432e141b 100644
@@ -224,6 +224,8 @@ static void orangefs_readahead(struct readahead_control *rac)
        loff_t new_start = readahead_pos(rac);
        int ret;
        size_t new_len = 0;
+       size_t this_size;
+       size_t remaining;
 
        loff_t bytes_remaining = inode->i_size - readahead_pos(rac);
        loff_t pages_remaining = bytes_remaining / PAGE_SIZE;
@@ -239,17 +241,33 @@ static void orangefs_readahead(struct readahead_control *rac)
        offset = readahead_pos(rac);
        i_pages = &rac->mapping->i_pages;
 
-       iov_iter_xarray(&iter, ITER_DEST, i_pages, offset, readahead_length(rac));
+       iov_iter_xarray(&iter, ITER_DEST, i_pages,
+                               offset, readahead_length(rac));
 
-       /* read in the pages. */
-       if ((ret = wait_for_direct_io(ORANGEFS_IO_READ, inode,
-                       &offset, &iter, readahead_length(rac),
-                       inode->i_size, NULL, NULL, rac->file)) < 0)
-               gossip_debug(GOSSIP_FILE_DEBUG,
-                       "%s: wait_for_direct_io failed. \n", __func__);
-       else
-               ret = 0;
+       remaining = readahead_length(rac);
+       while (remaining) {
+               if (remaining > 4194304)
+                       this_size = 4194304;
+               else
+                       this_size = remaining;
+
+               /* read in the pages. */
+               if ((ret = wait_for_direct_io(ORANGEFS_IO_READ, inode,
+                               &offset, &iter, this_size,
+                               inode->i_size, NULL, NULL, rac->file)) < 0) {
+                       gossip_debug(GOSSIP_FILE_DEBUG,
+                               "%s: wait_for_direct_io failed. :%d: \n",
+                               __func__, ret);
+                       goto cleanup;
+               } else {
+                       ret = 0;
+               }
+
+               remaining -= this_size;
+               offset += this_size;
+       }
 
+cleanup:
        /* clean up. */
        while ((folio = readahead_folio(rac))) {
                if (!ret)