Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DADiskEject and Resource Busy errors



Dan,

Thanks for the tips.  I was able to gather a bit more debugging information, but still couldn't figure out where the problem lies.

I haven't checked using lsof, but if I have a Finder window open in the background I see the volumes disappear.
I checked using lsof, but there were no entries shown for disk1 (my CD-ROM drive).

You can also enable Disk Arbitration logging, per technical note TN 2124, to see whether the dissent came from an application or the kernel itself.  EBUSY, error code 16, is usually from the kernel, which is why I suggest that you check with lsof first.
I did this, but I wasn't sure how to interpret all the status codes.  The relevant excerpts are (I ran my application from Xcode, hence the calls from gdb):

To unmount:

20:33:25 diskarbitrationd [39] -> PBGDBIntrospectionSupport.A.dylib [311]:33283
20:33:25   dispatched callback, id = 01085C98:0062E2C0, kind = disk unmount, disk = /dev/disk1, success.

To eject:

20:33:25 PBGDBIntrospectionSupport.A.dylib [311]:33283 -> diskarbitrationd [39]
20:33:25   queued solicitation, id = 01086280:0062E2C0, kind = disk eject, disk = /dev/disk1, options = 0x00000000.
20:33:25
20:33:25 diskarbitrationd [39] -> SystemUIServer [103]:19991
20:33:25   dispatched callback, id = 913F1570:00000000, kind = disk eject approval, disk = /dev/disk1.
20:33:25   dispatched callback queue.
20:33:25
20:33:25 SystemUIServer [103]:19991 -> diskarbitrationd [39]
20:33:25   dispatched response, id = 913F1570:00000000, kind = disk eject approval, disk = /dev/disk1, approved.
20:33:25
20:33:25 diskarbitrationd [39] -> diskarbitrationd [39]
20:33:25   ejected disk, id = /dev/disk1, ongoing.
20:33:25   ejected disk, id = /dev/disk1, failure.
20:33:25 unable to eject /dev/disk1 (status code 0x00000010).
20:33:25
20:33:25 diskarbitrationd [39] -> PBGDBIntrospectionSupport.A.dylib [311]:33283
20:33:25   dispatched callback, id = 01086280:0062E2C0, kind = disk eject, disk = /dev/disk1, status = 0x0000C010.
20:33:25   dispatched callback queue.

So the error code 16 shows up again, but I have verified that no nodes are open:

~ me$ sudo lsof | grep disk1
~ me$

So I'm still stumped.

Dan

Le 31 May 2006 à 11:32 AM, Stephen F. Booth a écrit :

Hi Dan,

Thanks for your reply.

Are you certain that the unmount was in fact successful?  What does lsof show with respect to that device node or that mount point? 

I assume the unmount is successful because the dissenter is NULL in the unmount callback (the docs say "A dissenter object on failure or NULL on success" .  I haven't checked using lsof, but if I have a Finder window open in the background I see the volumes disappear.

The code snippet below issues the DADiskEject() even if the unmount is not successful for example.

I left out some of the error handling code; an exception is thrown in the error handling block  so that the program flow never reaches the call to DADiskEject if dissenter is not NULL.  If you're curious to see the code in its entirety it is on http://svn.sourceforge.net/viewcvs.cgi/macaudiox/trunk/Controllers/MediaController.m?view=markup

Stephen

I'm using the DiskArbitration framework for unmounting and ejecting removable CD media.  I have run into a peculiar issue where sometimes CDs unmount successfully, but fail to eject.  My code looks like:

Unmount the disc in preparation for ejection:

DADiskUnmount(disk, kDADiskUnmountOptionWhole, unmountCallback, context);

If the unmount was successful, request the eject in unmountCallback:

if(NULL != dissenter) {
DAReturn status = DADissenterGetStatus(dissenter);
// Error handling omitted
}

DADiskEject(disk, kDADiskEjectOptionDefault, ejectCallback, context);

And finally, the code that produces the error message:

if(NULL != dissenter) {
DAReturn status = DADissenterGetStatus(dissenter);
// Error occurs here
}

The strange thing is, maybe 50% or more of the time the disc will unmount but fail to eject with an error code 16 (Resource Busy).  I assume since the disc successfully unmounted that no resources should be in use.  I don't see any other DA* APIs that will do what I want.

Have I missed something in my usage of the framework?

Stephen
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden




 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden

References: 
 >DADiskEject and Resource Busy errors (From: "Stephen F. Booth" <email@hidden>)
 >Re: DADiskEject and Resource Busy errors (From: Dan Markarian <email@hidden>)
 >Re: DADiskEject and Resource Busy errors (From: "Stephen F. Booth" <email@hidden>)
 >Re: DADiskEject and Resource Busy errors (From: Dan Markarian <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.