Changes in / [e0e568ff:a7a85d16] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/fat/fat_ops.c
re0e568ff ra7a85d16 369 369 unsigned blocks; 370 370 fat_dentry_t *d; 371 dev_handle_t dev_handle;372 371 block_t *b; 373 372 int rc; 374 373 375 374 fibril_mutex_lock(&parentp->idx->lock); 376 dev_handle = parentp->idx->dev_handle; 377 fibril_mutex_unlock(&parentp->idx->lock); 378 379 bs = block_bb_get(dev_handle); 375 bs = block_bb_get(parentp->idx->dev_handle); 380 376 blocks = parentp->size / BPS(bs); 381 377 for (i = 0; i < blocks; i++) { 382 378 rc = fat_block_get(&b, bs, parentp, i, BLOCK_FLAGS_NONE); 383 if (rc != EOK) 379 if (rc != EOK) { 380 fibril_mutex_unlock(&parentp->idx->lock); 384 381 return rc; 382 } 385 383 for (j = 0; j < DPS(bs); j++) { 386 384 d = ((fat_dentry_t *)b->data) + j; … … 392 390 /* miss */ 393 391 rc = block_put(b); 392 fibril_mutex_unlock(&parentp->idx->lock); 394 393 *rfn = NULL; 395 394 return rc; … … 402 401 /* hit */ 403 402 fat_node_t *nodep; 404 fat_idx_t *idx = fat_idx_get_by_pos(dev_handle, 405 parentp->firstc, i * DPS(bs) + j); 403 /* 404 * Assume tree hierarchy for locking. We 405 * already have the parent and now we are going 406 * to lock the child. Never lock in the oposite 407 * order. 408 */ 409 fat_idx_t *idx = fat_idx_get_by_pos( 410 parentp->idx->dev_handle, parentp->firstc, 411 i * DPS(bs) + j); 412 fibril_mutex_unlock(&parentp->idx->lock); 406 413 if (!idx) { 407 414 /* … … 426 433 } 427 434 rc = block_put(b); 428 if (rc != EOK) 435 if (rc != EOK) { 436 fibril_mutex_unlock(&parentp->idx->lock); 429 437 return rc; 430 } 431 438 } 439 } 440 441 fibril_mutex_unlock(&parentp->idx->lock); 432 442 *rfn = NULL; 433 443 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.