Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1761521ybz; Thu, 30 Apr 2020 05:10:08 -0700 (PDT) X-Google-Smtp-Source: APiQypKEYX0LylSWS8bv+jJc32aWxMqTtVLggiSBWydKWqbRK4t+0QVLypmTdYLDoYOok1FSbNm8 X-Received: by 2002:a05:6402:22ed:: with SMTP id dn13mr2253974edb.212.1588248608548; Thu, 30 Apr 2020 05:10:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588248608; cv=none; d=google.com; s=arc-20160816; b=M7eeP1BglwuxVz4ypxeyIP+Wzir4SKSt9UXyXA99gZhzmkTqKE1UFUijdoddiwBv8J dbDZ+mCHbljADyboWfNEdA9Gvc8PwN/NLLwk8VX2BGBYXvoTvcjBtY/fzRPLY7qd6SjG UEVmJh49oXU+fNmBIKoumHx0lfF2hU2GKGAAuR/6wQ5rPDsMenigg4jr8T8Xm4WfV3Nd iw0rRKfpg9q+BCjevbOG3UTmRokDwlXHlv5yg6Pa1yv6Nx+Q1gLlHkEHWeYNBAvkG2Ds xDVXb2q8v5TUAxC8FaeBA9nN9RXhKigT23K9faoPvyaGJmVnmLkV50HEUzmsRTSeSZzn MBZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=Wq6+jUI6KMq5VWW/YMAsCd63gjsa1yEsvjn7J3A76FQ=; b=ubJrF1AwdIfbCx1sx3lLQGHANeGzdclmsaRHJmNOn8OuQ6E+aAiS/f/ANqY2uARyRp h0cEdMOQSmrp0il3+vivhPQGPx82VHuQtLmd5NdxhAXjqwuiqVrFJkxb3saGDc17Jgh/ o2KJIE+F3hN4EtbFyk1LwwSOGkaiwANs8MOMqYPY9NApS+d2Imi1B+8ah/q6IVqBvpEc IG6ie8gr62M4jVpgCVe7G5cvjjA4S/466IbUdmOKzvQtz93JjFo0e4fgnLgjWBqtw7ci s+iGzFePA5CPY/7/4AtsvxVRGdI9s2IlLf7tqOT1c4YCHFsMfLyv6uksPzl4iEpEl8GD dgvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=06ohClEH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dm18si5127187edb.264.2020.04.30.05.09.41; Thu, 30 Apr 2020 05:10:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=06ohClEH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726815AbgD3MIO (ORCPT + 99 others); Thu, 30 Apr 2020 08:08:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:54864 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725280AbgD3MIN (ORCPT ); Thu, 30 Apr 2020 08:08:13 -0400 Received: from tleilax.poochiereds.net (68-20-15-154.lightspeed.rlghnc.sbcglobal.net [68.20.15.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9F5CC20757; Thu, 30 Apr 2020 12:08:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588248493; bh=kWOGUQ0nG1s+NuJ1r/jm6uWAthHvmvis6ImwgfOZ0Oo=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=06ohClEHa8gjHByrmWUMex5YFbqSOgrWESvizUEiFusaI36u0Nz8yqPmycvRYkj2F uuG+zHHb2jc3mnUuKv0w9CXM6HkXWumWoSFF7Wgik+23c7dEwSA665aMObscPnjP06 7z/6yGJLbkIkNiKkWMtWGdCY+AGEQNQgzDdM9r+Y= Message-ID: Subject: Re: [PATCH V3] fs/ceph:fix double unlock in handle_cap_export() From: Jeff Layton To: Wu Bo , ukernel@gmail.com, sage@redhat.com, idryomov@gmail.com Cc: ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org, liuzhiqiang26@huawei.com, linfeilong@huawei.com Date: Thu, 30 Apr 2020 08:08:11 -0400 In-Reply-To: <1588227169-83237-1-git-send-email-wubo40@huawei.com> References: <1588227169-83237-1-git-send-email-wubo40@huawei.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.1 (3.36.1-1.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2020-04-30 at 14:12 +0800, Wu Bo wrote: > If the ceph_mdsc_open_export_target_session() return fails, > we should add mutex_lock(&session->s_mutex) on IS_ERR(tsession) block > to avoid twice unlocking. because the session->s_mutex will be unlock > at the out_unlock lable. > > -- > v2 -> v3: > - Rewrite solution, adding a mutex_lock(&session->s_mutex) > to the IS_ERR(tsession) block. > - Modify the comment more clearly. > v1 -> v2: > - add spin_lock(&ci->i_ceph_lock) before goto out_unlock lable > For future reference, notes like this should go a little lower... > > > Signed-off-by: Wu Bo > --- > fs/ceph/caps.c | 1 + > 1 file changed, 1 insertion(+) > If you put the patch version notes here, they'll be stripped out when we go to merge the patch with git-am. > diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c > index 185db76..d27d778 100644 > --- a/fs/ceph/caps.c > +++ b/fs/ceph/caps.c > @@ -3746,6 +3746,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex, > WARN_ON(1); > tsession = NULL; > target = -1; > + mutex_lock(&session->s_mutex); > } > goto retry; > Looks good. Merged, but I did clean up the verbiage in the changelog a bit. Thanks! -- Jeff Layton