* [PATCH] f2fs: fix missing unlock(sbi->gc_mutex)
@ 2018-12-18 2:15 Jaegeuk Kim
2018-12-18 10:33 ` [f2fs-dev] " Chao Yu
2018-12-18 23:22 ` [PATCH v2] " Jaegeuk Kim
0 siblings, 2 replies; 4+ messages in thread
From: Jaegeuk Kim @ 2018-12-18 2:15 UTC (permalink / raw)
To: linux-kernel, linux-f2fs-devel; +Cc: Jaegeuk Kim, stable
This fixes missing unlock call.
Cc: <stable@vger.kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
fs/f2fs/super.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index b79677639108..2689a2cb56cc 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1462,6 +1462,9 @@ static int f2fs_disable_checkpoint(struct f2fs_sb_info *sbi)
while (!f2fs_time_over(sbi, DISABLE_TIME)) {
err = f2fs_gc(sbi, true, false, NULL_SEGNO);
+
+ /* f2fs_gc guarantees unlock gc_mutex */
+ mutex_lock(&sbi->gc_mutex);
if (err == -ENODATA)
break;
if (err && err != -EAGAIN) {
--
2.19.0.605.g01d371f741-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: fix missing unlock(sbi->gc_mutex)
2018-12-18 2:15 [PATCH] f2fs: fix missing unlock(sbi->gc_mutex) Jaegeuk Kim
@ 2018-12-18 10:33 ` Chao Yu
2018-12-18 23:22 ` [PATCH v2] " Jaegeuk Kim
1 sibling, 0 replies; 4+ messages in thread
From: Chao Yu @ 2018-12-18 10:33 UTC (permalink / raw)
To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel; +Cc: stable
On 2018/12/18 10:15, Jaegeuk Kim wrote:
> This fixes missing unlock call.
>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
> fs/f2fs/super.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index b79677639108..2689a2cb56cc 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -1462,6 +1462,9 @@ static int f2fs_disable_checkpoint(struct f2fs_sb_info *sbi)
>
> while (!f2fs_time_over(sbi, DISABLE_TIME)) {
> err = f2fs_gc(sbi, true, false, NULL_SEGNO);
> +
> + /* f2fs_gc guarantees unlock gc_mutex */
How about:
while () {
mutex_lock(&sbi->gc_mutex);
err = f2fs_gc();
if (err) {
handle error cases..
}
}
Thanks,
> + mutex_lock(&sbi->gc_mutex);
> if (err == -ENODATA)
> break;
> if (err && err != -EAGAIN) {
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] f2fs: fix missing unlock(sbi->gc_mutex)
2018-12-18 2:15 [PATCH] f2fs: fix missing unlock(sbi->gc_mutex) Jaegeuk Kim
2018-12-18 10:33 ` [f2fs-dev] " Chao Yu
@ 2018-12-18 23:22 ` Jaegeuk Kim
2018-12-19 3:44 ` [f2fs-dev] " Chao Yu
1 sibling, 1 reply; 4+ messages in thread
From: Jaegeuk Kim @ 2018-12-18 23:22 UTC (permalink / raw)
To: linux-kernel, linux-f2fs-devel; +Cc: stable
This fixes missing unlock call.
Cc: <stable@vger.kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
v1 -> v2:
- clean up
fs/f2fs/super.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index b79677639108..cec7ef27b389 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1457,19 +1457,16 @@ static int f2fs_disable_checkpoint(struct f2fs_sb_info *sbi)
sbi->sb->s_flags |= SB_ACTIVE;
- mutex_lock(&sbi->gc_mutex);
f2fs_update_time(sbi, DISABLE_TIME);
while (!f2fs_time_over(sbi, DISABLE_TIME)) {
+ mutex_lock(&sbi->gc_mutex);
err = f2fs_gc(sbi, true, false, NULL_SEGNO);
if (err == -ENODATA)
break;
- if (err && err != -EAGAIN) {
- mutex_unlock(&sbi->gc_mutex);
+ if (err && err != -EAGAIN)
return err;
- }
}
- mutex_unlock(&sbi->gc_mutex);
err = sync_filesystem(sbi->sb);
if (err)
--
2.19.0.605.g01d371f741-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [f2fs-dev] [PATCH v2] f2fs: fix missing unlock(sbi->gc_mutex)
2018-12-18 23:22 ` [PATCH v2] " Jaegeuk Kim
@ 2018-12-19 3:44 ` Chao Yu
0 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2018-12-19 3:44 UTC (permalink / raw)
To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel; +Cc: stable
On 2018/12/19 7:22, Jaegeuk Kim wrote:
> This fixes missing unlock call.
>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Looks good to me now. :)
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Thanks,
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-12-19 3:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-18 2:15 [PATCH] f2fs: fix missing unlock(sbi->gc_mutex) Jaegeuk Kim
2018-12-18 10:33 ` [f2fs-dev] " Chao Yu
2018-12-18 23:22 ` [PATCH v2] " Jaegeuk Kim
2018-12-19 3:44 ` [f2fs-dev] " Chao Yu
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).