From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 232DEC4332B for ; Mon, 23 Mar 2020 14:28:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E8535206F8 for ; Mon, 23 Mar 2020 14:28:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584973701; bh=p2fzBVgBsgVU+DU3rDWhQ4OVTI69pLL5pf/0hwq+on8=; h=Subject:To:Cc:From:Date:List-ID:From; b=u7BLf7oDIuc7Q/HleHSrABWlWQcfeLPfJRAPrHOAMswm6m6gV6xituvUQgc4OXYkW P7QRIZpWcAP/m0/mQxY5Lic9+PkI5A5T5HZPlhAguXP2ma75W5qvVfx4UbywL9kbTP biHnbLhDTAgRh6lTOY6Vp6015Yx9x6qKALqdQY5c= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725953AbgCWO2U (ORCPT ); Mon, 23 Mar 2020 10:28:20 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:40169 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725991AbgCWO2U (ORCPT ); Mon, 23 Mar 2020 10:28:20 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 4052E5C010E; Mon, 23 Mar 2020 10:28:19 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Mon, 23 Mar 2020 10:28:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=ByNxSI k1eEh3VJPT5J1y6xn9uh6R9+5VP7sR+LqVyUw=; b=SRfxQ3N9jDiBxi0IW+yRJW enftbSQlDesH+7TOxL+0twJUTVwV1CP74zsPjA50czucgwF885u8lAYnS24OI5Lp z7yCqvaypLcCY+x+KEsRruhCfuNur9YYk9lvAxghNA2XEFWtxZ8KM6juyMa9+gCO dlSi5bJ+HXDsDrb5Rs/U0XuQ1MgxWhfR7Wq40tZH7MQbHHLQ4+j+MGu9dFZ60LDx j/1YiPcXh4y/ZXpN+4CRUozU5gMHDccvI/mXTCmpWtJ0dPMoW2gSbzEHoUb7NQWU UtymT3tcKesSWXN17Q9yhPmD0dpAoKbDujeF2f6KMKqRabfM29COqMkUNuTJZtGA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrudegkedgieegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtlfenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecukfhppeekfedrkeeirdekledruddtjeenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehgrhgvgheskhhrohgrhhdrtghomh X-ME-Proxy: Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id C409530618C1; Mon, 23 Mar 2020 10:28:18 -0400 (EDT) Subject: FAILED: patch "[PATCH] CIFS: Increment num_remote_opens stats counter even in case" failed to apply to 5.5-stable tree To: nspmangalore@gmail.com, aaptel@suse.com, pshilov@microsoft.com, stable@vger.kernel.org, stfrench@microsoft.com Cc: From: Date: Mon, 23 Mar 2020 15:28:16 +0100 Message-ID: <1584973696312@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 5.5-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 1be1fa42ebb73ad8fd67d2c846931361b4e3dd0a Mon Sep 17 00:00:00 2001 From: Shyam Prasad N Date: Mon, 9 Mar 2020 01:35:09 -0700 Subject: [PATCH] CIFS: Increment num_remote_opens stats counter even in case of smb2_query_dir_first The num_remote_opens counter keeps track of the number of open files which must be maintained by the server at any point. This is a per-tree-connect counter, and the value of this counter gets displayed in the /proc/fs/cifs/Stats output as a following... Open files: 0 total (local), 1 open on server ^^^^^^^^^^^^^^^^ As a thumb-rule, we want to increment this counter for each open/create that we successfully execute on the server. Similarly, we should decrement the counter when we successfully execute a close. In this case, an increment was being missed in case of smb2_query_dir_first, in case of successful open. As a result, we would underflow the counter and we could even see the counter go to negative after sufficient smb2_query_dir_first calls. I tested the stats counter for a bunch of filesystem operations with the fix. And it looks like the counter looks correct to me. I also check if we missed the increments and decrements elsewhere. It does not seem so. Few other cases where an open is done and we don't increment the counter are the compound calls where the corresponding close is also sent in the request. Signed-off-by: Shyam Prasad N CC: Stable Signed-off-by: Steve French Reviewed-by: Aurelien Aptel Reviewed-by: Pavel Shilovsky diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index c31e84ee3c39..3dddd20c5e2b 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -2222,6 +2222,8 @@ smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon, goto qdf_free; } + atomic_inc(&tcon->num_remote_opens); + qd_rsp = (struct smb2_query_directory_rsp *)rsp_iov[1].iov_base; if (qd_rsp->sync_hdr.Status == STATUS_NO_MORE_FILES) { trace_smb3_query_dir_done(xid, fid->persistent_fid,