public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] open files in kjounald (2)
@ 2002-04-22  5:23 Ph. Marek
  2002-04-22  5:49 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Ph. Marek @ 2002-04-22  5:23 UTC (permalink / raw)
  To: sct, akpm, adilger; +Cc: linux-kernel, ext3-users

Sorry, got it the wrong way around :-(


Hello everybody!

As I wrote in my mail the previous week ("BUG: 2.4.19pre1 & journal_thread
& open filehandles") I followed the problem a little bit further.

Here's my patch; I beg the ext3-maintainers (Stephen, Andreas, Andrew) to
have a look at it and submit it to Marcelo and Linux for inclusion.
(2.4 is for now for me more important than 2.5).


Patch
-----

On every mount of ext3 (and I suppose all journaling filesystems which use
jbd, although I didn't test this) a new kjournald is created. All kjournald
share the same file-information.

Before this patch it would accumulativly fetch open files from the calling
process (normally mount); I verified this via (in bash)
	exec 30< /etc/services
	mount <partition> /mnt/tmp
	ps -aux | grep kjournald
	ls -la <pid of any kjournald>
gives, among 0, 1 and 2
	30 -> /etc/services

This is really awful as you can't umount devfs (normally /dev/console is
opened as from the start-scripts) and so / can't be umounted.

After applying this patch the open files were gone.


Please apply this patch ASAP - thank you very much.


Regards,

Phil


diff -ru linux/fs/jbd/journal.c linux.ori/fs/jbd/journal.c
--- linux.ori/fs/jbd/journal.c  Mon Apr 22 06:28:54 2002
+++ linux/fs/jbd/journal.c      Mon Apr 22 06:29:16 2002
@@ -204,7 +204,6 @@

        lock_kernel();
        daemonize();
+       exit_files(current);
        spin_lock_irq(&current->sigmask_lock);
        sigfillset(&current->blocked);
        recalc_sigpending(current);


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] open files in kjounald (2)
  2002-04-22  5:23 [PATCH] open files in kjounald (2) Ph. Marek
@ 2002-04-22  5:49 ` Andrew Morton
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2002-04-22  5:49 UTC (permalink / raw)
  To: Ph. Marek; +Cc: sct, adilger, linux-kernel, ext3-users

"Ph. Marek" wrote:
> 
> ...
> --- linux.ori/fs/jbd/journal.c  Mon Apr 22 06:28:54 2002
> +++ linux/fs/jbd/journal.c      Mon Apr 22 06:29:16 2002
> @@ -204,7 +204,6 @@
> 
>         lock_kernel();
>         daemonize();
> +       exit_files(current);
>         spin_lock_irq(&current->sigmask_lock);
>         sigfillset(&current->blocked);
>         recalc_sigpending(current);

Confused.  The daemonize() call makes kjournald use init's
files:

quad:/home/akpm# uname -a
Linux quad 2.4.19-pre7 #18 SMP Sun Apr 21 22:42:31 PDT 2002 i686 unknown
quad:/home/akpm# mount /dev/sdb6 /mnt/sdb6 -t ext3 < /etc/services
quad:/home/akpm# ps aux|tail -3
root       903  0.0  0.0     0    0 ?        SW   22:45   0:00 [kjournald]
root       904  0.0  0.0  2640  728 pts/0    R    22:45   0:00 ps aux
root       905  0.0  0.0  1680  528 pts/0    S    22:45   0:00 tail -3
quad:/home/akpm# ls -l /proc/903/fd
total 0
lrwx------    1 root     root           64 Apr 21 22:46 0 -> socket:[479]
lrwx------    1 root     root           64 Apr 21 22:46 10 -> /dev/initctl

That all looks good - every /proc/$(pidof kjournald)/fd
shows that the kjournald instances are using init's files.

Which kernel are you using?  Have you any theories as to why you're
seeing different behaviour?

-

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] open files in kjounald (2)
       [not found] <200204221056.04322.nahshon@actcom.co.il>
@ 2002-04-22  8:25 ` Ph. Marek
  0 siblings, 0 replies; 3+ messages in thread
From: Ph. Marek @ 2002-04-22  8:25 UTC (permalink / raw)
  To: nahshon, Andrew Morton; +Cc: sct, adilger, linux-kernel, ext3-users

>> Confused.  The daemonize() call makes kjournald use init's
>> files:
>
>That's because in daemonize() we have:
>
>        exit_files(current);
>        current->files = init_task.files;		<====
>        atomic_inc(&current->files->count);	<====
>
>But why should a kernel-daemon need init's files?
>
>
>
>Some places call both daemonize() _and_ exit_files() which is
>redundant (checking on 2.4.19-pre7-a2):
>
>	block/loop.c :: loop_thread()
>	usb/storage/usb.c :: usb_stor_control_thread()
Well, I have 2.4.19rc2 and 2.4.19pre1.

I took the line from loop.c :-) that's where it worked.

I found another problem: in scsi_error_handler. see
drivers/scsi/scsi_error.c; I inserted exit_files(current) in line 1862.


Regards,

Phil



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-04-22  8:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-22  5:23 [PATCH] open files in kjounald (2) Ph. Marek
2002-04-22  5:49 ` Andrew Morton
     [not found] <200204221056.04322.nahshon@actcom.co.il>
2002-04-22  8:25 ` Ph. Marek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox