Changeset 493853ec in mainline
- Timestamp:
- 2009-05-23T16:25:58Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ac23b9d3
- Parents:
- 4ef6645
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs_ops.c
r4ef6645 r493853ec 75 75 RWLOCK_INITIALIZE(namespace_rwlock); 76 76 77 futex_t rootfs_futex = FUTEX_INITIALIZER;78 77 vfs_pair_t rootfs = { 79 78 .fs_handle = 0, … … 96 95 ipc_call_t answer; 97 96 98 99 97 /* Resolve the path to the mountpoint. */ 100 futex_down(&rootfs_futex);98 rwlock_write_lock(&namespace_rwlock); 101 99 if (rootfs.fs_handle) { 102 100 /* We already have the root FS. */ 103 rwlock_write_lock(&namespace_rwlock);104 101 if (str_cmp(mp, "/") == 0) { 105 102 /* Trying to mount root FS over root FS */ 103 ipc_answer_0(rid, EBUSY); 106 104 rwlock_write_unlock(&namespace_rwlock); 107 futex_up(&rootfs_futex);108 ipc_answer_0(rid, EBUSY);109 105 return; 110 106 } … … 113 109 if (rc != EOK) { 114 110 /* The lookup failed for some reason. */ 111 ipc_answer_0(rid, rc); 115 112 rwlock_write_unlock(&namespace_rwlock); 116 futex_up(&rootfs_futex);117 ipc_answer_0(rid, rc);118 113 return; 119 114 } … … 121 116 mp_node = vfs_node_get(&mp_res); 122 117 if (!mp_node) { 118 ipc_answer_0(rid, ENOMEM); 123 119 rwlock_write_unlock(&namespace_rwlock); 124 futex_up(&rootfs_futex);125 ipc_answer_0(rid, ENOMEM);126 120 return; 127 121 } … … 132 126 * This prevents the mount point from being deleted. 133 127 */ 134 rwlock_write_unlock(&namespace_rwlock);135 128 } else { 136 129 /* We still don't have the root file system mounted. */ … … 151 144 async_wait_for(msg, NULL); 152 145 vfs_release_phone(phone); 153 futex_up(&rootfs_futex);154 146 ipc_answer_0(rid, rc); 147 rwlock_write_unlock(&namespace_rwlock); 155 148 return; 156 149 } … … 159 152 160 153 if (rc != EOK) { 161 futex_up(&rootfs_futex);162 154 ipc_answer_0(rid, rc); 155 rwlock_write_unlock(&namespace_rwlock); 163 156 return; 164 157 } … … 177 170 rootfs.fs_handle = fs_handle; 178 171 rootfs.dev_handle = dev_handle; 179 futex_up(&rootfs_futex);180 172 181 173 /* Add reference to the mounted root. */ … … 184 176 185 177 ipc_answer_0(rid, rc); 178 rwlock_write_unlock(&namespace_rwlock); 186 179 return; 187 180 } else { … … 190 183 * being mounted first. 191 184 */ 192 futex_up(&rootfs_futex);193 185 ipc_answer_0(rid, ENOENT); 186 rwlock_write_unlock(&namespace_rwlock); 194 187 return; 195 188 } 196 189 } 197 futex_up(&rootfs_futex);198 190 199 191 /* … … 222 214 vfs_node_put(mp_node); 223 215 ipc_answer_0(rid, rc); 216 rwlock_write_unlock(&namespace_rwlock); 224 217 return; 225 218 } … … 234 227 vfs_node_put(mp_node); 235 228 ipc_answer_0(rid, rc); 229 rwlock_write_unlock(&namespace_rwlock); 236 230 return; 237 231 } … … 239 233 vfs_release_phone(phone); 240 234 241 if (rc != EOK) { 235 if (rc == EOK) { 236 rindex = (fs_index_t) IPC_GET_ARG1(answer); 237 rsize = (size_t) IPC_GET_ARG2(answer); 238 rlnkcnt = (unsigned) IPC_GET_ARG3(answer); 239 240 mr_res.triplet.fs_handle = fs_handle; 241 mr_res.triplet.dev_handle = dev_handle; 242 mr_res.triplet.index = rindex; 243 mr_res.size = rsize; 244 mr_res.lnkcnt = rlnkcnt; 245 mr_res.type = VFS_NODE_DIRECTORY; 246 247 /* Add reference to the mounted root. */ 248 mr_node = vfs_node_get(&mr_res); 249 assert(mr_node); 250 } else { 242 251 /* Mount failed, drop reference to mp_node. */ 243 252 if (mp_node) 244 253 vfs_node_put(mp_node); 245 254 } 246 247 rindex = (fs_index_t) IPC_GET_ARG1(answer);248 rsize = (size_t) IPC_GET_ARG2(answer);249 rlnkcnt = (unsigned) IPC_GET_ARG3(answer);250 251 mr_res.triplet.fs_handle = fs_handle;252 mr_res.triplet.dev_handle = dev_handle;253 mr_res.triplet.index = rindex;254 mr_res.size = rsize;255 mr_res.lnkcnt = rlnkcnt;256 mr_res.type = VFS_NODE_DIRECTORY;257 258 /* Add reference to the mounted root. */259 mr_node = vfs_node_get(&mr_res);260 assert(mr_node);261 255 262 256 ipc_answer_0(rid, rc); 257 rwlock_write_unlock(&namespace_rwlock); 263 258 } 264 259
Note:
See TracChangeset
for help on using the changeset viewer.