linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: jaegeuk@kernel.org
Cc: linux-f2fs-devel@lists.sourceforge.net
Subject: [bug report] f2fs: fix missing unlock(sbi->gc_mutex)
Date: Thu, 3 Jan 2019 13:54:04 +0300	[thread overview]
Message-ID: <20190103105404.GA6197@kadam> (raw)

Hello Jaegeuk Kim,

The patch 8f31b4665c14: "f2fs: fix missing unlock(sbi->gc_mutex)"
from Dec 17, 2018, leads to the following static checker warning:

	fs/f2fs/super.c:1481 f2fs_disable_checkpoint()
	error: double lock 'mutex:&sbi->gc_mutex'

fs/f2fs/super.c
    1456 static int f2fs_disable_checkpoint(struct f2fs_sb_info *sbi)
    1457 {
    1458 	struct cp_control cpc;
    1459 	int err;
    1460 
    1461 	sbi->sb->s_flags |= SB_ACTIVE;
    1462 
    1463 	f2fs_update_time(sbi, DISABLE_TIME);
    1464 
    1465 	while (!f2fs_time_over(sbi, DISABLE_TIME)) {
    1466 		mutex_lock(&sbi->gc_mutex);
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
Lock.

    1467 		err = f2fs_gc(sbi, true, false, NULL_SEGNO);
    1468 		if (err == -ENODATA)
    1469 			break;
    1470 		if (err && err != -EAGAIN)
    1471 			return err;
    1472 	}
    1473 
    1474 	err = sync_filesystem(sbi->sb);
    1475 	if (err)
    1476 		return err;
    1477 
    1478 	if (f2fs_disable_cp_again(sbi))
    1479 		return -EAGAIN;
    1480 
--> 1481 	mutex_lock(&sbi->gc_mutex);
                            ^^^^^^^^^^^^^
Deadlock?

    1482 	cpc.reason = CP_PAUSE;
    1483 	set_sbi_flag(sbi, SBI_CP_DISABLED);
    1484 	f2fs_write_checkpoint(sbi, &cpc);
    1485 
    1486 	sbi->unusable_block_count = 0;
    1487 	mutex_unlock(&sbi->gc_mutex);
    1488 	return 0;
    1489 }

regards,
dan carpenter

             reply	other threads:[~2019-01-03 10:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-03 10:54 Dan Carpenter [this message]
2019-01-04  2:30 ` [bug report] f2fs: fix missing unlock(sbi->gc_mutex) 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=20190103105404.GA6197@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    /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).