From: Aurelien Aptel <aaptel@suse.com>
To: linux-cifs@vger.kernel.org
Cc: piastryyy@gmail.com, Aurelien Aptel <aaptel@suse.com>
Subject: [PATCH v1] CIFS: keep FileInfo handle around while writing pages
Date: Tue, 26 Mar 2019 17:31:52 +0100 [thread overview]
Message-ID: <20190326163152.27385-1-aaptel@suse.com> (raw)
In-Reply-To: <CAKywueSSULxWaFNb12EGJXmAr9k=hd6f3ND5f0AQhwho0PV6Tw@mail.gmail.com>
In the oplock break handler, writing pending changes from pages puts
the FileInfo handle. If the refcount reaches zero it closes the handle
and waits for any oplock break handler to return, thus causing a deadlock.
To prevent it we keep an additionnal reference of the SMB FileInfo
handle while we write/read pages so that when writepages puts the
handle, it won't close it.
This was triggered by xfstest 464.
Signed-off-by: Aurelien Aptel <aaptel@suse.com>
---
fs/cifs/file.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 89006e044973..a9a515ea2e14 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -4579,12 +4579,15 @@ void cifs_oplock_break(struct work_struct *work)
break_lease(inode, O_RDONLY);
else
break_lease(inode, O_WRONLY);
+
+ cifsFileInfo_get(cfile);
rc = filemap_fdatawrite(inode->i_mapping);
if (!CIFS_CACHE_READ(cinode)) {
rc = filemap_fdatawait(inode->i_mapping);
mapping_set_error(inode->i_mapping, rc);
cifs_zap_mapping(inode);
}
+ cifsFileInfo_put(cfile);
cifs_dbg(FYI, "Oplock flush inode %p rc %d\n", inode, rc);
}
--
2.16.4
next parent reply other threads:[~2019-03-26 16:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAKywueSSULxWaFNb12EGJXmAr9k=hd6f3ND5f0AQhwho0PV6Tw@mail.gmail.com>
2019-03-26 16:31 ` Aurelien Aptel [this message]
2019-03-27 22:49 ` [PATCH v1] CIFS: keep FileInfo handle around while writing pages Pavel Shilovsky
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=20190326163152.27385-1-aaptel@suse.com \
--to=aaptel@suse.com \
--cc=linux-cifs@vger.kernel.org \
--cc=piastryyy@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.