//fs/file_table.c
void fastcall fput(struct file *file)
{
if (rcuref_dec_and_test(&file->f_count))
__fput(file);
}
void fastcall __fput(struct file *file)
{
struct dentry *dentry = file->f_dentry;
struct vfsmount *mnt = file->f_vfsmnt;
struct inode *inode = dentry->d_inode;
might_sleep();
fsnotify_close(file);
/*
* The function eventpoll_release() should be the first called
* in the file cleanup chain.
*/
eventpoll_release(file);
locks_remove_flock(file);
if (file->f_op && file->f_op->release)
file->f_op->release(inode, file);//在这里调用release函数。在socket中即socket_close函数
security_file_free(file);
if (unlikely(inode->i_cdev != NULL))
cdev_put(inode->i_cdev);
fops_put(file->f_op);
if (file->f_mode & FMODE_WRITE)
put_write_access(inode);
file_kill(file);
file->f_dentry = NULL;
file->f_vfsmnt = NULL;
file_free(file);
dput(dentry);
mntput(mnt);
}