diff mbox series

[v3,3/3] vfs: use the new debug macros in inode_set_cached_link()

Message ID 20250208162611.628145-4-mjguzik@gmail.com (mailing list archive)
State New
Headers show
Series CONFIG_VFS_DEBUG at last | expand

Commit Message

Mateusz Guzik Feb. 8, 2025, 4:26 p.m. UTC
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
---
 include/linux/fs.h | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

Comments

kernel test robot Feb. 9, 2025, 5:25 p.m. UTC | #1
Hi Mateusz,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on next-20250207]
[cannot apply to brauner-vfs/vfs.all viro-vfs/for-next akpm-mm/mm-nonmm-unstable v6.14-rc1]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Mateusz-Guzik/vfs-add-initial-support-for-CONFIG_VFS_DEBUG/20250209-002857
base:   linus/master
patch link:    https://lore.kernel.org/r/20250208162611.628145-4-mjguzik%40gmail.com
patch subject: [PATCH v3 3/3] vfs: use the new debug macros in inode_set_cached_link()
config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20250210/202502100145.hCrPMGW4-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250210/202502100145.hCrPMGW4-lkp@intel.com/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
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202502100145.hCrPMGW4-lkp@intel.com/

All errors (new ones prefixed by >>, old ones prefixed by <<):

>> ERROR: modpost: "dump_inode" [fs/ext4/ext4.ko] undefined!
Geert Uytterhoeven Feb. 10, 2025, 8:21 a.m. UTC | #2
Hi Mateusz,

On Sat, 8 Feb 2025 at 17:27, Mateusz Guzik <mjguzik@gmail.com> wrote:
> Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>

Thanks for your patch!

> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -792,19 +792,8 @@ struct inode {
>
>  static inline void inode_set_cached_link(struct inode *inode, char *link, int linklen)
>  {
> -       int testlen;
> -
> -       /*
> -        * TODO: patch it into a debug-only check if relevant macros show up.
> -        * In the meantime, since we are suffering strlen even on production kernels
> -        * to find the right length, do a fixup if the wrong value got passed.
> -        */
> -       testlen = strlen(link);
> -       if (testlen != linklen) {
> -               WARN_ONCE(1, "bad length passed for symlink [%s] (got %d, expected %d)",
> -                         link, linklen, testlen);
> -               linklen = testlen;

This is a (undocumented) change in behavior.

> -       }
> +       VFS_WARN_ON_INODE(strlen(link) != linklen, inode);

This change matches the one-line patch summary.

> +       VFS_WARN_ON_INODE(inode->i_opflags & IOP_CACHED_LINK, inode);

This (unrelated?) change is not described in the patch description.

>         inode->i_link = link;
>         inode->i_linklen = linklen;
>         inode->i_opflags |= IOP_CACHED_LINK;

Gr{oetje,eeting}s,

                        Geert


--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
diff mbox series

Patch

diff --git a/include/linux/fs.h b/include/linux/fs.h
index 034745af9702..e71d58c7f59c 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -792,19 +792,8 @@  struct inode {
 
 static inline void inode_set_cached_link(struct inode *inode, char *link, int linklen)
 {
-	int testlen;
-
-	/*
-	 * TODO: patch it into a debug-only check if relevant macros show up.
-	 * In the meantime, since we are suffering strlen even on production kernels
-	 * to find the right length, do a fixup if the wrong value got passed.
-	 */
-	testlen = strlen(link);
-	if (testlen != linklen) {
-		WARN_ONCE(1, "bad length passed for symlink [%s] (got %d, expected %d)",
-			  link, linklen, testlen);
-		linklen = testlen;
-	}
+	VFS_WARN_ON_INODE(strlen(link) != linklen, inode);
+	VFS_WARN_ON_INODE(inode->i_opflags & IOP_CACHED_LINK, inode);
 	inode->i_link = link;
 	inode->i_linklen = linklen;
 	inode->i_opflags |= IOP_CACHED_LINK;