diff options
Diffstat (limited to 'fs/coda/inode.c')
| -rw-r--r-- | fs/coda/inode.c | 37 | 
1 files changed, 20 insertions, 17 deletions
diff --git a/fs/coda/inode.c b/fs/coda/inode.c index f1813120d75..be2aa490948 100644 --- a/fs/coda/inode.c +++ b/fs/coda/inode.c @@ -85,6 +85,11 @@ int coda_init_inodecache(void)  void coda_destroy_inodecache(void)  { +	/* +	 * Make sure all delayed rcu free inodes are flushed before we +	 * destroy cache. +	 */ +	rcu_barrier();  	kmem_cache_destroy(coda_inode_cachep);  } @@ -107,43 +112,41 @@ static const struct super_operations coda_super_operations =  static int get_device_index(struct coda_mount_data *data)  { -	struct file *file; +	struct fd f;  	struct inode *inode;  	int idx; -	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; +	f = fdget(data->fd); +	if (!f.file) +		goto Ebadf; +	inode = f.file->f_path.dentry->d_inode; +	if (!S_ISCHR(inode->i_mode) || imajor(inode) != CODA_PSDEV_MAJOR) { +		fdput(f); +		goto Ebadf;  	}  	idx = iminor(inode); -	fput(file); +	fdput(f); -	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)  |