patch-2.2.14 linux/fs/super.c

Next file: linux/fs/ufs/file.c
Previous file: linux/fs/smbfs/proc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.13/linux/fs/super.c linux/fs/super.c
@@ -983,6 +983,12 @@
 	if (!data)
 		return 0;
 
+	/* If this is the kernel, just trust the pointer. */
+	if (segment_eq(get_fs(), KERNEL_DS)) {
+		*where = (unsigned long) data;
+		return 0;
+	}
+
 	vma = find_vma(current->mm, (unsigned long) data);
 	if (!vma || (unsigned long) data < vma->vm_start)
 		return -EFAULT;
@@ -1002,6 +1008,13 @@
 	return 0;
 }
 
+static void free_mount_page(unsigned long page)
+{
+	if (segment_eq(get_fs(), KERNEL_DS))
+		return;
+	free_page(page);
+}
+
 /*
  * Flags is a 16-bit value that allows up to 16 non-fs dependent flags to
  * be given to the mount() call (ie: read-only, no-dev, no-suid etc).
@@ -1039,7 +1052,7 @@
 		retval = do_remount(dir_name,
 				    new_flags & ~MS_MGC_MSK & ~MS_REMOUNT,
 				    (char *) page);
-		free_page(page);
+		free_mount_page(page);
 		goto out;
 	}
 
@@ -1047,7 +1060,7 @@
 	if (retval < 0)
 		goto out;
 	fstype = get_fs_type((char *) page);
-	free_page(page);
+	free_mount_page(page);
 	retval = -ENODEV;
 	if (!fstype)		
 		goto out;
@@ -1101,7 +1114,7 @@
 	}
 	retval = do_mount(dev, dev_name, dir_name, fstype->name, flags,
 				(void *) page);
-	free_page(page);
+	free_mount_page(page);
 	if (retval)
 		goto clean_up;
 
@@ -1276,7 +1289,10 @@
 		umount_error = do_umount(old_root_dev,1, 0);
 		if (!umount_error) {
 			printk("okay\n");
-			invalidate_buffers(old_root_dev);
+			/* special: the old device driver is going to be
+			   a ramdisk and the point of this call is to free its
+			   protected memory (even if dirty). */
+			destroy_buffers(old_root_dev);
 			return 0;
 		}
 		printk(KERN_ERR "error %d\n",umount_error);

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