aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJohn Kacur <jkacur@redhat.com>2010-05-05 09:15:34 -0400
committerFrederic Weisbecker <fweisbec@gmail.com>2010-05-16 23:27:41 -0400
commit2ff82f852189226cda3cb192985a4a7fc750ab26 (patch)
tree13f40dbfa2e60c9c79bcad7f821e2a6834833c11 /fs
parent55929332c92e5d34d65a8f784604c92677ea3e15 (diff)
coda: BKL ioctl pushdown
Convert coda_pioctl to an unlocked_ioctl pushing down the BKL into it. Signed-off-by: John Kacur <jkacur@redhat.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@elte.hu> Cc: Jan Harkes <jaharkes@cs.cmu.edu> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/coda/pioctl.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/fs/coda/pioctl.c b/fs/coda/pioctl.c
index 773f2ce9aa06..96ace2ce7e6c 100644
--- a/fs/coda/pioctl.c
+++ b/fs/coda/pioctl.c
@@ -23,10 +23,12 @@
23#include <linux/coda_fs_i.h> 23#include <linux/coda_fs_i.h>
24#include <linux/coda_psdev.h> 24#include <linux/coda_psdev.h>
25 25
26#include <linux/smp_lock.h>
27
26/* pioctl ops */ 28/* pioctl ops */
27static int coda_ioctl_permission(struct inode *inode, int mask); 29static int coda_ioctl_permission(struct inode *inode, int mask);
28static int coda_pioctl(struct inode * inode, struct file * filp, 30static long coda_pioctl(struct file *filp, unsigned int cmd,
29 unsigned int cmd, unsigned long user_data); 31 unsigned long user_data);
30 32
31/* exported from this file */ 33/* exported from this file */
32const struct inode_operations coda_ioctl_inode_operations = 34const struct inode_operations coda_ioctl_inode_operations =
@@ -37,7 +39,7 @@ const struct inode_operations coda_ioctl_inode_operations =
37 39
38const struct file_operations coda_ioctl_operations = { 40const struct file_operations coda_ioctl_operations = {
39 .owner = THIS_MODULE, 41 .owner = THIS_MODULE,
40 .ioctl = coda_pioctl, 42 .unlocked_ioctl = coda_pioctl,
41}; 43};
42 44
43/* the coda pioctl inode ops */ 45/* the coda pioctl inode ops */
@@ -46,40 +48,43 @@ static int coda_ioctl_permission(struct inode *inode, int mask)
46 return (mask & MAY_EXEC) ? -EACCES : 0; 48 return (mask & MAY_EXEC) ? -EACCES : 0;
47} 49}
48 50
49static int coda_pioctl(struct inode * inode, struct file * filp, 51static long coda_pioctl(struct file *filp, unsigned int cmd,
50 unsigned int cmd, unsigned long user_data) 52 unsigned long user_data)
51{ 53{
52 struct path path; 54 struct path path;
53 int error; 55 int error;
54 struct PioctlData data; 56 struct PioctlData data;
57 struct inode *inode = filp->f_dentry->d_inode;
55 struct inode *target_inode = NULL; 58 struct inode *target_inode = NULL;
56 struct coda_inode_info *cnp; 59 struct coda_inode_info *cnp;
57 60
61 lock_kernel();
62
58 /* get the Pioctl data arguments from user space */ 63 /* get the Pioctl data arguments from user space */
59 if (copy_from_user(&data, (void __user *)user_data, sizeof(data))) { 64 if (copy_from_user(&data, (void __user *)user_data, sizeof(data))) {
60 return -EINVAL; 65 error = -EINVAL;
66 goto out;
61 } 67 }
62 68
63 /* 69 /*
64 * Look up the pathname. Note that the pathname is in 70 * Look up the pathname. Note that the pathname is in
65 * user memory, and namei takes care of this 71 * user memory, and namei takes care of this
66 */ 72 */
67 if (data.follow) { 73 if (data.follow)
68 error = user_path(data.path, &path); 74 error = user_path(data.path, &path);
69 } else { 75 else
70 error = user_lpath(data.path, &path); 76 error = user_lpath(data.path, &path);
71 } 77
72 78 if (error)
73 if ( error ) { 79 goto out;
74 return error; 80 else
75 } else {
76 target_inode = path.dentry->d_inode; 81 target_inode = path.dentry->d_inode;
77 } 82
78
79 /* return if it is not a Coda inode */ 83 /* return if it is not a Coda inode */
80 if ( target_inode->i_sb != inode->i_sb ) { 84 if ( target_inode->i_sb != inode->i_sb ) {
81 path_put(&path); 85 path_put(&path);
82 return -EINVAL; 86 error = -EINVAL;
87 goto out;
83 } 88 }
84 89
85 /* now proceed to make the upcall */ 90 /* now proceed to make the upcall */
@@ -88,6 +93,8 @@ static int coda_pioctl(struct inode * inode, struct file * filp,
88 error = venus_pioctl(inode->i_sb, &(cnp->c_fid), cmd, &data); 93 error = venus_pioctl(inode->i_sb, &(cnp->c_fid), cmd, &data);
89 94
90 path_put(&path); 95 path_put(&path);
96
97out:
98 unlock_kernel();
91 return error; 99 return error;
92} 100}
93