Changeset af7383f in mainline for uspace/srv/vfs/vfs_ops.c
- Timestamp:
- 2009-06-15T19:17:11Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c07af37
- Parents:
- 0ed2e0e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs_ops.c
r0ed2e0e raf7383f 67 67 } pending_req_t; 68 68 69 FIBRIL_MUTEX_INITIALIZE(pending_lock); 69 FIBRIL_CONDVAR_INITIALIZE(pending_cv); 70 bool pending_new_fs = false; /**< True if a new file system was mounted. */ 70 71 LIST_INITIALIZE(pending_req); 71 72 … … 264 265 link_t *cur; 265 266 266 loop: 267 fibril_mutex_lock(&pending_lock); 268 for (cur = pending_req.next; cur != &pending_req; cur = cur->next) { 269 pending_req_t *pr = list_get_instance(cur, pending_req_t, link); 270 271 fs_handle_t fs_handle = fs_name_to_handle(pr->fs_name, true); 272 if (!fs_handle) 273 continue; 267 while (true) { 268 fibril_mutex_lock(&fs_head_lock); 269 while (!pending_new_fs) 270 fibril_condvar_wait(&pending_cv, &fs_head_lock); 271 rescan: 272 for (cur = pending_req.next; cur != &pending_req; 273 cur = cur->next) { 274 pending_req_t *pr = list_get_instance(cur, 275 pending_req_t, link); 276 fs_handle_t fs_handle = fs_name_to_handle(pr->fs_name, 277 false); 278 if (!fs_handle) 279 continue; 274 280 275 /* Acknowledge that we know fs_name. */276 ipc_answer_0(pr->callid, EOK);281 /* Acknowledge that we know fs_name. */ 282 ipc_answer_0(pr->callid, EOK); 277 283 278 /* Do the mount */ 279 vfs_mount_internal(pr->rid, pr->dev_handle, fs_handle, pr->mp, 280 pr->opts); 284 list_remove(cur); 285 fibril_mutex_unlock(&fs_head_lock); 286 287 /* Do the mount */ 288 vfs_mount_internal(pr->rid, pr->dev_handle, fs_handle, 289 pr->mp, pr->opts); 290 291 free(pr->fs_name); 292 free(pr->mp); 293 free(pr->opts); 294 free(pr); 281 295 282 free(pr->fs_name); 283 free(pr->mp); 284 free(pr->opts); 285 list_remove(cur); 286 free(pr); 287 fibril_mutex_unlock(&pending_lock); 288 fibril_yield(); 289 goto loop; 290 } 291 fibril_mutex_unlock(&pending_lock); 296 fibril_mutex_lock(&fs_head_lock); 297 goto rescan; 298 } 299 pending_new_fs = false; 300 fibril_mutex_unlock(&fs_head_lock); 301 } 292 302 } 293 303 … … 445 455 * This will also give us its file system handle. 446 456 */ 447 fs_handle_t fs_handle = fs_name_to_handle(fs_name, true); 457 fibril_mutex_lock(&fs_head_lock); 458 fs_handle_t fs_handle = fs_name_to_handle(fs_name, false); 448 459 if (!fs_handle) { 449 460 if (flags & IPC_FLAG_BLOCKING) { … … 453 464 pr = (pending_req_t *) malloc(sizeof(pending_req_t)); 454 465 if (!pr) { 466 fibril_mutex_unlock(&fs_head_lock); 455 467 ipc_answer_0(callid, ENOMEM); 456 468 ipc_answer_0(rid, ENOMEM); … … 468 480 pr->dev_handle = dev_handle; 469 481 link_initialize(&pr->link); 470 fibril_mutex_lock(&pending_lock);471 482 list_append(&pr->link, &pending_req); 472 fibril_mutex_unlock(& pending_lock);483 fibril_mutex_unlock(&fs_head_lock); 473 484 return; 474 485 } 475 486 487 fibril_mutex_unlock(&fs_head_lock); 476 488 ipc_answer_0(callid, ENOENT); 477 489 ipc_answer_0(rid, ENOENT); … … 481 493 return; 482 494 } 495 fibril_mutex_unlock(&fs_head_lock); 483 496 484 497 /* Acknowledge that we know fs_name. */
Note:
See TracChangeset
for help on using the changeset viewer.