LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Sahitya Tummala <stummala@codeaurora.org>
To: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Chao Yu <yuchao0@huawei.com>,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] f2fs: Fix deadlock in shutdown ioctl
Date: Fri, 18 May 2018 13:09:53 +0530	[thread overview]
Message-ID: <20180518073953.GC6293@codeaurora.org> (raw)
In-Reply-To: <20180518010826.GC33876@jaegeuk-macbookpro.roam.corp.google.com>

On Thu, May 17, 2018 at 06:08:26PM -0700, Jaegeuk Kim wrote:
> 
> if (in == F2FS_GOING_DOWN_FULLSYNC) {
> 	sb = freeze_bdev();
> 	if (IS_ERR(sb))
> 		return PTR_ERR(sb);
> 	if (unlikely(!sb))
> 		return -EINVAL;
> }
> 
> ret = mnt_want_write_file();

It will be stuck/blocked here as freeze_bdev() now holds the write 
lock for all the cases including SB_FREEZE_WRITE. As freeze_bdev()
holds the write lock, I think f2fs_stop_checkpoint() should be safe
even without mnt_want_write_file().

I have posted v3 as per Chao's comments to exclude mnt_want_write_file()
for F2FS_GOING_DOWN_FULLSYNC case.
Please check and let me know if there are any further comments.

> ...
> switch() {
> case F2FS_GOING_DOWN_FULLSYNC:
> 	f2fs_stop_checkpoint();
> 	dhaw_bdev();
> 	break;
> ...
> }
> 
> drop:
> ...
> 
> 
--
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

      reply	other threads:[~2018-05-18  7:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-17  8:03 Sahitya Tummala
2018-05-17 11:12 ` Chao Yu
2018-05-18  1:08   ` Jaegeuk Kim
2018-05-18  7:39     ` Sahitya Tummala [this message]

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=20180518073953.GC6293@codeaurora.org \
    --to=stummala@codeaurora.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yuchao0@huawei.com \
    --subject='Re: [PATCH v2] f2fs: Fix deadlock in shutdown ioctl' \
    /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

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).