Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3426150pxb; Mon, 4 Apr 2022 16:37:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRJRM+9T08ZdZ0S9TaR0pH4LD2C0ntVWsxcWgRbkJpkDqx15mP2FQejbQtfFVOCT60FFfe X-Received: by 2002:a17:902:f64c:b0:156:7ceb:b579 with SMTP id m12-20020a170902f64c00b001567cebb579mr517655plg.73.1649115473935; Mon, 04 Apr 2022 16:37:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649115473; cv=none; d=google.com; s=arc-20160816; b=caf6COfYiE+7asMlO83qg6lLRtY33iyFVjXTlMC5ZFhwqHyw9G4ncMQvCZvuddpifY k09WdFws8Oj9EJb5NVvoHFuPQPcMslWTL0CjBiHJmO33s5/uyyA3/M1MPmVGzKLm0UiP OljyGCvMiGsjvXLltYVvBx6JttAxoP/WLhnIw8xWgY9iRPN9bDXuhnG0QKSlKFLQfzNy H3/uBJd0/hNUsmI6un2P1FigCx2/uhSHQtNOTWwIZcWT2dydud6nxyZ3J/UgttG5Z51Q XW4xU8iTTNwMiYe4Fb3IxmNVc8CpJBN29yQPwtV4nUasRFW51z9YzK0UQihSlWtPTo8Y u5+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=340G7DDlJvxfnruHeGXTFxEtC53hXW3frN9N7jMbYMo=; b=yQNzkrFRgy/a5G44aD38/urHBWfWcXxjkFkI44Ac7Y4Ug7BH5H91js4lmU0VVtaa4C JTuO4JfKDSvFCQh88wqwbofdD91lyf55fy6cyn6i+CcViSWdy5cDj4W7QgWWkKMwrFAJ Vhuot1+jrfOtNfwTjSmWO8h1jxaMK0FU2JWxkWud9OiUrD91tvHlCo20krfLo6AMpEcM ppd6wuK2uD2hpHu3lka2yvpqMzdbBESkST4fBt9tYDP8+pfQ0R1Ea1fEVvO+dzeifDzN cSCDjE8gTiD1764CDg0cHQj8EHMWgLUr+3ECQjtkA4PXha0FyUs4qvM2JoR7EByFlnOc 6VbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=pqa1CDnL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id i5-20020a1709026ac500b001541514aac7si10284413plt.256.2022.04.04.16.37.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 16:37:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=pqa1CDnL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0264F4AE3C; Mon, 4 Apr 2022 16:30:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242033AbiCaV5R (ORCPT + 99 others); Thu, 31 Mar 2022 17:57:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242027AbiCaV5Q (ORCPT ); Thu, 31 Mar 2022 17:57:16 -0400 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFA071DFDFD; Thu, 31 Mar 2022 14:55:27 -0700 (PDT) Received: by mail-ed1-x52c.google.com with SMTP id x34so834960ede.8; Thu, 31 Mar 2022 14:55:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=340G7DDlJvxfnruHeGXTFxEtC53hXW3frN9N7jMbYMo=; b=pqa1CDnLEUEUIbaKrQKpfnlyqz9Wf9ivrcPZx4GweI+V3rxNnyGYtErdnkFl0KZWPy aVQOM1sjDXASbi84kEzqN1bkF5mEznJlonLoaL0lJQauqFA7/NR22vzkm4ZmzUTXOghP XLeXUiEI5Ya1ggWcU34UmZIXQ/Dv24iQjhn3X8hWnRsNlXsLvpsm6tcfoqQJTXlkR7iH L27DYCyr5wnD+BIK4wIsRbw34owX4oYQXE7K0Ccqn7RKHHQACNQ7NucVRrynQRtg7/tB riygE186FI3tDxlvdnK2G/Axi8AoQypB49XyAkclnzkoxG/WUO7/vxh+z5er3Y0w2QDX ZT3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=340G7DDlJvxfnruHeGXTFxEtC53hXW3frN9N7jMbYMo=; b=1GMHJkGahrL6uA80Mq199Z2eX821EAsWQNxtXlrv/f55NEK16iiDo/dZcwnNp08t+h iLtBfGCMglv7mYMoAnWptcgpI3aJqzaRNtZPa1SY7xzrupFgVgZK/AGFBvID+43SJ+Da VKlXRPj+rxvydDvcdJBesNnsgw2g7z27FjFrG5FFjb+HgAUvX1xLnQ17cHWnXwkYh8aY jS1ZkKVJmTwF4UYHPcoQDc2tmOTse5p5+o52cY6HdpnogvV1P0V+N54lHM7WVE/fLznr ZgP6wRA24kqzC/HXX8Z2NB5af9swLcP507MnkDu6+5IwTqfg1L3QI9xxPVatkQAdSWti gOjw== X-Gm-Message-State: AOAM53369f540v3VqzDTJDoGTYIjyFwpLPUjQ+qxq+PGooMwK3boD72l 1F9WC8Vy7GMXEVWHCI2cpJM= X-Received: by 2002:a05:6402:4250:b0:419:5e89:a40f with SMTP id g16-20020a056402425000b004195e89a40fmr18515273edb.319.1648763726247; Thu, 31 Mar 2022 14:55:26 -0700 (PDT) Received: from localhost.localdomain (i130160.upc-i.chello.nl. [62.195.130.160]) by smtp.googlemail.com with ESMTPSA id r11-20020aa7cfcb000000b0041902ac4c6asm307950edy.1.2022.03.31.14.55.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Mar 2022 14:55:25 -0700 (PDT) From: Jakob Koschel To: Jeff Layton Cc: Ilya Dryomov , ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org, Mike Rapoport , "Brian Johannesmeyer" , Cristiano Giuffrida , "Bos, H.J." , Jakob Koschel Subject: [PATCH 1/2] ceph: use dedicated list iterator variable Date: Thu, 31 Mar 2022 23:53:28 +0200 Message-Id: <20220331215329.882411-1-jakobkoschel@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To move the list iterator variable into the list_for_each_entry_*() macro in the future it should be avoided to use the list iterator variable after the loop body. To *never* use the list iterator variable after the loop it was concluded to use a separate iterator variable [1]. Link: https://lore.kernel.org/all/CAHk-=wgRr_D8CB-D9Kg-c=EHreAsk5SqXPwr9Y7k9sA6cWXJ6w@mail.gmail.com/ [1] Signed-off-by: Jakob Koschel --- fs/ceph/caps.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index f1ad6884d4da..519750bc5a1a 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c @@ -1577,7 +1577,7 @@ static void __ceph_flush_snaps(struct ceph_inode_info *ci, while (first_tid <= last_tid) { struct ceph_cap *cap = ci->i_auth_cap; - struct ceph_cap_flush *cf; + struct ceph_cap_flush *cf = NULL, *iter; int ret; if (!(cap && cap->session == session)) { @@ -1587,8 +1587,9 @@ static void __ceph_flush_snaps(struct ceph_inode_info *ci, } ret = -ENOENT; - list_for_each_entry(cf, &ci->i_cap_flush_list, i_list) { - if (cf->tid >= first_tid) { + list_for_each_entry(iter, &ci->i_cap_flush_list, i_list) { + if (iter->tid >= first_tid) { + cf = iter; ret = 0; break; } base-commit: f82da161ea75dc4db21b2499e4b1facd36dab275 -- 2.25.1