diff options
author | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-10-07 21:19:28 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-10-07 21:19:28 -0400 |
commit | ccaaca25919a2cdeccd8fdce5f546e3ed7f6a9e9 (patch) | |
tree | 225d4bc2a01b6e6331081754af1beb9875ea34be /fs/f2fs/namei.c | |
parent | 5887d291d792773368f6eaf1759aad109bcd78eb (diff) |
f2fs: fix writing incorrect orphan blocks
Previously, there was a erroneous scenario like below.
thread 1: thread 2:
f2fs_unlink
- acquire_orphan_inode
: sbi->n_orphans++ write_checkpoint
- block_operations
: f2fs_lock_all
- do_checkpoint
: write orphan blocks with sbi->n_orphans
- unblock_operations
- f2fs_lock_op
- release_orphan_inode
- f2fs_unlock_op
During the checkpoint by thread 2, f2fs stores a wrong orphan block according
to the wrong sbi->n_orphans.
To avoid this, simply we should make cover acquire_orphan_inode too with
f2fs_lock_op.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/namei.c')
-rw-r--r-- | fs/f2fs/namei.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 29f73fdf958e..575adac17f8b 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c | |||
@@ -228,14 +228,14 @@ static int f2fs_unlink(struct inode *dir, struct dentry *dentry) | |||
228 | if (!de) | 228 | if (!de) |
229 | goto fail; | 229 | goto fail; |
230 | 230 | ||
231 | f2fs_lock_op(sbi); | ||
231 | err = acquire_orphan_inode(sbi); | 232 | err = acquire_orphan_inode(sbi); |
232 | if (err) { | 233 | if (err) { |
234 | f2fs_unlock_op(sbi); | ||
233 | kunmap(page); | 235 | kunmap(page); |
234 | f2fs_put_page(page, 0); | 236 | f2fs_put_page(page, 0); |
235 | goto fail; | 237 | goto fail; |
236 | } | 238 | } |
237 | |||
238 | f2fs_lock_op(sbi); | ||
239 | f2fs_delete_entry(de, page, inode); | 239 | f2fs_delete_entry(de, page, inode); |
240 | f2fs_unlock_op(sbi); | 240 | f2fs_unlock_op(sbi); |
241 | 241 | ||