patch-2.0.14 linux/fs/open.c

Next file: linux/fs/read_write.c
Previous file: linux/drivers/sound/sys_timer.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.0.13/linux/fs/open.c linux/fs/open.c
@@ -17,6 +17,7 @@
 #include <linux/tty.h>
 #include <linux/time.h>
 #include <linux/mm.h>
+#include <linux/file.h>
 
 #include <asm/segment.h>
 #include <asm/bitops.h>
@@ -602,6 +603,16 @@
 
 #endif
 
+void __fput(struct file *filp, struct inode *inode)
+{
+	if (filp->f_op && filp->f_op->release)
+		filp->f_op->release(inode,filp);
+	filp->f_inode = NULL;
+	if (filp->f_mode & FMODE_WRITE)
+		put_write_access(inode);
+	iput(inode);
+}
+
 int close_fp(struct file *filp)
 {
 	struct inode *inode;
@@ -613,17 +624,7 @@
 	inode = filp->f_inode;
 	if (inode)
 		locks_remove_locks(current, filp);
-	if (filp->f_count > 1) {
-		filp->f_count--;
-		return 0;
-	}
-	if (filp->f_op && filp->f_op->release)
-		filp->f_op->release(inode,filp);
-	filp->f_count--;
-	filp->f_inode = NULL;
-	if (filp->f_mode & FMODE_WRITE)
-		put_write_access(inode);
-	iput(inode);
+	fput(filp, inode);
 	return 0;
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov