patch-2.3.10 linux/drivers/char/sysrq.c

Next file: linux/drivers/char/tpqic02.c
Previous file: linux/drivers/char/serial.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.9/linux/drivers/char/sysrq.c linux/drivers/char/sysrq.c
@@ -150,15 +150,6 @@
 
 /* Aux routines for the syncer */
 
-static void all_files_read_only(void)	    /* Kill write permissions of all files */
-{
-	struct file *file;
-
-	for (file = inuse_filps; file; file = file->f_next)
-		if (file->f_dentry && atomic_read(&file->f_count) && S_ISREG(file->f_dentry->d_inode->i_mode))
-			file->f_mode &= ~2;
-}
-
 static int is_local_disk(kdev_t dev)	    /* Guess if the device is a local hard drive */
 {
 	unsigned int major = MAJOR(dev);
@@ -192,6 +183,7 @@
 		struct super_block *sb = get_super(dev);
 		struct vfsmount *vfsmnt;
 		int ret, flags;
+		struct list_head *p;
 
 		if (!sb) {
 			printk("Superblock not found\n");
@@ -201,6 +193,15 @@
 			printk("R/O\n");
 			return;
 		}
+
+		file_list_lock();
+		for (p = sb->s_files.next; p != &sb->s_files; p = p->next) {
+			struct file *file = list_entry(p, struct file, f_list);
+			if (file->f_dentry && file_count(file)
+				&& S_ISREG(file->f_dentry->d_inode->i_mode))
+				file->f_mode &= ~2;
+		}
+		file_list_unlock();
 		DQUOT_OFF(dev);
 		fsync_dev(dev);
 		flags = MS_RDONLY;
@@ -239,9 +240,6 @@
 	lock_kernel();
 	remount_flag = (emergency_sync_scheduled == EMERG_REMOUNT);
 	emergency_sync_scheduled = 0;
-
-	if (remount_flag)
-		all_files_read_only();
 
 	for (mnt = vfsmntlist; mnt; mnt = mnt->mnt_next)
 		if (is_local_disk(mnt->mnt_dev))

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