Changeset f57f8ea in mainline
- Timestamp:
- 2008-01-02T20:25:24Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9413c0d
- Parents:
- 215e375
- Location:
- uspace/srv/vfs
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs.h
r215e375 rf57f8ea 135 135 unsigned refcnt; /**< Usage counter. */ 136 136 link_t nh_link; /**< Node hash-table link. */ 137 138 /** Holding this futex prevents modifications of the node's contents. */ 139 atomic_t contents_futex; 137 140 } vfs_node_t; 138 141 … … 170 173 extern link_t plb_head; /**< List of active PLB entries. */ 171 174 172 extern atomic_t unlink_futex; /**< VFS_{CREATE|OPEN|UNLINK} serialization. */ 175 /** Holding this futex prevents extern changes in file system namespace. */ 176 atomic_t namespace_futex; 173 177 174 178 extern int vfs_grab_phone(int); -
uspace/srv/vfs/vfs_mount.c
r215e375 rf57f8ea 155 155 /* 156 156 * Lookup the root node of the filesystem being mounted. 157 * In this case, we don't need to take the unlink_futex as the root node158 * cannot be removed. However, we do take a reference to it so that159 * we can track how many times it has been mounted.157 * In this case, we don't need to take the namespace_futex as the root 158 * node cannot be removed. However, we do take a reference to it so 159 * that we can track how many times it has been mounted. 160 160 */ 161 161 int rc; … … 183 183 * We already have the root FS. 184 184 */ 185 futex_down(& unlink_futex);185 futex_down(&namespace_futex); 186 186 rc = vfs_lookup_internal(buf, size, &mp, NULL); 187 187 if (rc != EOK) { … … 189 189 * The lookup failed for some reason. 190 190 */ 191 futex_up(& unlink_futex);191 futex_up(&namespace_futex); 192 192 futex_up(&rootfs_futex); 193 193 vfs_node_put(mr_node); /* failed -> drop reference */ … … 198 198 mp_node = vfs_node_get(&mp); 199 199 if (!mp_node) { 200 futex_up(& unlink_futex);200 futex_up(&namespace_futex); 201 201 futex_up(&rootfs_futex); 202 202 vfs_node_put(mr_node); /* failed -> drop reference */ … … 210 210 * This prevents the mount point from being deleted. 211 211 */ 212 futex_up(& unlink_futex);212 futex_up(&namespace_futex); 213 213 } else { 214 214 /* -
uspace/srv/vfs/vfs_node.c
r215e375 rf57f8ea 147 147 node->index = triplet->index; 148 148 link_initialize(&node->nh_link); 149 futex_initialize(&node->contents_futex, 1); 149 150 hash_table_insert(&nodes, key, &node->nh_link); 150 151 } else { -
uspace/srv/vfs/vfs_open.c
r215e375 rf57f8ea 94 94 * triplet. 95 95 */ 96 futex_down(& unlink_futex);96 futex_down(&namespace_futex); 97 97 98 98 /* … … 102 102 rc = vfs_lookup_internal(path, size, &triplet, NULL); 103 103 if (rc) { 104 futex_up(& unlink_futex);104 futex_up(&namespace_futex); 105 105 ipc_answer_0(rid, rc); 106 106 free(path); … … 114 114 115 115 vfs_node_t *node = vfs_node_get(&triplet); 116 futex_up(& unlink_futex);116 futex_up(&namespace_futex); 117 117 118 118 /* -
uspace/srv/vfs/vfs_rdwr.c
r215e375 rf57f8ea 40 40 #include <async.h> 41 41 #include <errno.h> 42 #include <futex.h> 42 43 43 44 static void vfs_rdwr(ipc_callid_t rid, ipc_call_t *request, bool read) … … 81 82 } 82 83 84 /* 85 * Lock the file's node so that no other client can read/write to it at 86 * the same time. 87 */ 88 futex_down(&file->node->contents_futex); 89 83 90 int fs_phone = vfs_grab_phone(file->node->fs_handle); 84 91 … … 109 116 110 117 /* 118 * Unlock the VFS node. 119 */ 120 futex_up(&file->node->contents_futex); 121 122 /* 111 123 * Update the position pointer. 112 124 */ -
uspace/srv/vfs/vfs_unlink.c
r215e375 rf57f8ea 41 41 /** 42 42 * This futex prevents the race between a triplet-to-VFS-node resolution and a 43 * concurrent VFS _UNLINK or VFS_RMDIR operation.43 * concurrent VFS operation which modifies the file system namespace. 44 44 */ 45 atomic_t unlink_futex = FUTEX_INITIALIZER;45 atomic_t namespace_futex = FUTEX_INITIALIZER; 46 46 47 47 /**
Note:
See TracChangeset
for help on using the changeset viewer.