Commit d21db956 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Fix error value for opening block devices

From: Ulrich Drepper <drepper@redhat.com>

Opening a non-existing block device currently yields an ENXIO error.  Doing
the same for char devices produces the correct error ENODEV.
parent 208204bc
......@@ -550,7 +550,7 @@ static int do_open(struct block_device *bdev, struct file *file)
{
struct module *owner = NULL;
struct gendisk *disk;
int ret = -ENXIO;
int ret = -ENODEV;
int part;
file->f_mapping = bdev->bd_inode->i_mapping;
......@@ -563,6 +563,7 @@ static int do_open(struct block_device *bdev, struct file *file)
}
owner = disk->fops->owner;
ret = -ENXIO;
down(&bdev->bd_sem);
if (!bdev->bd_openers) {
bdev->bd_disk = disk;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment