summaryrefslogtreecommitdiffstats
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)
downloadtalos-obmc-linux-78f7d75e5dd9aa1027e90d0b71d394603933c2ed.tar.gz
talos-obmc-linux-78f7d75e5dd9aa1027e90d0b71d394603933c2ed.zip
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)
{
struct file *file;
struct inode *inode;
- int idx;
+ int idx, fput_needed;
- if(data == NULL) {
+ if (data == NULL) {
printk("coda_read_super: Bad mount data\n");
return -1;
}
- if(data->version != CODA_MOUNT_VERSION) {
+ if (data->version != CODA_MOUNT_VERSION) {
printk("coda_read_super: Bad mount version\n");
return -1;
}
- file = fget(data->fd);
- inode = NULL;
- if(file)
- inode = file->f_path.dentry->d_inode;
-
- if(!inode || !S_ISCHR(inode->i_mode) ||
- imajor(inode) != CODA_PSDEV_MAJOR) {
- if(file)
- fput(file);
-
- printk("coda_read_super: Bad file\n");
- return -1;
+ file = fget_light(data->fd, &fput_needed);
+ if (!file)
+ goto Ebadf;
+ inode = file->f_path.dentry->d_inode;
+ if (!S_ISCHR(inode->i_mode) || imajor(inode) != CODA_PSDEV_MAJOR) {
+ fput_light(file, fput_needed);
+ goto Ebadf;
}
idx = iminor(inode);
- fput(file);
+ fput_light(file, fput_needed);
- if(idx < 0 || idx >= MAX_CODADEVS) {
+ if (idx < 0 || idx >= MAX_CODADEVS) {
printk("coda_read_super: Bad minor number\n");
return -1;
}
return idx;
+Ebadf:
+ printk("coda_read_super: Bad file\n");
+ return -1;
}
static int coda_fill_super(struct super_block *sb, void *data, int silent)
OpenPOWER on IntegriCloud