From: Jeff Layton <jlayton@kernel.org>
To: Hou Tao <houtao@huaweicloud.com>, linux-cachefs@redhat.com
Cc: David Howells <dhowells@redhat.com>,
linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org,
Jingbo Xu <jefflexu@linux.alibaba.com>,
houtao1@huawei.com
Subject: Re: [PATCH v3 2/2] fscache: Use clear_and_wake_up_bit() in fscache_create_volume_work()
Date: Fri, 13 Jan 2023 10:28:01 -0500 [thread overview]
Message-ID: <bc07b4d69f6c709988d2faca50717a402c1ed81e.camel@kernel.org> (raw)
In-Reply-To: <20230113115211.2895845-3-houtao@huaweicloud.com>
On Fri, 2023-01-13 at 19:52 +0800, Hou Tao wrote:
> From: Hou Tao <houtao1@huawei.com>
>
> fscache_create_volume_work() uses wake_up_bit() to wake up the processes
> which are waiting for the completion of volume creation. According to
> comments in wake_up_bit() and waitqueue_active(), an extra smp_mb() is
> needed to guarantee the memory order between FSCACHE_VOLUME_CREATING
> flag and waitqueue_active() before invoking wake_up_bit().
>
> Fixing it by using clear_and_wake_up_bit() to add the missing memory
> barrier.
>
> Reviewed-by: Jingbo Xu <jefflexu@linux.alibaba.com>
> Signed-off-by: Hou Tao <houtao1@huawei.com>
> ---
> fs/fscache/volume.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/fs/fscache/volume.c b/fs/fscache/volume.c
> index 903af9d85f8b..cdf991bdd9de 100644
> --- a/fs/fscache/volume.c
> +++ b/fs/fscache/volume.c
> @@ -280,8 +280,7 @@ static void fscache_create_volume_work(struct work_struct *work)
> fscache_end_cache_access(volume->cache,
> fscache_access_acquire_volume_end);
>
> - clear_bit_unlock(FSCACHE_VOLUME_CREATING, &volume->flags);
> - wake_up_bit(&volume->flags, FSCACHE_VOLUME_CREATING);
> + clear_and_wake_up_bit(FSCACHE_VOLUME_CREATING, &volume->flags);
> fscache_put_volume(volume, fscache_volume_put_create_work);
> }
>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2023-01-13 15:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-13 11:52 [PATCH v3 0/2] Fixes for fscache volume operations Hou Tao
2023-01-13 11:52 ` [PATCH v3 1/2] fscache: Use wait_on_bit() to wait for the freeing of relinquished volume Hou Tao
2023-01-13 15:27 ` Jeff Layton
2023-01-13 11:52 ` [PATCH v3 2/2] fscache: Use clear_and_wake_up_bit() in fscache_create_volume_work() Hou Tao
2023-01-13 15:28 ` Jeff Layton [this message]
2023-01-30 10:56 ` [PATCH v3 0/2] Fixes for fscache volume operations Hou Tao
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=bc07b4d69f6c709988d2faca50717a402c1ed81e.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=dhowells@redhat.com \
--cc=houtao1@huawei.com \
--cc=houtao@huaweicloud.com \
--cc=jefflexu@linux.alibaba.com \
--cc=linux-cachefs@redhat.com \
--cc=linux-erofs@lists.ozlabs.org \
--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
all inboxes | Powered by JetHome®