summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2015-12-07 10:18:54 -0800
committerJaegeuk Kim <jaegeuk@kernel.org>2015-12-09 09:53:18 -0800
commitea212a4a7a432e0ecd0f0f53971b70172b3e7f96 (patch)
tree6b93d189c07456be4ed6758a6900ef5af6ed4b20
parent5d909cdbbba244ecb4c2dfc4dc3e3bc29529fb05 (diff)
downloadop-kernel-dev-ea212a4a7a432e0ecd0f0f53971b70172b3e7f96.zip
op-kernel-dev-ea212a4a7a432e0ecd0f0f53971b70172b3e7f96.tar.gz
f2fs: use lock_buffer when changing superblock
When modifying sb contents, we need to use lock its buffer. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--fs/f2fs/file.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index a018ed3..294e715 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1591,14 +1591,18 @@ static int f2fs_ioc_get_encryption_pwsalt(struct file *filp, unsigned long arg)
return err;
/* update superblock with uuid */
+ lock_buffer(sbi->raw_super_buf);
generate_random_uuid(sbi->raw_super->encrypt_pw_salt);
+ unlock_buffer(sbi->raw_super_buf);
err = f2fs_commit_super(sbi, false);
mnt_drop_write_file(filp);
if (err) {
/* undo new data */
+ lock_buffer(sbi->raw_super_buf);
memset(sbi->raw_super->encrypt_pw_salt, 0, 16);
+ unlock_buffer(sbi->raw_super_buf);
return err;
}
got_it:
OpenPOWER on IntegriCloud