• Matthew Wilcox's avatar
    Make dupfd() locking more clear. · 9700fda4
    Matthew Wilcox authored
    Walter Harms pointed out the locking was rather obtuse in dupfd. This
    patch makes it much clearer.  Present code acquires a lock in dupfd()
    callee locate_fd(), and releases it in allocate_fd() OR dupfd() itself.
    
    This changes cleans this up to acquire and release the lock entirely
    within dupfd(), which moves locking completely out of locate_fd()
    and allows the manual inlining of allocate_fd() into its only caller,
    dupfd().
    
    This change is functionally equivalent to the current code
    [well, dupfd might run a cycle or two faster if the compiler optimizes well...]
    9700fda4
fcntl.c 13.3 KB