Changeset 8810c63 in mainline for uspace/srv/fs/fat/fat_ops.c


Ignore:
Timestamp:
2009-10-01T11:50:28Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5643a04, f5af635
Parents:
9a15176
Message:

Do not assume that a block is not dirty if we did not make it dirty.
It could have been already dirty when we got a reference to it.

File:
1 edited

Legend:

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

    r9a15176 r8810c63  
    331331                                continue;
    332332                        case FAT_DENTRY_LAST:
     333                                /* miss */
    333334                                rc = block_put(b);
    334                                 /* expect EOK as b was not dirty */
    335                                 assert(rc == EOK);     
    336335                                fibril_mutex_unlock(&parentp->idx->lock);
    337336                                *rfn = NULL;
    338                                 return EOK;
     337                                return rc;
    339338                        default:
    340339                        case FAT_DENTRY_VALID:
     
    361360                                         */
    362361                                        rc = block_put(b);
    363                                         /* expect EOK as b was not dirty */
    364                                         assert(rc == EOK);     
    365                                         return ENOMEM;
     362                                        return (rc == EOK) ? ENOMEM : rc;
    366363                                }
    367364                                rc = fat_node_get_core(&nodep, idx);
    368365                                assert(rc == EOK);
    369366                                fibril_mutex_unlock(&idx->lock);
    370                                 rc = block_put(b);
    371                                 /* expect EOK as b was not dirty */
    372                                 assert(rc == EOK);
     367                                (void) block_put(b);
    373368                                *rfn = FS_NODE(nodep);
    374369                                return EOK;
     
    376371                }
    377372                rc = block_put(b);
    378                 assert(rc == EOK);      /* expect EOK as b was not dirty */
     373                if (rc != EOK) {
     374                        fibril_mutex_unlock(&parentp->idx->lock);
     375                        return rc;
     376                }
    379377        }
    380378
     
    810808                        case FAT_DENTRY_LAST:
    811809                                rc = block_put(b);
    812                                 /* expect EOK as b was not dirty */
    813                                 assert(rc == EOK);
    814810                                fibril_mutex_unlock(&nodep->idx->lock);
    815811                                *has_children = false;
    816                                 return EOK;
     812                                return rc;
    817813                        default:
    818814                        case FAT_DENTRY_VALID:
    819815                                rc = block_put(b);
    820                                 /* expect EOK as b was not dirty */
    821                                 assert(rc == EOK);
    822816                                fibril_mutex_unlock(&nodep->idx->lock);
    823817                                *has_children = true;
    824                                 return EOK;
     818                                return rc;
    825819                        }
    826820                }
    827821                rc = block_put(b);
    828                 assert(rc == EOK);      /* expect EOK as b was not dirty */
     822                if (rc != EOK) {
     823                        fibril_mutex_unlock(&nodep->idx->lock);
     824                        return rc;     
     825                }
    829826        }
    830827
Note: See TracChangeset for help on using the changeset viewer.