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

From: Andrew Morton
Date: Fri Nov 21 2003 - 17:41:53 EST


Nathan Lynch <nathanl@xxxxxxxxxxxxxx> wrote:
>
> Hi-
>
> I have been experiencing various oopses in the procfs code when rapidly
> adding and removing /proc entries.

I doubt if this particularly surprises anyone.

> 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.

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

> Please see http://bugme.osdl.org/show_bug.cgi?id=1552 for oops traces
> and a testcase. Andrew posted a one-liner patch there which was
> included in mm4 which is also needed.

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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/