Re: bug in scsi.c

From: Tigran Aivazian (tigran@aivazian.fsnet.co.uk)
Date: Thu Dec 07 2000 - 14:03:50 EST


On Thu, 7 Dec 2000, Andreas Klein wrote:

> hello,
>
> I have found a problem in scsi.c which in present in the 2.2 and 2.4
> series. the scsi error handler thread is created with:
>
> kernel_thread((int (*)(void *)) scsi_error_handler,
> (void *) shpnt, 0);
>
> This will lead to problems, when you have to umount the filesystem on
> which the scsi-hostapter module is located.
> To solve to problem I would propose to change this to:
>
> kernel_thread((int (*)(void *)) scsi_error_handler,
> (void *) shpnt, CLONE_FILES);

Hi Andreas,

Unfortunately, CLONE_FILES is not enough because the module may be loaded
from the directory containing it, i.e. the thread's cwd may point to that
filesystem and that would keep it busy. Or-ing CLONE_FS into flags
wouldn't help either...

A proper way to release the references to resources is to call daemonize()
function from within the kernel thread function, which calls
exit_fs()/exit_files() internally.

Regards,
Tigran

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Dec 07 2000 - 21:00:18 EST