aboutsummaryrefslogtreecommitdiffstats
path: root/fs/coda/inode.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-08-27 12:54:13 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-09-26 21:10:10 -0400
commit78f7d75e5dd9aa1027e90d0b71d394603933c2ed (patch)
tree55d323718db8b782e891f591abb5932d83b128ca /fs/coda/inode.c
parent88b428d6e191affae79b5c1f4764dfdebab9fae6 (diff)
switch coda get_device_index() to fget_light()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/coda/inode.c')
-rw-r--r--fs/coda/inode.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/fs/coda/inode.c b/fs/coda/inode.c
index f1813120d753..bd2313d106e5 100644
--- a/fs/coda/inode.c
+++ b/fs/coda/inode.c
@@ -109,41 +109,39 @@ static int get_device_index(struct coda_mount_data *data)
109{ 109{
110 struct file *file; 110 struct file *file;
111 struct inode *inode; 111 struct inode *inode;
112 int idx; 112 int idx, fput_needed;
113 113
114 if(data == NULL) { 114 if (data == NULL) {
115 printk("coda_read_super: Bad mount data\n"); 115 printk("coda_read_super: Bad mount data\n");
116 return -1; 116 return -1;
117 } 117 }
118 118
119 if(data->version != CODA_MOUNT_VERSION) { 119 if (data->version != CODA_MOUNT_VERSION) {
120 printk("coda_read_super: Bad mount version\n"); 120 printk("coda_read_super: Bad mount version\n");
121 return -1; 121 return -1;
122 } 122 }
123 123
124 file = fget(data->fd); 124 file = fget_light(data->fd, &fput_needed);
125 inode = NULL; 125 if (!file)
126 if(file) 126 goto Ebadf;
127 inode = file->f_path.dentry->d_inode; 127 inode = file->f_path.dentry->d_inode;
128 128 if (!S_ISCHR(inode->i_mode) || imajor(inode) != CODA_PSDEV_MAJOR) {
129 if(!inode || !S_ISCHR(inode->i_mode) || 129 fput_light(file, fput_needed);
130 imajor(inode) != CODA_PSDEV_MAJOR) { 130 goto Ebadf;
131 if(file)
132 fput(file);
133
134 printk("coda_read_super: Bad file\n");
135 return -1;
136 } 131 }
137 132
138 idx = iminor(inode); 133 idx = iminor(inode);
139 fput(file); 134 fput_light(file, fput_needed);
140 135
141 if(idx < 0 || idx >= MAX_CODADEVS) { 136 if (idx < 0 || idx >= MAX_CODADEVS) {
142 printk("coda_read_super: Bad minor number\n"); 137 printk("coda_read_super: Bad minor number\n");
143 return -1; 138 return -1;
144 } 139 }
145 140
146 return idx; 141 return idx;
142Ebadf:
143 printk("coda_read_super: Bad file\n");
144 return -1;
147} 145}
148 146
149static int coda_fill_super(struct super_block *sb, void *data, int silent) 147static int coda_fill_super(struct super_block *sb, void *data, int silent)