[haiku-development] Re: [BFS FUSE] removing the myfs folder

  • From: Jeroen Oortwijn <oortwijn@xxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sun, 17 Apr 2011 17:15:58 +0200

On 16 April 2011 20:04, Ingo Weinhold <ingo_weinhold@xxxxxx> wrote:
> On Sat, 16 Apr 2011 19:00:40 +0200 Jeroen Oortwijn <oortwijn@xxxxxxxxx> wrote:
>> The only problem is how to unmount this volume. The original code [2]
>> sets the current working directory to root and then unmounts the myfs
>> folder. With my modifications [1], it tries to unmount the root folder
>> and that results in a "Device or resource busy" error. Passing the
>> FSSH_B_FORCE_UNMOUNT flag to _kern_unmount() causes it to loop forever
>> (presumably due to [3]). Removing _kern_setcwd() causes it to
>> segfault.
>>
>> Is there a way to unmount the volume?
>
> Just unset the kernel I/O context's CWD manually. Something like:
>
>  if (gKernelIOContext->cwd != null) {
>    vfs_put_vnode(gKernelIOContext->cwd);
>    gKernelIOContext->cwd = NULL;
>  }

I replaced _kern_setcwd() with the above code, but
gKernelIOContext->cwd is already NULL at that point. After that,
_kern_unmount("/", 0) will segfault because gKernelIOContext->cwd is
NULL.

- Jeroen

Other related posts: