From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <chao2.yu@samsung.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH 3/3 v2] f2fs: use lock_buffer when changing superblock
Date: Wed, 9 Dec 2015 09:54:40 -0800 [thread overview]
Message-ID: <20151209175440.GA975@jaegeuk.local> (raw)
In-Reply-To: <015101d13248$58a641e0$09f2c5a0$@samsung.com>
Agreed.
Change log from v1:
o apply for _undo_ flow as well
>From ea212a4a7a432e0ecd0f0f53971b70172b3e7f96 Mon Sep 17 00:00:00 2001
From: Jaegeuk Kim <jaegeuk@kernel.org>
Date: Mon, 7 Dec 2015 10:18:54 -0800
Subject: [PATCH] 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>
---
fs/f2fs/file.c | 4 ++++
1 file changed, 4 insertions(+)
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:
--
2.4.9 (Apple Git-60)
------------------------------------------------------------------------------
next prev parent reply other threads:[~2015-12-09 17:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-07 22:53 [PATCH 1/3] f2fs: enhance the bit operation for SSR Jaegeuk Kim
2015-12-07 22:53 ` [PATCH 2/3] f2fs: refactor f2fs_commit_super Jaegeuk Kim
2015-12-09 6:08 ` [f2fs-dev] " Chao Yu
2015-12-07 22:53 ` [PATCH 3/3] f2fs: use lock_buffer when changing superblock Jaegeuk Kim
2015-12-09 6:10 ` [f2fs-dev] " Chao Yu
2015-12-09 17:54 ` Jaegeuk Kim [this message]
2015-12-09 6:06 ` [PATCH 1/3] f2fs: enhance the bit operation for SSR Chao Yu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151209175440.GA975@jaegeuk.local \
--to=jaegeuk@kernel.org \
--cc=chao2.yu@samsung.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).