Not doing so would result in the following operation creating the last directory in the chain without a correct checksum (would require running fsck.ext4 on Linux): mkdir -p /n/ext4/1/2/3
Unified · Split
| @@ -237,19 +237,17 @@ static int ext4_link(struct ext4_mountpoint *mp, struct ext4_inode_ref *parent, · 236 unmodified lines | ||
| 237 | 237 | ch->dirty = true; |
| 238 | 238 | } else |
| 239 | 239 | #endif |
| 240 | − { | |
| 241 | − r = ext4_dir_add_entry(ch, ".", strlen("."), ch); | |
| 242 | − if (r != EOK) { | |
| 243 | − ext4_dir_remove_entry(parent, n, strlen(n)); | |
| 244 | − return r; | |
| 245 | − } | |
| 240 | + r = ext4_dir_add_entry(ch, ".", strlen("."), ch); | |
| 241 | + if (r != EOK) { | |
| 242 | + ext4_dir_remove_entry(parent, n, strlen(n)); | |
| 243 | + return r; | |
| 244 | + } | |
| 246 | 245 | |
| 247 | − r = ext4_dir_add_entry(ch, "..", strlen(".."), parent); | |
| 248 | − if (r != EOK) { | |
| 249 | − ext4_dir_remove_entry(parent, n, strlen(n)); | |
| 250 | − ext4_dir_remove_entry(ch, ".", strlen(".")); | |
| 251 | − return r; | |
| 252 | − } | |
| 246 | + r = ext4_dir_add_entry(ch, "..", strlen(".."), parent); | |
| 247 | + if (r != EOK) { | |
| 248 | + ext4_dir_remove_entry(parent, n, strlen(n)); | |
| 249 | + ext4_dir_remove_entry(ch, ".", strlen(".")); | |
| 250 | + return r; | |
| 253 | 251 | } |
| 254 | 252 | |
| 255 | 253 | /*New empty directory. Two links (. and ..) */ |