2006-01-07 13:20:14

by Jan-Benedict Glaw

[permalink] [raw]
Subject: OCFS2: __init / __exit problem

Hi!

$ make ARCH=vax CROSS_COMPILE=vax-linux-uclibc- mopboot
:
LD .tmp_vmlinux1
`exit_ocfs2_uptodate_cache' referenced in section `.init.text' of fs/built-in.o: defined in discarded section `.exit.text' of fs/built-in.o
`exit_ocfs2_extent_maps' referenced in section `.init.text' of fs/built-in.o: defined in discarded section `.exit.text' of fs/built-in.o
make: *** [.tmp_vmlinux1] Error 1

This happens with CONFIG_MODULES=n because:

super.c:
~~~~~~~~
static int __init ocfs2_init(void)
{
:
leave:
if (status < 0) {
ocfs2_free_mem_caches();
exit_ocfs2_uptodate_cache();
exit_ocfs2_extent_maps();
}
:
}


uptodate.h:void __exit exit_ocfs2_uptodate_cache(void);
extent_map.c:void __exit exit_ocfs2_extent_maps(void)
extent_map.h:void exit_ocfs2_extent_maps(void);

So an __inint function references __exit functions (which are
discarded for non-modular builds) and the declaration of
exit_ocfs2_extent_maps() in extent_map.h is missing __exit.

MfG, JBG

--
Jan-Benedict Glaw [email protected] . +49-172-7608481 _ O _
"Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg _ _ O
für einen Freien Staat voll Freier Bürger" | im Internet! | im Irak! O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));


Attachments:
(No filename) (1.32 kB)
signature.asc (189.00 B)
Digital signature
Download all attachments

2006-01-07 19:07:05

by Adrian Bunk

[permalink] [raw]
Subject: [2.6 patch] OCFS2: __init / __exit problem

On Sat, Jan 07, 2006 at 02:20:08PM +0100, Jan-Benedict Glaw wrote:
> Hi!
>
> $ make ARCH=vax CROSS_COMPILE=vax-linux-uclibc- mopboot
> :
> LD .tmp_vmlinux1
> `exit_ocfs2_uptodate_cache' referenced in section `.init.text' of fs/built-in.o: defined in discarded section `.exit.text' of fs/built-in.o
> `exit_ocfs2_extent_maps' referenced in section `.init.text' of fs/built-in.o: defined in discarded section `.exit.text' of fs/built-in.o
> make: *** [.tmp_vmlinux1] Error 1
>...

Thanks for your report.

It's a real problem that due to the fact that these errors have become
runtime errors on i386 in kernel 2.6, we do no longer have a big testing
coverage for them. :-(

Patch below.

> MfG, JBG

cu
Adrian


<-- snip -->


Functions called by __init funtions mustn't be __exit.

Reported by Jan-Benedict Glaw <[email protected]>.


Signed-off-by: Adrian Bunk <[email protected]>

---

fs/ocfs2/extent_map.c | 2 +-
fs/ocfs2/uptodate.c | 2 +-
fs/ocfs2/uptodate.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

--- linux-2.6.15-mm2-full/fs/ocfs2/uptodate.h.old 2006-01-07 19:45:11.000000000 +0100
+++ linux-2.6.15-mm2-full/fs/ocfs2/uptodate.h 2006-01-07 19:45:19.000000000 +0100
@@ -27,7 +27,7 @@
#define OCFS2_UPTODATE_H

int __init init_ocfs2_uptodate_cache(void);
-void __exit exit_ocfs2_uptodate_cache(void);
+void exit_ocfs2_uptodate_cache(void);

void ocfs2_metadata_cache_init(struct inode *inode);
void ocfs2_metadata_cache_purge(struct inode *inode);
--- linux-2.6.15-mm2-full/fs/ocfs2/uptodate.c.old 2006-01-07 19:45:35.000000000 +0100
+++ linux-2.6.15-mm2-full/fs/ocfs2/uptodate.c 2006-01-07 19:45:44.000000000 +0100
@@ -537,7 +537,7 @@
return 0;
}

-void __exit exit_ocfs2_uptodate_cache(void)
+void exit_ocfs2_uptodate_cache(void)
{
if (ocfs2_uptodate_cachep)
kmem_cache_destroy(ocfs2_uptodate_cachep);
--- linux-2.6.15-mm2-full/fs/ocfs2/extent_map.c.old 2006-01-07 19:46:08.000000000 +0100
+++ linux-2.6.15-mm2-full/fs/ocfs2/extent_map.c 2006-01-07 19:46:40.000000000 +0100
@@ -988,7 +988,7 @@
return 0;
}

-void __exit exit_ocfs2_extent_maps(void)
+void exit_ocfs2_extent_maps(void)
{
kmem_cache_destroy(ocfs2_em_ent_cachep);
}

2006-01-07 21:41:38

by Mark Fasheh

[permalink] [raw]
Subject: Re: [2.6 patch] OCFS2: __init / __exit problem

On Sat, Jan 07, 2006 at 08:07:02PM +0100, Adrian Bunk wrote:
> It's a real problem that due to the fact that these errors have become
> runtime errors on i386 in kernel 2.6, we do no longer have a big testing
> coverage for them. :-(
Indeed. Those function declarations have been in there for a while,
without any issue until now. Thanks for the patch Adrian.
--Mark

--
Mark Fasheh
Senior Software Developer, Oracle
[email protected]

2006-01-07 21:49:50

by Adrian Bunk

[permalink] [raw]
Subject: Re: [2.6 patch] OCFS2: __init / __exit problem

On Sat, Jan 07, 2006 at 01:38:21PM -0800, Mark Fasheh wrote:
> On Sat, Jan 07, 2006 at 08:07:02PM +0100, Adrian Bunk wrote:
> > It's a real problem that due to the fact that these errors have become
> > runtime errors on i386 in kernel 2.6, we do no longer have a big testing
> > coverage for them. :-(
> Indeed. Those function declarations have been in there for a while,
> without any issue until now. Thanks for the patch Adrian.

The runtime error on architectures like i386 occurs in the error path of
ocfs2_init().

This is the common problem that such error paths are only used once
every dozen years and therefore get no real testing coverage...

> --Mark

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

2006-01-07 21:51:26

by Arjan van de Ven

[permalink] [raw]
Subject: Re: [2.6 patch] OCFS2: __init / __exit problem


>
> This is the common problem that such error paths are only used once
> every dozen years and therefore get no real testing coverage...


Rusty presented some brilliant tool for this at OLS this year... I bet
that could be used for filesystems as well (Rusty uses it for netfilter
testing)

2006-01-08 00:23:09

by Randy Dunlap

[permalink] [raw]
Subject: Re: [2.6 patch] OCFS2: __init / __exit problem

On Sat, 07 Jan 2006 22:51:17 +0100 Arjan van de Ven wrote:

>
> >
> > This is the common problem that such error paths are only used once
> > every dozen years and therefore get no real testing coverage...
>
>
> Rusty presented some brilliant tool for this at OLS this year... I bet
> that could be used for filesystems as well (Rusty uses it for netfilter
> testing)

this year?

New drivers/filesystems should get treatment such as:

1. build cleanly, no compile/link warnings
2. check with sparse, eliminate its warnings
3. use 'make checkstack buildcheck namespacecheck'
and fix their problems

similar to what I recently did on the Areca/arcmsr driver
and on libata-acpi additions.

---
~Randy