Opened 14 years ago

Last modified 10 years ago

#217 new enhancement

Need a way to detach devices

Reported by: Jakub Jermář Owned by:
Priority: major Milestone:
Component: helenos/srv/locsrv Version: mainline
Keywords: Cc:
Blocker for: Depends on:
See also: #215, #449

Description

Commands like:

  • ata_bd
  • mbr_part
  • file_bd

create new dev_handles and also nodes under /dev.

There is currently no graceful way to release these resources so the associated dev_handles and nodes will exist in the system until reboot or until the respective server dies.

When implementing support for device detaching, care must be taken not to detach a device which is being currently used. This can be achieved by adding a reference when it is being used (e.g. on mount).

It would also be useful to be able to list what devices belong to what services, e.g.:

# devadm list
dev_handle driver   node
========== =======  =============================
1          rd       bd/initrd
3          -        null0
4          ata_bd   bd/disk0
5          mbr_part bd/disk0p0
6          mbr_part bd/disk0p1
7          mbr_part bd/disk0p2
8          mbr_part bd/disk0p3
9          file_bd  bd/fbdev0

# devadm list mbr_part
dev_handle driver   node
========== =======  =============================
5          mbr_part bd/disk0p0
6          mbr_part bd/disk0p1
7          mbr_part bd/disk0p2
8          mbr_part bd/disk0p3

# devadm detach bd/disk0p0
bd/disk0p0 cannot be detached because it is being used.
# devadm detach bd/disk0p1

# devadm list mbr_part
dev_handle driver   node
========== =======  =============================
5          mbr_part bd/disk0p0
7          mbr_part bd/disk0p2
8          mbr_part bd/disk0p3

Change History (7)

comment:1 by Jakub Jermář, 14 years ago

Component: unspecifiedsrv/devmap
Type: defectenhancement

comment:2 by Jakub Jermář, 13 years ago

Milestone: 0.5.00.5.1

comment:3 by Jiri Svoboda, 13 years ago

This ticket has issues

  • It describes two separate enhancements, not one. Second,
  • The proposition for ability to detach a specified devmap device is incorrect. Devmap devices should be removed when the corresponding driver decides to do so or when it is terminated.

comment:4 by Jiri Svoboda, 13 years ago

As of mainline,1207 DDF supports both anticipated and surprise device removal (but supports needs to be added to USB stack). devctl can be used to administratively detach driver from a device.

You talk here about devmap - now loc. Translating that to current status, it would be nice for locinfo to be able to list services along with responsible servers. Also it would be nice to be able to ask an arbitrary server to terminate. I think the reasonable way to do that is to devise some method to tell any task to terminate gracefully, i.e. something similar to ticket #215.

comment:5 by Jakub Jermář, 12 years ago

Milestone: 0.5.00.5.1

comment:6 by Jiri Svoboda, 12 years ago

See also: #215, #449

comment:7 by Jiri Svoboda, 10 years ago

Milestone: 0.6.0
Note: See TracTickets for help on using tickets.