Author: mmlr Date: 2010-04-14 23:46:14 +0200 (Wed, 14 Apr 2010) New Revision: 36273 Changeset: http://dev.haiku-os.org/changeset/36273/haiku Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp Log: bonefish+mmlr: The O_CLOEXEC open mode wasn't actually set in the close-on-exec bitmap causing all files opened with O_CLOEXEC (like done in the storage kit classes) to still be inherited. This caused for example to be unable to unmount volumes when opening apps while Tracker touched some files (i.e. copying some large files) since these apps would inherit the file descriptor and therefore keep the volume busy. Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2010-04-14 21:38:08 UTC (rev 36272) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2010-04-14 21:46:14 UTC (rev 36273) @@ -2857,12 +2857,17 @@ descriptor->type = type; descriptor->open_mode = openMode; - fd = new_fd(get_current_io_context(kernel), descriptor); + io_context* context = get_current_io_context(kernel); + fd = new_fd(context, descriptor); if (fd < 0) { free(descriptor); return B_NO_MORE_FDS; } + mutex_lock(&context->io_mutex); + fd_set_close_on_exec(context, fd, (openMode & O_CLOEXEC) != 0); + mutex_unlock(&context->io_mutex); + return fd; }