Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset fec333b3 in mainline


Ignore:
Timestamp:
2017-05-15T19:24:25Z (5 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
0e7c3d9
Parents:
9c96634
Message:

Revert cluster allocation only if clusters were allocated

File:
1 edited

Legend:

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

    r9c96634 rfec333b3  
    499499                /* populate the new cluster with unused dentries */
    500500                rc = fat_zero_cluster(bs, service_id, mcl);
    501                 if (rc != EOK) {
    502                         (void) fat_free_clusters(bs, service_id, mcl);
    503                         return rc;
    504                 }
     501                if (rc != EOK)
     502                        goto error;
    505503        }
    506504
    507505        rc = fat_node_get_new(&nodep);
    508         if (rc != EOK) {
    509                 (void) fat_free_clusters(bs, service_id, mcl);
    510                 return rc;
    511         }
     506        if (rc != EOK)
     507                goto error;
    512508        rc = fat_idx_get_new(&idxp, service_id);
    513509        if (rc != EOK) {
    514                 (void) fat_free_clusters(bs, service_id, mcl); 
    515510                (void) fat_node_put(FS_NODE(nodep));
    516                 return rc;
     511                goto error;
    517512        }
    518513        /* idxp->lock held */
     
    536531        *rfn = FS_NODE(nodep);
    537532        return EOK;
     533
     534error:
     535        if (flags & L_DIRECTORY)
     536                (void) fat_free_clusters(bs, service_id, mcl);
     537        return rc;             
    538538}
    539539
Note: See TracChangeset for help on using the changeset viewer.