Commit 9c27c441 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] mark ftape un-removable

From: Christoph Hellwig <hch@lst.de>

I've just grepped over the tree for reamining MOD_INC_USE_COUNT users, and
ftape is a really horrible one, it relies on MOD_{INC,DEV}_USE_COUNT in the
most horrible places + it's own bookkepping and the <= 2.4 may unload
hooks.  And although I don't have the hardware I can guarantee it doesn't
work as expected.

So let's just remove the module_exit handler and mark it unremovable, if
someone wants to fix up ftape later it's fine with me, but it's a really
scary driver..
parent c5ec4950
......@@ -60,8 +60,6 @@
/* local variables
*/
static int keep_module_locked = 1;
static void *zftc_wrk_mem = NULL;
static __u8 *zftc_buf = NULL;
static void *zftc_scratch_buf = NULL;
......@@ -268,10 +266,6 @@ static void get_next_cluster(cmpr_info *cluster, const __u8 *buff,
static void zftc_lock(void)
{
MOD_INC_USE_COUNT; /* sets MOD_VISITED and MOD_USED_ONCE,
* locking is done with can_unload()
*/
keep_module_locked = 1;
}
/* this function is needed for zftape_reset_position in zftape-io.c
......@@ -282,7 +276,6 @@ static void zftc_reset(void)
memset((void *)&cseg, '\0', sizeof(cseg));
zftc_stats();
keep_module_locked = 0;
TRACE_EXIT;
}
......@@ -555,10 +548,6 @@ static int zftc_write(int *write_cnt,
int buf_pos_write = pos->seg_byte_pos;
TRACE_FUN(ft_t_flow);
keep_module_locked = 1;
MOD_INC_USE_COUNT; /* sets MOD_VISITED and MOD_USED_ONCE,
* locking is done with can_unload()
*/
/* Note: we do not unlock the module because
* there are some values cached in that `cseg' variable. We
* don't don't want to use this information when being
......@@ -676,10 +665,6 @@ static int zftc_read (int *read_cnt,
int remaining = to_do;
TRACE_FUN(ft_t_flow);
keep_module_locked = 1;
MOD_INC_USE_COUNT; /* sets MOD_VISITED and MOD_USED_ONCE,
* locking is done with can_unload()
*/
TRACE_CATCH(zft_allocate_cmpr_mem(volume->blk_sz),);
if (pos->seg_byte_pos == 0) {
/* new segment just read
......@@ -800,10 +785,6 @@ static int zftc_seek(unsigned int new_block_pos,
int fast_seek_trials = 0;
TRACE_FUN(ft_t_flow);
keep_module_locked = 1;
MOD_INC_USE_COUNT; /* sets MOD_VISITED and MOD_USED_ONCE,
* locking is done with can_unload()
*/
if (new_block_pos == 0) {
pos->seg_pos = volume->start_seg;
pos->seg_byte_pos = 0;
......@@ -1222,31 +1203,7 @@ MODULE_LICENSE("GPL");
*/
int init_module(void)
{
int result;
#if 0 /* FIXME --RR */
if (!mod_member_present(&__this_module, can_unload))
return -EBUSY;
__this_module.can_unload = can_unload;
#endif
result = zft_compressor_init();
keep_module_locked = 0;
return result;
return zft_compressor_init();
}
/* Called by modules package when removing the driver
*/
void cleanup_module(void)
{
TRACE_FUN(ft_t_flow);
if (zft_cmpr_unregister() != &cmpr_ops) {
TRACE(ft_t_info, "failed");
} else {
TRACE(ft_t_info, "successful");
}
zftc_cleanup();
printk(KERN_INFO "zft-compressor successfully unloaded.\n");
TRACE_EXIT;
}
#endif /* MODULE */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment