linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Fix for "requests in flight" showing negative
@ 2019-09-22  5:58 Steve French
  2019-09-23 17:26 ` Pavel Shilovsky
  0 siblings, 1 reply; 3+ messages in thread
From: Steve French @ 2019-09-22  5:58 UTC (permalink / raw)
  To: Pavel Shilovsky, ronnie sahlberg, CIFS

[-- Attachment #1: Type: text/plain, Size: 85 bytes --]

Requests in flight could display as negative when should be zero

-- 
Thanks,

Steve

[-- Attachment #2: 0001-smb3-fix-leak-in-requests-in-flight-perf-counter.patch --]
[-- Type: text/x-patch, Size: 2142 bytes --]

From e3977a6ab646b7096a47b7dc8af61f31b8ef8ace Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Sun, 22 Sep 2019 00:55:46 -0500
Subject: [PATCH] smb3: fix leak in "requests in flight" perf counter

We were not bumping "requests in flight" up in some cases
on opens of the share root so "requests in flight" could
end up showing as a negative counter.

CC: Stable <stable@vger.kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/cifs/smb2ops.c | 5 +++++
 fs/cifs/smb2pdu.c | 1 +
 2 files changed, 6 insertions(+)

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 0e66dc1aa1c9..901f2ed3fe82 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -762,6 +762,8 @@ int open_shroot(unsigned int xid, struct cifs_tcon *tcon, struct cifs_fid *pfid)
 		goto oshr_exit;
 	}
 
+	atomic_inc(&tcon->num_remote_opens);
+
 	o_rsp = (struct smb2_create_rsp *)rsp_iov[0].iov_base;
 	oparms.fid->persistent_fid = o_rsp->PersistentFileId;
 	oparms.fid->volatile_fid = o_rsp->VolatileFileId;
@@ -1187,6 +1189,7 @@ smb2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
 
 	rc = compound_send_recv(xid, ses, flags, 3, rqst,
 				resp_buftype, rsp_iov);
+	/* no need to bump num_remote_opens because handle immediately closed */
 
  sea_exit:
 	kfree(ea);
@@ -1529,6 +1532,8 @@ smb2_ioctl_query_info(const unsigned int xid,
 				resp_buftype, rsp_iov);
 	if (rc)
 		goto iqinf_exit;
+
+	/* No need to bump num_remote_opens since handle immediately closed */
 	if (qi.flags & PASSTHRU_FSCTL) {
 		pqi = (struct smb_query_info __user *)arg;
 		io_rsp = (struct smb2_ioctl_rsp *)rsp_iov[1].iov_base;
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 8bcb278fdb0a..6ea2430240f5 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -2372,6 +2372,7 @@ int smb311_posix_mkdir(const unsigned int xid, struct inode *inode,
 	rqst.rq_iov = iov;
 	rqst.rq_nvec = n_iov;
 
+	/* no need to inc num_remote_opens because we close it just below */
 	trace_smb3_posix_mkdir_enter(xid, tcon->tid, ses->Suid, CREATE_NOT_FILE,
 				    FILE_WRITE_ATTRIBUTES);
 	/* resource #4: response buffer */
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: Fix for "requests in flight" showing negative
  2019-09-22  5:58 Fix for "requests in flight" showing negative Steve French
@ 2019-09-23 17:26 ` Pavel Shilovsky
  2019-09-24  3:47   ` Steve French
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Shilovsky @ 2019-09-23 17:26 UTC (permalink / raw)
  To: Steve French; +Cc: ronnie sahlberg, CIFS

I guess it should be "open files" instead of "requests in flight" in
the title and the description of the patch.

Other than that looks good:

Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>

--
Best regards,
Pavel Shilovsky

сб, 21 сент. 2019 г. в 22:58, Steve French <smfrench@gmail.com>:

>
> Requests in flight could display as negative when should be zero
>
> --
> Thanks,
>
> Steve

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Fix for "requests in flight" showing negative
  2019-09-23 17:26 ` Pavel Shilovsky
@ 2019-09-24  3:47   ` Steve French
  0 siblings, 0 replies; 3+ messages in thread
From: Steve French @ 2019-09-24  3:47 UTC (permalink / raw)
  To: Pavel Shilovsky; +Cc: ronnie sahlberg, CIFS

aaah - the typos -- thank you for noticing the obvious!

Fixed and repushed.

On Mon, Sep 23, 2019 at 12:26 PM Pavel Shilovsky <piastryyy@gmail.com> wrote:
>
> I guess it should be "open files" instead of "requests in flight" in
> the title and the description of the patch.
>
> Other than that looks good:
>
> Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
>
> --
> Best regards,
> Pavel Shilovsky
>
> сб, 21 сент. 2019 г. в 22:58, Steve French <smfrench@gmail.com>:
>
> >
> > Requests in flight could display as negative when should be zero
> >
> > --
> > Thanks,
> >
> > Steve



-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-24  3:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-22  5:58 Fix for "requests in flight" showing negative Steve French
2019-09-23 17:26 ` Pavel Shilovsky
2019-09-24  3:47   ` Steve French

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).