Follow us on Google+ Follow us on Facebook Follow us on Twitter

Opened 8 years ago

Last modified 3 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 Changed 8 years ago by Jakub Jermář

Component: unspecifiedsrv/devmap
Type: defectenhancement

comment:2 Changed 7 years ago by Jakub Jermář

Milestone: 0.5.00.5.1

comment:3 Changed 7 years ago by Jiri Svoboda

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 Changed 6 years ago by Jiri Svoboda

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 Changed 6 years ago by Jakub Jermář

Milestone: 0.5.00.5.1

comment:6 Changed 6 years ago by Jiri Svoboda

See also: #215, #449

comment:7 Changed 3 years ago by Jiri Svoboda

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