linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: Bo Ye <bo.ye@mediatek.com>, Jaegeuk Kim <jaegeuk@kernel.org>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>
Cc: Qilin Tan <qilin.tan@mediatek.com>,
	yongdong.zhang@mediatek.com, linux-kernel@vger.kernel.org,
	light.hsieh@mediatek.com, linux-f2fs-devel@lists.sourceforge.net,
	linux-mediatek@lists.infradead.org, browse.zhang@mediatek.com,
	linux-arm-kernel@lists.infradead.org, peng.zhou@mediatek.com
Subject: Re: [f2fs-dev] [PATCH 1/2] f2fs: fix iostat lock protection
Date: Sat, 1 Apr 2023 08:53:28 +0800	[thread overview]
Message-ID: <203ef118-30ca-0ce9-f73e-c5ee45f61369@kernel.org> (raw)
In-Reply-To: <20230331092658.72386-1-bo.ye@mediatek.com>

On 2023/3/31 17:26, Bo Ye wrote:
> From: Qilin Tan <qilin.tan@mediatek.com>
> 
> Made iostat lock irq safe to avoid potentinal deadlock.
> 
> Deadlock scenario:
> f2fs_attr_store
>    -> f2fs_sbi_store
>    -> _sbi_store
>    -> spin_lock(sbi->iostat_lock)
>      <interrupt request>
>      -> scsi_end_request
>      -> bio_endio
>      -> f2fs_dio_read_end_io
>      -> f2fs_update_iostat
>      -> spin_lock_irqsave(sbi->iostat_lock)  ===> Dead lock here
> 

Fixes: 61803e984307 ("f2fs: fix iostat related lock protection")
Fixes: a1e09b03e6f5 ("f2fs: use iomap for direct I/O")

> Signed-off-by: Qilin Tan <qilin.tan@mediatek.com>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,

> ---
>   fs/f2fs/sysfs.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> index 0b19163c90d4..fd238a68017e 100644
> --- a/fs/f2fs/sysfs.c
> +++ b/fs/f2fs/sysfs.c
> @@ -575,9 +575,9 @@ static ssize_t __sbi_store(struct f2fs_attr *a,
>   	if (!strcmp(a->attr.name, "iostat_period_ms")) {
>   		if (t < MIN_IOSTAT_PERIOD_MS || t > MAX_IOSTAT_PERIOD_MS)
>   			return -EINVAL;
> -		spin_lock(&sbi->iostat_lock);
> +		spin_lock_irq(&sbi->iostat_lock);
>   		sbi->iostat_period_ms = (unsigned int)t;
> -		spin_unlock(&sbi->iostat_lock);
> +		spin_unlock_irq(&sbi->iostat_lock);
>   		return count;
>   	}
>   #endif


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

  parent reply	other threads:[~2023-04-01  0:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-31  9:26 [f2fs-dev] [PATCH 1/2] f2fs: fix iostat lock protection Bo Ye via Linux-f2fs-devel
2023-03-31  9:26 ` [f2fs-dev] [PATCH 2/2] f2fs: add __pack attribute for extent_info Bo Ye via Linux-f2fs-devel
2023-04-01  1:00   ` Chao Yu
2023-04-01  0:53 ` Chao Yu [this message]
2023-04-03 18:30 ` [f2fs-dev] [PATCH 1/2] f2fs: fix iostat lock protection patchwork-bot+f2fs

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=203ef118-30ca-0ce9-f73e-c5ee45f61369@kernel.org \
    --to=chao@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=bo.ye@mediatek.com \
    --cc=browse.zhang@mediatek.com \
    --cc=jaegeuk@kernel.org \
    --cc=light.hsieh@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=peng.zhou@mediatek.com \
    --cc=qilin.tan@mediatek.com \
    --cc=yongdong.zhang@mediatek.com \
    /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).