Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp1459039ybm; Thu, 23 May 2019 01:08:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqwdxmFG5AccUXfiR63A8t2Tn4p/0HSRyn0lJZgkht/H/JANDs506tPCwS0RhLotDY5nOlIb X-Received: by 2002:a63:5701:: with SMTP id l1mr2513568pgb.438.1558598908100; Thu, 23 May 2019 01:08:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558598908; cv=none; d=google.com; s=arc-20160816; b=lrpav0lef0upJ1cEINHMLUX9fQ7cuK+l8jOYzLkuKZ8hu2TJSGWIAI0S6nRv5JUeUf b/sHFiI7zPqCW6xS35U90jgh2EiSNWL1Xp/xvlIfZSpd1uTeeDvf9jNtgrSsDJh78g/u /p/bV1dNFuepFcebZ8SC8oKFzzuXSMtc4TugibuHD8NMRRXSd7kUU+7C0ID1u/sIXNXW JTnBA2+uNmi1reW0/UQfgXZzEiueHsiN7j/Vvw2TsHNVljTA0KWDfupJ/wIeMAmiGUPL GhxnpaXuyE3RceLLvBLTUYTJXQsevDmnjFKNZfpQxgCPoDIVg34kxt+5ZnAQVH8U5vxe wl4w== 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 :message-id:date:subject:cc:to:from; bh=TJHs53n6kGVGH3xQSGg8TT4avmw7MsU+GmvCpiAurv4=; b=T0lKPgz4wpickx+BvblGCdZePij8N9toRQWuq4UP3UIT+dndx7XYcKquI3Hsr7/rFx 9Scb4LfUBsXaUnlJsJch24s1Jj5CTMXYCMXJEmbT2L10CETrHV9Zm/l7gWH+RWjFEjWV i8IFWcacgtwDqkmKXucdBQ73grfTcUECm0AK8Rc27Ptn87k4Nfh3BMw9OdGYNMywP4qk p4W362c60AyDonWpthIIQchaSDkgo8d42vaPczoTV1YFDiTib5eNCMZhBXaHz+U1wtE4 tjkaqf7nyKlq8Zk+wzI/xQ+F22T1cfbVE2PdRzvIAuJhGBusRq7MVNLeuFvGKqnY35yo Ylfg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o1si15513705plb.179.2019.05.23.01.08.10; Thu, 23 May 2019 01:08:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729652AbfEWIGv (ORCPT + 99 others); Thu, 23 May 2019 04:06:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41511 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726363AbfEWIGu (ORCPT ); Thu, 23 May 2019 04:06:50 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A200B3E2AF for ; Thu, 23 May 2019 08:06:50 +0000 (UTC) Received: from zhyan-laptop.redhat.com (ovpn-12-163.pek2.redhat.com [10.72.12.163]) by smtp.corp.redhat.com (Postfix) with ESMTP id BA11217D55; Thu, 23 May 2019 08:06:48 +0000 (UTC) From: "Yan, Zheng" To: linux-kernel@vger.kernel.org Cc: idryomov@redhat.com, jlayton@redhat.com Subject: [PATCH 1/8] ceph: fix error handling in ceph_get_caps() Date: Thu, 23 May 2019 16:06:39 +0800 Message-Id: <20190523080646.19632-1-zyan@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 23 May 2019 08:06:50 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The function return 0 even when interrupted or try_get_cap_refs() return error. Introduce by commit 1199d7da2d "ceph: simplify arguments and return semantics of try_get_cap_refs" Signed-off-by: "Yan, Zheng" --- fs/ceph/caps.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 72f8e1311392..079d0df9650c 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c @@ -2738,15 +2738,13 @@ int ceph_get_caps(struct ceph_inode_info *ci, int need, int want, _got = 0; ret = try_get_cap_refs(ci, need, want, endoff, false, &_got); - if (ret == -EAGAIN) { + if (ret == -EAGAIN) continue; - } else if (!ret) { - int err; - + if (!ret) { DEFINE_WAIT_FUNC(wait, woken_wake_function); add_wait_queue(&ci->i_cap_wq, &wait); - while (!(err = try_get_cap_refs(ci, need, want, endoff, + while (!(ret = try_get_cap_refs(ci, need, want, endoff, true, &_got))) { if (signal_pending(current)) { ret = -ERESTARTSYS; @@ -2756,14 +2754,16 @@ int ceph_get_caps(struct ceph_inode_info *ci, int need, int want, } remove_wait_queue(&ci->i_cap_wq, &wait); - if (err == -EAGAIN) + if (ret == -EAGAIN) continue; } - if (ret == -ESTALE) { - /* session was killed, try renew caps */ - ret = ceph_renew_caps(&ci->vfs_inode); - if (ret == 0) - continue; + if (ret < 0) { + if (ret == -ESTALE) { + /* session was killed, try renew caps */ + ret = ceph_renew_caps(&ci->vfs_inode); + if (ret == 0) + continue; + } return ret; } -- 2.17.2