Rev 2687 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2687 | Rev 2688 | ||
---|---|---|---|
Line 91... | Line 91... | ||
91 | /* |
91 | /* |
92 | * Avoid the race condition in which the file can be deleted before we |
92 | * Avoid the race condition in which the file can be deleted before we |
93 | * find/create-and-lock the VFS node corresponding to the looked-up |
93 | * find/create-and-lock the VFS node corresponding to the looked-up |
94 | * triplet. |
94 | * triplet. |
95 | */ |
95 | */ |
96 | rwlock_reader_lock(&namespace_rwlock); |
96 | rwlock_read_lock(&namespace_rwlock); |
97 | 97 | ||
98 | /* |
98 | /* |
99 | * The path is now populated and we can call vfs_lookup_internal(). |
99 | * The path is now populated and we can call vfs_lookup_internal(). |
100 | */ |
100 | */ |
101 | vfs_triplet_t triplet; |
101 | vfs_triplet_t triplet; |
102 | size_t size; |
102 | size_t size; |
103 | rc = vfs_lookup_internal(path, len, &triplet, &size, NULL); |
103 | rc = vfs_lookup_internal(path, len, &triplet, &size, NULL); |
104 | if (rc) { |
104 | if (rc) { |
105 | rwlock_reader_unlock(&namespace_rwlock); |
105 | rwlock_read_unlock(&namespace_rwlock); |
106 | ipc_answer_0(rid, rc); |
106 | ipc_answer_0(rid, rc); |
107 | free(path); |
107 | free(path); |
108 | return; |
108 | return; |
109 | } |
109 | } |
110 | 110 | ||
Line 112... | Line 112... | ||
112 | * Path is no longer needed. |
112 | * Path is no longer needed. |
113 | */ |
113 | */ |
114 | free(path); |
114 | free(path); |
115 | 115 | ||
116 | vfs_node_t *node = vfs_node_get(&triplet, size); |
116 | vfs_node_t *node = vfs_node_get(&triplet, size); |
117 | rwlock_reader_unlock(&namespace_rwlock); |
117 | rwlock_read_unlock(&namespace_rwlock); |
118 | 118 | ||
119 | /* |
119 | /* |
120 | * Get ourselves a file descriptor and the corresponding vfs_file_t |
120 | * Get ourselves a file descriptor and the corresponding vfs_file_t |
121 | * structure. |
121 | * structure. |
122 | */ |
122 | */ |