Changeset 5ca5eaa7 in mainline for uspace/srv/fs/fat/fat_ops.c


Ignore:
Timestamp:
2011-02-27T19:25:11Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
05155a1, 5716e9a
Parents:
89e780d
Message:

Create an extra reference to an unlinked FAT node. This keeps the node
resident in memory until the node is eventually destroyed. The extra
reference especially prevents the unlinked node from being put onto the
node free list in the meantime. Otherwise the node structure can be
recycled for instantiating some unrelated node.

File:
1 edited

Legend:

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

    r89e780d r5ca5eaa7  
    812812        fibril_mutex_unlock(&childp->idx->lock);
    813813        childp->lnkcnt = 0;
     814        childp->refcnt++;       /* keep the node in memory until destroyed */
    814815        childp->dirty = true;
    815816        fibril_mutex_unlock(&childp->lock);
     
    14891490        fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request);
    14901491        fs_node_t *fn;
     1492        fat_node_t *nodep;
    14911493        int rc;
    14921494
     
    15001502                return;
    15011503        }
     1504
     1505        nodep = FAT_NODE(fn);
     1506        /*
     1507         * We should have exactly two references. One for the above
     1508         * call to fat_node_get() and one from fat_unlink().
     1509         */
     1510        assert(nodep->refcnt == 2);
    15021511
    15031512        rc = fat_destroy_node(fn);
Note: See TracChangeset for help on using the changeset viewer.