Giter Club home page Giter Club logo

Comments (4)

grahamperrin avatar grahamperrin commented on August 23, 2024

Noted with thanks:

State of osx.zfs on July 1st
https://groups.google.com/d/msg/maczfs-devel/nbwJLBRgric/huZcY_-yjp4J

… Spotlight unmount issue …

from zfs.

lundman avatar lundman commented on August 23, 2024

If you export the POOL twice it will unmount and export.
Interestingly, if you umount /POOL it will fail, but "diskutil unmount /POOL" will succeed.
The primary call that diskutil uses appears to be DADiskUnmount.

I think the answer is to iokit the userland code as well, and do something similar to

main()
{
DADiskRef disk = NULL;
DASessionRef session = NULL;
session = DASessionCreate ( kCFAllocatorDefault );
if(session == NULL)
{
return false;
}
DASessionScheduleWithRunLoop(session, CFRunLoopGetCurrent(),
kCFRunLoopDefaultMode);
disk = DADiskCreateFromBSDName ( kCFAllocatorDefault, session, diskName);
if(disk == NULL)
return false;

 DADiskUnmount(disk, kDADiskUnmountOptionWhole,
CPCSServerSocket::SafeRemovalCallback, NULL);
 return true;
}


void CPCSServerSocket::SafeRemovalCallback( DADiskRef disk,
DADissenterRef dissenter, void * context )
{
 printf("CPCSServerSocket::SafeRemovalCallback disk-%p
dissenter-%p\n", disk, dissenter);
}               

Another option is to take the ZOL approach, and do system(diskutil unmount) - the code is already there, just not called. (for umount).

We can not use diskutil to mount the volume however, but we probably can use iokit. So currently I am favouring iokit in userland.

from zfs.

grahamperrin avatar grahamperrin commented on August 23, 2024

Thanks for the update and for the chat in IRC.

Indeed,

… Due to the complex and interwoven nature of Mac OS X, umount may fail often. …

As far as I recall, failures such as the one observed are not file system specific.

Noted: work in progress by lundman and the comments at lines 389 and 393 in today's https://github.com/zfs-osx/zfs/blob/d8a9613ab8fe707c61071d50eba53aea66f1214e/module/zfs/zfs_vnops_osx.c#L389

from zfs.

lundman avatar lundman commented on August 23, 2024

Following the advice in Apple's man-page, we now use diskutil to umount, and I must admit, it works rather well.

from zfs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.