patch-2.3.99-pre6 linux/kernel/exit.c

Next file: linux/kernel/fork.c
Previous file: linux/kernel/exec_domain.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.99-pre5/linux/kernel/exit.c linux/kernel/exit.c
@@ -25,7 +25,7 @@
 static void release(struct task_struct * p)
 {
 	if (p != current) {
-#ifdef __SMP__
+#ifdef CONFIG_SMP
 		int has_cpu;
 
 		/*
@@ -207,6 +207,25 @@
 {
 	__exit_files(tsk);
 }
+static inline void __put_fs_struct(struct fs_struct *fs)
+{
+	if (atomic_dec_and_test(&fs->count)) {
+		dput(fs->root);
+		mntput(fs->rootmnt);
+		dput(fs->pwd);
+		mntput(fs->pwdmnt);
+		if (fs->altroot) {
+			dput(fs->altroot);
+			mntput(fs->altrootmnt);
+		}
+		kfree(fs);
+	}
+}
+
+void put_fs_struct(struct fs_struct *fs)
+{
+	__put_fs_struct(fs);
+}
 
 static inline void __exit_fs(struct task_struct *tsk)
 {
@@ -214,13 +233,7 @@
 
 	if (fs) {
 		tsk->fs = NULL;
-		if (atomic_dec_and_test(&fs->count)) {
-			dput(fs->root);
-			mntput(fs->rootmnt);
-			dput(fs->pwd);
-			mntput(fs->pwdmnt);
-			kfree(fs);
-		}
+		__put_fs_struct(fs);
 	}
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)