[patch] POSIX advisory mode lock panic fix by Dfly

Devon H. O'Dell dodell at sitetronics.com
Tue Apr 20 12:53:45 PDT 2004

Matthew Dillon wrote:
:>       integrated into the lockf structure allocation and deallocation
:>       functions).
:Well, the number of locks needs to be kept track of on a per-process 
:level as well for possible setuid() transfers. I think that passing a 
:struct lockf * is a good idea; but it's not moot unless the process 
:count is upgraded in the lf_alloc() instead of in chgposixlockcnt() (but 
:I don't think that's very clean, is it?)

    Sometimes these things just fall into place, other times they are
    predetermined to be ugly no matter what you do :-).
    If its going to be ugly it is best to put the ugliness all in one place.
    So, for example, it is generally better to pass the governing structure 
    to a wrapper procedure with ugly insides then it is to strew 'pp' all over
    the source file.  Sometimes special cases prevent it from working out,
    and sometimes things just fall into place and you get an elegant solution.

Yeah, and if you strew pp all over the place, it smells bad, too.

lf_alloc() is going to have to be ugly, just because it needs to know 
about the process to pass to incposixlockcnt().

Thanks for this info, I'll have a modified sys patch soon.


More information about the Submit mailing list