Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1543699ybz; Thu, 30 Apr 2020 00:59:59 -0700 (PDT) X-Google-Smtp-Source: APiQypLEc7D7F3oGoHUuU9325TGgePguWSocg8kDbAqgQxKFu6jL8RReuAArfYpCndTFfS4eTiZp X-Received: by 2002:a17:906:4e8f:: with SMTP id v15mr1539882eju.321.1588233599775; Thu, 30 Apr 2020 00:59:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588233599; cv=none; d=google.com; s=arc-20160816; b=JcLlKkDcSZGq8aTsrTIFLLCkfmzScJdSg3OHNeo8O06rA6mTrXgZZugTMDJmPxTQ6Z NxuKIaT+EwGJy4At/fNef3hyjSG22MVXF0wQekjr1d+GeFpBIOqe57BPzE+ECo8RvDoN BtprrSvBWhD3QJU8eilxkiZIA265/29JSSATOWepRIBV1m4yt+5tgTPb6IiR5b3V5X2o PXwnu94grPeeqUs60y6aYHv9ivBGVA25xWviGaAQLlg7xZsyxVCQS6bD7famoAwQv34u Bq1E538FPlL6D9/2Xxxa7aYHHuZIVov5NYDuvj+4aGphT0uFABiUcJN0dcppK8WFtnh5 1NUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=niS1lYC7PeJRfKiA0LkBJ0AjWmjRNXbULNT5s9yDbmg=; b=SUgi8ikyrHWfuDfUbPp5LHMXa+S6LlEd/M95DhsXgvLcl0yIFamm9yC1scDc8KUdzd +k/S6dz2JPW1bXbLPS98Eo0d1k5ke6phD/D8igDWs9fvVpiBxsZZCq7++IdPdscIhcpb rxeVYueJ0xjrR1+l7FpWfgc6/wfTzB//gTjjnL+rYQN6T0JehKwVFi03NqjNCXq4nBDO cUgsJ7u4hO70V6mGYQR11N1yDlqgxKVS2JsVlWiDUyclZIC0oBi6pkR8wFkPe3nWnZSH K6qYVRDatJPGUPYp6/gQvLWQNCKT8g4s9JoKNJpzS+t3RhKezMviqU/Z+jDlfegQWgqv pQbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=b0uFxMCc; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b26si4767513edw.447.2020.04.30.00.59.36; Thu, 30 Apr 2020 00:59:59 -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=@gmail.com header.s=20161025 header.b=b0uFxMCc; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726649AbgD3H4E (ORCPT + 99 others); Thu, 30 Apr 2020 03:56:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726572AbgD3H4D (ORCPT ); Thu, 30 Apr 2020 03:56:03 -0400 Received: from mail-yb1-xb41.google.com (mail-yb1-xb41.google.com [IPv6:2607:f8b0:4864:20::b41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88342C035494; Thu, 30 Apr 2020 00:56:01 -0700 (PDT) Received: by mail-yb1-xb41.google.com with SMTP id i16so2707501ybq.9; Thu, 30 Apr 2020 00:56:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=niS1lYC7PeJRfKiA0LkBJ0AjWmjRNXbULNT5s9yDbmg=; b=b0uFxMCcUOu+UKVq2cT5YgabZJAPo/fDcBjEXk+cSKEeRAG22tjX3jVOWO+ZroquVd W9bUt5rw6VnC0eEduCX0Zzs6W90YBy7LJ0rjVk+g+GcOpiAQnkXc69wVui4Gy+dulxQO H5Z5KXF4B6cpy8K7KhLSKDH0KYMcEcL+2NUrtH8JsbDCdfzgBMJML0K7OXfwPmA1FRKc VITGeiylsb2lDaavq7fbUtacVTtXdduADHsYgIyt7gfdAFHiUt8UfbRUyTtefrOXG8OE 5uwsD+bm910DqlFmSchYMiarOTh/C0Ddrjqe9AqCfDgxbEjax5Oz2jDIxvhFfRAxHlQL 8RRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=niS1lYC7PeJRfKiA0LkBJ0AjWmjRNXbULNT5s9yDbmg=; b=KpY9Iwzjm4nfkNaB0vhRvyHtGXqpEajpJTwU28T5hH0FsXETqoKiny7zX7Z4rJizsE NYnRPn4L37XLrrv7Gnl4UdcA/b/ZDruvcscM19swf5TQqKStc536BUBxkGIA8+spryGp QW9opBN+nRjT1F/JixzbQadIkTnxr/uivr2zzydWBSFseBFzL14JPskDMBXHB7AXZOop vt1xpKQ+6ruQbA+FR7PkrtzdqIMa2a6uZ52+qLown91EHCl795d22+agPg/ha27MX9Qf /Dr3WPLHkCelUhFNGOM0bxoFrV33jvCVetOxynv1OAwktg11XXQsZI3bbC0sMI59tSZ3 20LA== X-Gm-Message-State: AGi0PuaY1i7x181+jc87eaE9Cyd2iDvyJC/FRwhnAdalXEVHSGW3aH0/ Ff9g8CnyepSjdmEw440vGjLpobYcO6Mwa/q11Yc= X-Received: by 2002:a25:b8f:: with SMTP id 137mr3875233ybl.21.1588233360816; Thu, 30 Apr 2020 00:56:00 -0700 (PDT) MIME-Version: 1.0 References: <1588227169-83237-1-git-send-email-wubo40@huawei.com> In-Reply-To: <1588227169-83237-1-git-send-email-wubo40@huawei.com> From: "Yan, Zheng" Date: Thu, 30 Apr 2020 15:55:49 +0800 Message-ID: Subject: Re: [PATCH V3] fs/ceph:fix double unlock in handle_cap_export() To: Wu Bo Cc: Jeff Layton , Sage Weil , Ilya Dryomov , ceph-devel , Linux Kernel Mailing List , liuzhiqiang26@huawei.com, linfeilong@huawei.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 30, 2020 at 2:13 PM 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 > > > Signed-off-by: Wu Bo > --- > fs/ceph/caps.c | 1 + > 1 file changed, 1 insertion(+) > > 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; > > -- > 1.8.3.1 > Reviewed-by: "Yan, Zheng"