public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] error value for opening block devices
@ 2004-03-20 10:13 Ulrich Drepper
  2004-03-22  3:57 ` Randy.Dunlap
  0 siblings, 1 reply; 3+ messages in thread
From: Ulrich Drepper @ 2004-03-20 10:13 UTC (permalink / raw)
  To: Andrew Morton, Linux Kernel; +Cc: Linus Torvalds

[-- Attachment #1: Type: text/plain, Size: 357 bytes --]

Opening a non-existing block device currently yields an ENXIO error.
Doing the same for char devices produces the correct error ENODEV.

The attached patch fixes the symptoms.  Somebody with more knowledge
will have to decide whether there are any negative side effects.

-- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖

[-- Attachment #2: d-blk-enodev --]
[-- Type: text/plain, Size: 523 bytes --]

--- fs/block_dev.c-save	2004-03-12 11:44:14.000000000 -0800
+++ fs/block_dev.c	2004-03-20 01:53:19.000000000 -0800
@@ -550,7 +550,7 @@ static int do_open(struct block_device *
 {
 	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 *
 	}
 	owner = disk->fops->owner;
 
+	ret = -ENXIO;
 	down(&bdev->bd_sem);
 	if (!bdev->bd_openers) {
 		bdev->bd_disk = disk;

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-03-22  4:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-20 10:13 [PATCH] error value for opening block devices Ulrich Drepper
2004-03-22  3:57 ` Randy.Dunlap
2004-03-22  4:13   ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox