Skip to contentSkip to conversation

Remove unneeded lock_kernel() in driveres/block/loop.c

PATCH In review Diego Woitasen 1 participant 2 messages Jun 20, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Remove unneeded lock_kernel() in driveres/block/loop.c

This patch remove the unneeded lock_kernel() in drivers/block/loop.c. I read the code as this lock_kernel() doesn't protect anything. Loopback code use lo_ctl_mutex with syncronization.

drivers/block/loop.c +0 -2
index 0ed5470..1cc004e 100644
@@ -1286,7 +1286,6 @@ static long lo_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a
 	struct loop_device *lo = inode->i_bdev->bd_disk->private_data;
 	int err;
 
-	lock_kernel();
 	switch(cmd) {
 	case LOOP_SET_STATUS:
 		mutex_lock(&lo->lo_ctl_mutex);
@@ -1312,7 +1311,6 @@ static long lo_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a
 		err = -ENOIOCTLCMD;
 		break;
 	}
-	unlock_kernel();
 	return err;
 }
 #endif
Signature · 6 lines
--------------
Diego Woitasen
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
#1 lore raw

Re: [KJ] [PATCH] Remove unneeded lock_kernel() in

Quoted 3 lines · Diego Woitasen

This patch remove the unneeded lock_kernel() in drivers/block/loop.c. I read the code as this lock_kernel() doesn't protect anything. Loopback code use lo_ctl_mutex with syncronization.

s/as/and/
s/with/for/

:-P

Quoted 31 lines
drivers/block/loop.c +0 -2
index 0ed5470..1cc004e 100644
@@ -1286,7 +1286,6 @@ static long lo_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a
 	struct loop_device *lo = inode->i_bdev->bd_disk->private_data;
 	int err;
 
-	lock_kernel();
 	switch(cmd) {
 	case LOOP_SET_STATUS:
 		mutex_lock(&lo->lo_ctl_mutex);
@@ -1312,7 +1311,6 @@ static long lo_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a
 		err = -ENOIOCTLCMD;
 		break;
 	}
-	unlock_kernel();
 	return err;
 }
 #endif
Signature · 8 lines
-- 

--------------
Diego Woitasen
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors
Signature · 6 lines
--------------
Diego Woitasen
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/kernel-janitors