linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] CIFS: Gracefully handle QueryInfo errors during open
@ 2019-09-30 17:06 Pavel Shilovsky
  2019-09-30 17:06 ` [PATCH 2/3] CIFS: Force revalidate inode when dentry is stale Pavel Shilovsky
  2019-09-30 17:06 ` [PATCH 3/3] CIFS: Force reval dentry if LOOKUP_REVAL flag is set Pavel Shilovsky
  0 siblings, 2 replies; 4+ messages in thread
From: Pavel Shilovsky @ 2019-09-30 17:06 UTC (permalink / raw)
  To: linux-cifs; +Cc: Steve French, Pavel Shilovskiy

Currently if the client identifies problems when processing
metadata returned in CREATE response, the open handle is being
leaked. This causes multiple problems like a file missing a lease
break by that client which causes high latencies to other clients
accessing the file. Another side-effect of this is that the file
can't be deleted.

Fix this by closing the file after the client hits an error after
the file was opened and the open descriptor wasn't returned to
the user space. Also convert -ESTALE to -EOPENSTALE to allow
the VFS to revalidate a dentry and retry the open.

Cc: <stable@vger.kernel.org>
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
---
 fs/cifs/file.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 97090693d182..168b76de193a 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -253,6 +253,12 @@ cifs_nt_open(char *full_path, struct inode *inode, struct cifs_sb_info *cifs_sb,
 		rc = cifs_get_inode_info(&inode, full_path, buf, inode->i_sb,
 					 xid, fid);
 
+	if (rc) {
+		server->ops->close(xid, tcon, fid);
+		if (rc == -ESTALE)
+			rc = -EOPENSTALE;
+	}
+
 out:
 	kfree(buf);
 	return rc;
-- 
2.17.1


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

end of thread, other threads:[~2019-10-10 18:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-30 17:06 [PATCH 1/3] CIFS: Gracefully handle QueryInfo errors during open Pavel Shilovsky
2019-09-30 17:06 ` [PATCH 2/3] CIFS: Force revalidate inode when dentry is stale Pavel Shilovsky
2019-09-30 17:06 ` [PATCH 3/3] CIFS: Force reval dentry if LOOKUP_REVAL flag is set Pavel Shilovsky
2019-10-10 18:06   ` Pavel Shilovsky

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).