Changes in / [e0e568ff:a7a85d16] in mainline


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/fat/fat_ops.c

    re0e568ff ra7a85d16  
    369369        unsigned blocks;
    370370        fat_dentry_t *d;
    371         dev_handle_t dev_handle;
    372371        block_t *b;
    373372        int rc;
    374373
    375374        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);
    380376        blocks = parentp->size / BPS(bs);
    381377        for (i = 0; i < blocks; i++) {
    382378                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);
    384381                        return rc;
     382                }
    385383                for (j = 0; j < DPS(bs); j++) {
    386384                        d = ((fat_dentry_t *)b->data) + j;
     
    392390                                /* miss */
    393391                                rc = block_put(b);
     392                                fibril_mutex_unlock(&parentp->idx->lock);
    394393                                *rfn = NULL;
    395394                                return rc;
     
    402401                                /* hit */
    403402                                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);
    406413                                if (!idx) {
    407414                                        /*
     
    426433                }
    427434                rc = block_put(b);
    428                 if (rc != EOK)
     435                if (rc != EOK) {
     436                        fibril_mutex_unlock(&parentp->idx->lock);
    429437                        return rc;
    430         }
    431 
     438                }
     439        }
     440
     441        fibril_mutex_unlock(&parentp->idx->lock);
    432442        *rfn = NULL;
    433443        return EOK;
Note: See TracChangeset for help on using the changeset viewer.