Bug #10215

lofiadm -la fails after lofiadm -a / lofiadm -d

Added by Alexander Pyhalov about 1 month ago. Updated about 1 month ago.

Status:ClosedStart date:2019-01-11
Priority:NormalDue date:
Assignee:Toomas Soome% Done:

100%

Category:driver - device drivers
Target version:-
Difficulty:Medium Tags:

Description

The following test case fails:

# test=`lofiadm -a $(mktemp)`; lofiadm -d $test; test=`lofiadm -la $(mktemp)`; 
lofiadm: /dev/lofi/1p0 was not created: No such file or directory

The labeled lofi device names are allocated (created) in devfsadm framework and announced via sysevent mechanism and cached in kernel. The lofi will wait for the name updates if the cache has no entry yet, but when the unmap is performed, the cache flush can be delayed too. Therefore the cache flush must be initiated while we are performing unmap operation.

The fix is tested by running the line above, also by running just lofiadm -a/lofiadm -d.

History

#1 Updated by Alexander Pyhalov about 1 month ago

  • Description updated (diff)

#2 Updated by Toomas Soome about 1 month ago

Alexander Pyhalov wrote:

The following test case fails:
[...]

I did figure out what does happen:

we have device name cache, this cache is updated (add/delete) based on sysevent messages because the device names are created by devfsadmd, and the lofi driver does read the names from this cache.

We do have wait loop for case the name is not yet there, because the sysevent add name messages will take time to arrive, but also the name delete messages will take the time... so the driver will get the old name.

The fix is that we need to initiate the name removal from lofi driver (on lofiadm -d).

#3 Updated by Toomas Soome about 1 month ago

  • % Done changed from 0 to 90
  • Tags deleted (needs-triage)
  • Assignee set to Toomas Soome
  • Category set to driver - device drivers

#4 Updated by Toomas Soome about 1 month ago

  • Description updated (diff)

#5 Updated by Electric Monk about 1 month ago

  • Status changed from New to Closed
  • % Done changed from 90 to 100

git commit 45ca53447fde2f014d6d62f6bbbfc0b97ae011dd

commit  45ca53447fde2f014d6d62f6bbbfc0b97ae011dd
Author: Toomas Soome <tsoome@me.com>
Date:   2019-01-17T15:47:59.000Z

    10215 lofiadm -la fails after lofiadm -a / lofiadm -d
    Reviewed by: Igor Kozhukhov <igor@dilos.org>
    Reviewed by: Gergő Doma <domag02@gmail.com>
    Reviewed by: Andy Fiddaman <andy@omniosce.org>
    Approved by: Dan McDonald <danmcd@joyent.com>

Also available in: Atom