diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1999-10-09 00:00:47 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1999-10-09 00:00:47 +0000 |
commit | d6434e1042f3b0a6dfe1b1f615af369486f9b1fa (patch) | |
tree | e2be02f33984c48ec019c654051d27964e42c441 /fs/file_table.c | |
parent | 609d1e803baf519487233b765eb487f9ec227a18 (diff) |
Merge with 2.3.19.
Diffstat (limited to 'fs/file_table.c')
-rw-r--r-- | fs/file_table.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/fs/file_table.c b/fs/file_table.c index cb9ef16e9..ee2f4e788 100644 --- a/fs/file_table.c +++ b/fs/file_table.c @@ -116,16 +116,29 @@ int init_private_file(struct file *filp, struct dentry *dentry, int mode) return 0; } -void _fput(struct file *file) +/* + * Called when retiring the last use of a file pointer. + */ +static void __fput(struct file *filp) { - atomic_inc(&file->f_count); + struct dentry * dentry = filp->f_dentry; + struct inode * inode = dentry->d_inode; + + if (filp->f_op && filp->f_op->release) + filp->f_op->release(inode, filp); + filp->f_dentry = NULL; + if (filp->f_mode & FMODE_WRITE) + put_write_access(inode); + dput(dentry); +} +void _fput(struct file *file) +{ lock_kernel(); locks_remove_flock(file); /* Still need the */ __fput(file); /* big lock here. */ unlock_kernel(); - atomic_set(&file->f_count, 0); file_list_lock(); list_del(&file->f_list); list_add(&file->f_list, &free_list); @@ -182,7 +195,7 @@ int fs_may_remount_ro(struct super_block *sb) /* Writable file? */ if (S_ISREG(inode->i_mode) && (file->f_mode & FMODE_WRITE)) - return 0; + goto too_bad; } file_list_unlock(); return 1; /* Tis' cool bro. */ |