From patchwork Sun Apr 7 04:29:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 13619984 Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63AAD848E for ; Sun, 7 Apr 2024 04:30:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712464202; cv=none; b=cw89jRV7UCYGKfC0pM9+9vUMGnPQ0+AUE2XIADLZFpquZ1o8QbmHbbS7FHiQIvxGRbSJnJDy5aeY+glQ42n+VbmV4FCgd4GLz02P49HR/BXIcCBw/qTzES9GL9aAzT7HCPkP64zHEGMlE3Zp1BaQMoo2fKZDgGK+eUqZRtKvdbg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712464202; c=relaxed/simple; bh=+8uny9BjOrqqRA1d7Xc6MflYPbYaT0J2KHI5XU4gl8w=; h=MIME-Version:From:Date:Message-ID:Subject:To:Cc:Content-Type; b=gNbFafwRF97Wp8S1zzpqHv878rjW1clOwRAOntbMDee3K15obEYtA/5sADy1Kpni95ls+fmUKSXwNIK6Xpe/r6d75ljHk4SipVcOuTdynsrhrQVVHryqETXuhOlRM2sdKZumIgDxp1OvI/U8ICB0j6mwrS8mXxV8e3Ns0ngSWFg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=d8cC0HDS; arc=none smtp.client-ip=209.85.167.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="d8cC0HDS" Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-516c97ddcd1so3893577e87.2 for ; Sat, 06 Apr 2024 21:30:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712464198; x=1713068998; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=qlJX1dGJIzadfp25aYdV24/pUp4jf/Xo34aqignNHlI=; b=d8cC0HDSuqXLq/qOLOjw6pkOsb/gVpp4iN7rf2Atlo6SdSti0ZGm8AMStn4Al1jUnS lJ7pQaIr6r7w6w2rXYmhjdNt1duVNv/sUqBHfDF9JBtTmib/IjZEBJ8n27KgJNbOmxnS ThbReqUv2lfrQAuxZlg/jX4Cz5ELu4/ET2lnDJwAE49Pevox9yVFOGlQW07OM6Qw0NO3 9OV1BsQUUD7YWs6dOFXRxxukj1t3OwgoLhjRiqARzKSZvajBqvpKzXnpj6zbKwVt8QiU ufPQ+RiLOXOE7kmg/d4nUy7aZYbSFBMzQ5l5C//UPVIPokMBvlrAIhKsY+Ec3uYWIR7a +o9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712464198; x=1713068998; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=qlJX1dGJIzadfp25aYdV24/pUp4jf/Xo34aqignNHlI=; b=PTvUkTOW/IOBynR53Iezg05xSgBXeH2rcO+p45yQlwFwZQEvYOhYXZJd8KSA9R5yNQ Be7LnW4AfwfTQLYBreptJmZFNJLK8LbEIFmWv+t1DsVN4exdZSmfrZbZBwU6jhRWKvYV 9I7x2hpYNnkOcC0vrC+UIvTJaU4gwdWejyJlp6UG8O0nROBtETnnjso5qRKsDm3r0rK5 NPgZWPFLk7xv0XYXGkILBzlUkxvub+n9fWdZM4ZiHR+EGVf5kO3U/ZPxJcyRklqWE/JI MpxMEBtQ0YhcGzIwI+BSgP7RUrvgfM0x8T3mxtZU9dBEsW6C2xZNToMNC3IhVPTD41Um BEZQ== X-Gm-Message-State: AOJu0YztQe3NMlhoHrzr9d8vq7QB+u7sPWsHlfj3lN7Y3MoArC7MZih3 2QZXL6owU5yUWdtGvZAYdgDGTxBLc4j/4eYUGm9LT234yzzBcx+0bSqx1QmcIdQr0eR0L4Ac+E+ GIdTAyFfX/9hT6TtyXh3Vid47LquVslLQdRc= X-Google-Smtp-Source: AGHT+IHotAkL40t1M8DNYTeKdBuynwZLFf4fiGAhWXJ3oiALzVeW50n8The/82tbWIVtHyY/geDFH8pOfhDXgI+gGik= X-Received: by 2002:a05:6512:6a:b0:516:b92f:98ef with SMTP id i10-20020a056512006a00b00516b92f98efmr3686864lfo.47.1712464197798; Sat, 06 Apr 2024 21:29:57 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-cifs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Steve French Date: Sat, 6 Apr 2024 23:29:46 -0500 Message-ID: Subject: [PATCH][SMB3 client] fix open files on server counter going negative To: CIFS Cc: ronnie sahlberg , Ritvik Budhiraja (resending with corrected email text) The /proc/fs/cifs/Stats files open on the server counter Open files: 0 total (local), 0 open on server was going negative because in smb2_close_cached_fid we were decrementing the count of remote (on server) open files twice (e.g. for the case where we were closing cached directories so this was more of an issue with mount to servers like Windows that support directory leases). Fixes: 8e843bf38f7b ("cifs: return a single-use cfid if we did not get a lease") Fix attached From 4def7b92de293b9d3c5784bb9257490427833bce Mon Sep 17 00:00:00 2001 From: Steve French Date: Sat, 6 Apr 2024 23:16:08 -0500 Subject: [PATCH] smb3: fix Open files on server counter going negative We were decrementing the count of open files on server twice for the case where we were closing cached directories. Fixes: 8e843bf38f7b ("cifs: return a single-use cfid if we did not get a lease") Cc: stable@vger.kernel.org Signed-off-by: Steve French --- fs/smb/client/cached_dir.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/smb/client/cached_dir.c b/fs/smb/client/cached_dir.c index 13a9d7acf8f8..0ff2491c311d 100644 --- a/fs/smb/client/cached_dir.c +++ b/fs/smb/client/cached_dir.c @@ -433,8 +433,8 @@ smb2_close_cached_fid(struct kref *ref) if (cfid->is_open) { rc = SMB2_close(0, cfid->tcon, cfid->fid.persistent_fid, cfid->fid.volatile_fid); - if (rc != -EBUSY && rc != -EAGAIN) - atomic_dec(&cfid->tcon->num_remote_opens); + if (rc) /* should we retry on -EBUSY or -EAGAIN? */ + cifs_dbg(VFS, "close cached dir rc %d\n", rc); } free_cached_dir(cfid); -- 2.40.1