[PATCH] better locking in fs/proc/generic.c (bug 1552)

[PATCH] better locking in fs/proc/generic.c (bug 1552)

Post by Nathan Lyn » Sun, 23 Nov 2003 07:40:08


This is a multi-part message in MIME format.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to XXXX@XXXXX.COM
More majordomo info at http://www.yqcomputer.com/
Please read the FAQ at http://www.yqcomputer.com/
Hi-

I have been experiencing various oopses in the procfs code when rapidly
adding and removing /proc entries. It seems that the main problem is
lack of proper locking around code that traverses or modifies the
proc_dir_entry tree. There is also the matter of proc_kill_inodes()
clearing the file pointer's f_op, which caused oopses in vfs_read() in
my testing.

I have followed the example of proc_lookup() and used
lock_kernel/unlock_kernel around critical sections. I'm not much of a
filesystem person, so I would appreciate a review of the patch from
folks more knowledgeable. I have been testing the code on a couple of
dual processor machines (i386 and ppc64) without incident.

Please see http://www.yqcomputer.com/
and a testcase. Andrew posted a one-liner patch there which was
included in mm4 which is also needed.

Patch is against 2.6.0-test9-mm4.

Thanks,
Nathan
 
 
 

[PATCH] better locking in fs/proc/generic.c (bug 1552)

Post by Andrew Mor » Sun, 23 Nov 2003 07:50:08


I doubt if this particularly surprises anyone.


The correct lock to use is i_sem on the directory which is subject to
lookup.


gargh, I was waiting to hear back on that patch, and there it is. Durned
bugzilla. Thanks.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to XXXX@XXXXX.COM
More majordomo info at http://www.yqcomputer.com/
Please read the FAQ at http://www.yqcomputer.com/