All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luis Henriques <lhenriques@suse.de>
To: Jeff Layton <jlayton@kernel.org>
Cc: ceph-devel@vger.kernel.org, pdonnell@redhat.com,
	ukernel@gmail.com, idryomov@gmail.com, xiubli@redhat.com
Subject: Re: [RFC PATCH 4/6] ceph: don't take s_mutex in try_flush_caps
Date: Wed, 16 Jun 2021 16:25:28 +0100	[thread overview]
Message-ID: <YMoX6DL9xeKvTgSK@suse.de> (raw)
In-Reply-To: <20210615145730.21952-5-jlayton@kernel.org>

On Tue, Jun 15, 2021 at 10:57:28AM -0400, Jeff Layton wrote:
> The s_mutex doesn't protect anything in this codepath.
> 
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
>  fs/ceph/caps.c | 16 ++--------------
>  1 file changed, 2 insertions(+), 14 deletions(-)
> 
> diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
> index 825b1e463ad3..d21b1fa36875 100644
> --- a/fs/ceph/caps.c
> +++ b/fs/ceph/caps.c
> @@ -2149,26 +2149,17 @@ static int try_flush_caps(struct inode *inode, u64 *ptid)
>  {
>  	struct ceph_mds_client *mdsc = ceph_sb_to_client(inode->i_sb)->mdsc;
>  	struct ceph_inode_info *ci = ceph_inode(inode);
> -	struct ceph_mds_session *session = NULL;
>  	int flushing = 0;
>  	u64 flush_tid = 0, oldest_flush_tid = 0;
>  
> -retry:
>  	spin_lock(&ci->i_ceph_lock);
>  retry_locked:
>  	if (ci->i_dirty_caps && ci->i_auth_cap) {
>  		struct ceph_cap *cap = ci->i_auth_cap;
>  		struct cap_msg_args arg;
> +		struct ceph_mds_session *session = cap->session;
>  
> -		if (session != cap->session) {
> -			spin_unlock(&ci->i_ceph_lock);
> -			if (session)
> -				mutex_unlock(&session->s_mutex);
> -			session = cap->session;
> -			mutex_lock(&session->s_mutex);
> -			goto retry;
> -		}
> -		if (cap->session->s_state < CEPH_MDS_SESSION_OPEN) {
> +		if (session->s_state < CEPH_MDS_SESSION_OPEN) {
>  			spin_unlock(&ci->i_ceph_lock);
>  			goto out;
>  		}
> @@ -2205,9 +2196,6 @@ static int try_flush_caps(struct inode *inode, u64 *ptid)
>  		spin_unlock(&ci->i_ceph_lock);
>  	}
>  out:
> -	if (session)
> -		mutex_unlock(&session->s_mutex);
> -
>  	*ptid = flush_tid;
>  	return flushing;
>  }
> -- 
> 2.31.1
> 

Reviewed-by: Luis Henriques <lhenriques@suse.de>

Cheers,
--
Luís

  reply	other threads:[~2021-06-16 15:25 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-15 14:57 [RFC PATCH 0/6] ceph: remove excess mutex locking from cap/snap flushing codepaths Jeff Layton
2021-06-15 14:57 ` [RFC PATCH 1/6] ceph: allow ceph_put_mds_session to take NULL or ERR_PTR Jeff Layton
2021-06-16 15:24   ` Luis Henriques
2021-06-15 14:57 ` [RFC PATCH 2/6] ceph: eliminate session->s_gen_ttl_lock Jeff Layton
2021-06-16 15:24   ` Luis Henriques
2021-06-18 13:31     ` Jeff Layton
2021-06-15 14:57 ` [RFC PATCH 3/6] ceph: don't take s_mutex or snap_rwsem in ceph_check_caps Jeff Layton
2021-06-16 15:25   ` Luis Henriques
2021-06-18 13:35     ` Jeff Layton
2021-06-15 14:57 ` [RFC PATCH 4/6] ceph: don't take s_mutex in try_flush_caps Jeff Layton
2021-06-16 15:25   ` Luis Henriques [this message]
2021-06-15 14:57 ` [RFC PATCH 5/6] ceph: don't take s_mutex in ceph_flush_snaps Jeff Layton
2021-06-16 15:25   ` Luis Henriques
2021-06-15 14:57 ` [RFC PATCH 6/6] ceph: eliminate ceph_async_iput() Jeff Layton
2021-06-16 15:26   ` Luis Henriques
2021-06-17 16:24     ` Jeff Layton
2021-06-18 12:56       ` Luis Henriques
2021-06-18 13:04         ` Jeff Layton

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=YMoX6DL9xeKvTgSK@suse.de \
    --to=lhenriques@suse.de \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    --cc=jlayton@kernel.org \
    --cc=pdonnell@redhat.com \
    --cc=ukernel@gmail.com \
    --cc=xiubli@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.