From: Frank Sorenson <sorenson@redhat.com>
To: linux-cifs <linux-cifs@vger.kernel.org>
Subject: A process killed while opening a file can result in leaked open handle on the server
Date: Tue, 12 Nov 2019 13:34:27 -0600 [thread overview]
Message-ID: <0326b8d9-d66c-1df0-2d04-91b9a861c10f@redhat.com> (raw)
If a process opening a file is killed while waiting for a SMB2_CREATE
response from the server, the response may not be handled by the client,
leaking an open file handle on the server.
This can be reproduced with the following:
# mount //vm3/user1 /mnt/vm3 -overs=3,sec=ntlmssp,credentials=/root/.user1_smb_creds
# cd /mnt/vm3
# echo foo > foo
# for i in {1..100} ; do cat foo >/dev/null 2>&1 & sleep 0.0001 ; kill -9 $! ; done
(increase count if necessary--100 appears sufficient to cause multiple leaked file handles)
The client will stop waiting for the response, and will output
the following when the response does arrive:
CIFS VFS: Close unmatched open
on the server side, an open file handle is leaked. If using samba,
the following will show these open files:
# smbstatus | grep -i Locked -A1000
Locked files:
Pid Uid DenyMode Access R/W Oplock SharePath Name Time
--------------------------------------------------------------------------------------------------
25936 501 DENY_NONE 0x80 RDONLY NONE /home/user1 . Tue Nov 12 12:29:24 2019
25936 501 DENY_NONE 0x80 RDONLY NONE /home/user1 . Tue Nov 12 12:29:24 2019
25936 501 DENY_NONE 0x120089 RDONLY LEASE(RWH) /home/user1 foo Tue Nov 12 12:29:24 2019
25936 501 DENY_NONE 0x120089 RDONLY LEASE(RWH) /home/user1 foo Tue Nov 12 12:29:24 2019
25936 501 DENY_NONE 0x120089 RDONLY LEASE(RWH) /home/user1 foo Tue Nov 12 12:29:24 2019
25936 501 DENY_NONE 0x120089 RDONLY LEASE(RWH) /home/user1 foo Tue Nov 12 12:29:24 2019
25936 501 DENY_NONE 0x120089 RDONLY LEASE(RWH) /home/user1 foo Tue Nov 12 12:29:24 2019
(also tracked https://bugzilla.redhat.com/show_bug.cgi?id=1771691)
Frank
--
Frank Sorenson
sorenson@redhat.com
Principal Software Maintenance Engineer
Global Support Services - filesystems
Red Hat
next reply other threads:[~2019-11-12 19:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-12 19:34 Frank Sorenson [this message]
2019-11-13 2:37 ` A process killed while opening a file can result in leaked open handle on the server Pavel Shilovsky
2019-11-13 5:19 ` Ronnie Sahlberg
2019-11-13 6:49 ` Ronnie Sahlberg
2019-11-13 22:15 ` Frank Sorenson
2019-11-14 1:39 ` Ronnie Sahlberg
2019-11-15 18:21 ` Pavel Shilovskiy
2019-11-17 16:29 ` Frank Sorenson
2019-11-21 19:41 ` Pavel Shilovsky
2019-11-13 3:28 ` Ronnie Sahlberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0326b8d9-d66c-1df0-2d04-91b9a861c10f@redhat.com \
--to=sorenson@redhat.com \
--cc=linux-cifs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).