• Kuniyuki Iwashima's avatar
    af_unix: Save hash in sk_hash. · e6b4b873
    Kuniyuki Iwashima authored
    To replace unix_table_lock with per-hash locks in the next patch, we need
    to save a hash in each socket because /proc/net/unix or BPF prog iterate
    sockets while holding a hash table lock and release it later in a different
    function.
    
    Currently, we store a real/pseudo hash in struct unix_address.  However, we
    do not allocate it to unbound sockets, nor should we do just for that.  For
    this purpose, we can use sk_hash.  Then, we no longer use the hash field in
    struct unix_address and can remove it.
    
    Also, this patch does
      - rename unix_insert_socket() to unix_insert_unbound_socket()
      - remove the redundant list argument from __unix_insert_socket() and
         unix_insert_unbound_socket()
      - use 'unsigned int' instead of 'unsigned' in __unix_set_addr_hash()
      - remove 'inline' from unix_remove_socket() and
         unix_insert_unbound_socket().
    Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.co.jp>
    Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    e6b4b873
af_unix.h 2.89 KB