diff options
author | Chao Yu <chao2.yu@samsung.com> | 2015-10-22 06:23:08 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2015-10-22 12:39:24 -0400 |
commit | a6be014e1d28339ba7c745fc4ac1efdbf6e2c1a2 (patch) | |
tree | 5283cabac5f40449b10e102838a5b8b3f85ab379 /fs/f2fs/namei.c | |
parent | 7fee740697e0d9a57d618b6fec79e4c4e09fd606 (diff) |
f2fs: fix error path of ->symlink
Now, in ->symlink of f2fs, we kept the fixed invoking order between
f2fs_add_link and page_symlink since we should init node info firstly
in f2fs_add_link, then such node info can be used in page_symlink.
But we didn't fix to release meta info which was done before page_symlink
in our error path, so this will leave us corrupt symlink entry in its
parent's dentry page. Fix this issue by adding f2fs_unlink in the error
path for removing such linking.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/namei.c')
-rw-r--r-- | fs/f2fs/namei.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index dfa01c88b34b..e48b80c49090 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c | |||
@@ -410,11 +410,14 @@ err_out: | |||
410 | * If the symlink path is stored into inline_data, there is no | 410 | * If the symlink path is stored into inline_data, there is no |
411 | * performance regression. | 411 | * performance regression. |
412 | */ | 412 | */ |
413 | if (!err) | 413 | if (!err) { |
414 | filemap_write_and_wait_range(inode->i_mapping, 0, p_len - 1); | 414 | filemap_write_and_wait_range(inode->i_mapping, 0, p_len - 1); |
415 | 415 | ||
416 | if (IS_DIRSYNC(dir)) | 416 | if (IS_DIRSYNC(dir)) |
417 | f2fs_sync_fs(sbi->sb, 1); | 417 | f2fs_sync_fs(sbi->sb, 1); |
418 | } else { | ||
419 | f2fs_unlink(dir, dentry); | ||
420 | } | ||
418 | 421 | ||
419 | kfree(sd); | 422 | kfree(sd); |
420 | f2fs_fname_crypto_free_buffer(&disk_link); | 423 | f2fs_fname_crypto_free_buffer(&disk_link); |