public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jingbo Xu <jefflexu@linux.alibaba.com>
To: xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org,
	zhujia.zj@bytedance.com
Cc: huyue2@coolpad.com, linux-kernel@vger.kernel.org
Subject: [PATCH v3 3/4] erofs: relinquish volume with mutex held
Date: Thu,  9 Feb 2023 14:39:12 +0800	[thread overview]
Message-ID: <20230209063913.46341-4-jefflexu@linux.alibaba.com> (raw)
In-Reply-To: <20230209063913.46341-1-jefflexu@linux.alibaba.com>

Relinquish fscache volume with mutex held.  Otherwise if a new domain is
registered when the old domain with the same name gets removed from the
list but not relinquished yet, fscache may complain the collision.

Fixes: 8b7adf1dff3d ("erofs: introduce fscache-based domain")
Signed-off-by: Jingbo Xu <jefflexu@linux.alibaba.com>
Reviewed-by: Jia Zhu <zhujia.zj@bytedance.com>
---
 fs/erofs/fscache.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c
index a302d6d23ab5..c6f09928b62c 100644
--- a/fs/erofs/fscache.c
+++ b/fs/erofs/fscache.c
@@ -326,8 +326,8 @@ static void erofs_fscache_domain_put(struct erofs_domain *domain)
 			kern_unmount(erofs_pseudo_mnt);
 			erofs_pseudo_mnt = NULL;
 		}
-		mutex_unlock(&erofs_domain_list_lock);
 		fscache_relinquish_volume(domain->volume, NULL, false);
+		mutex_unlock(&erofs_domain_list_lock);
 		kfree(domain->domain_id);
 		kfree(domain);
 		return;
-- 
2.19.1.6.gb485710b


  parent reply	other threads:[~2023-02-09  6:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-09  6:39 [PATCH v3 0/4] erofs: cleanup for fscache share domain mode Jingbo Xu
2023-02-09  6:39 ` [PATCH v3 1/4] erofs: remove unused device mapping in meta routine Jingbo Xu
2023-02-14 15:03   ` Chao Yu
2023-02-09  6:39 ` [PATCH v3 2/4] erofs: maintain cookies of share domain in self-contained list Jingbo Xu
2023-02-09  6:39 ` Jingbo Xu [this message]
2023-02-09  6:39 ` [PATCH v3 4/4] erofs: unify anonymous inodes for blob Jingbo Xu

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=20230209063913.46341-4-jefflexu@linux.alibaba.com \
    --to=jefflexu@linux.alibaba.com \
    --cc=chao@kernel.org \
    --cc=huyue2@coolpad.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xiang@kernel.org \
    --cc=zhujia.zj@bytedance.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