patch-2.3.11 linux/fs/file_table.c
Next file: linux/fs/ncpfs/dir.c
Previous file: linux/fs/fcntl.c
Back to the patch index
Back to the overall index
- Lines: 42
- Date:
Wed Jul 14 13:30:36 1999
- Orig file:
v2.3.10/linux/fs/file_table.c
- Orig date:
Thu Jul 8 15:42:21 1999
diff -u --recursive --new-file v2.3.10/linux/fs/file_table.c linux/fs/file_table.c
@@ -116,16 +116,29 @@
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 @@
/* 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. */
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)