mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrey Borzenkov <arvidjaar@mail.ru>
To: linux-kernel@vger.kernel.org
Cc: devfs@oss.sgi.com
Subject: [PATCH][2.5.75] fix removable partitioned media with devfs
Date: Sun, 13 Jul 2003 18:38:07 +0400	[thread overview]
Message-ID: <200307131838.07341.arvidjaar@mail.ru> (raw)

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

Current 2.5 does not register any device node in devfs for empty media 
(capacity == 0) case. This makes removables unusable with devfs. Partition 
rescan is done only on bdev open, but without any device node for device it 
is impossible to open it.

In 2.4 it was finally solved by always registering .../disc node as 
representation for "whole" disk and using devfsd action to force partition 
rescan on access to (non-existing) partition name. For primary names it was 
handled internally by devfs - it kept track of removable devices in directory 
and initiated partition rescan when name was not found.

Both are obviously broken now. You can't do partition rescan because no node 
is registered at all and internal handling was removed. Very nice.

The attached patch makes resgister_disk always register at least disc node. 
This now works for old and new compat names as per devfsd configuration; 
canonical names are still broken:

{pts/3}% ll /dev/scsi/host1/bus0/target4/lun0/part4
ls: /dev/scsi/host1/bus0/target4/lun0/part4: No such file or directory

but it can be fixed using the same technique as above so I won't push it.

-andrey

[-- Attachment #2: 2.5.75-removable_media_with_devfs.patch --]
[-- Type: text/x-diff, Size: 709 bytes --]

--- linux-2.5.75-smp/fs/partitions/check.c.removable	2003-06-26 21:41:24.000000000 +0400
+++ linux-2.5.75-smp/fs/partitions/check.c	2003-07-13 17:20:16.000000000 +0400
@@ -348,6 +348,9 @@ void register_disk(struct gendisk *disk)
 		return;
 	}
 
+	/* always add handle for the whole disk */
+	devfs_add_partitioned(disk);
+
 	/* No such device (e.g., media were just removed) */
 	if (!get_capacity(disk))
 		return;
@@ -356,7 +359,6 @@ void register_disk(struct gendisk *disk)
 	if (blkdev_get(bdev, FMODE_READ, 0, BDEV_RAW) < 0)
 		return;
 	state = check_partition(disk, bdev);
-	devfs_add_partitioned(disk);
 	if (state) {
 		for (j = 1; j < state->limit; j++) {
 			sector_t size = state->parts[j].size;

                 reply	other threads:[~2003-07-13 14:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200307131838.07341.arvidjaar@mail.ru \
    --to=arvidjaar@mail.ru \
    --cc=devfs@oss.sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®