[PATCH v1 05/14] cifs: Respect -EAGAIN when querying paths

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Paulo Alcantara <paulo@xxxxxxxx>

After a successful reconnect, smb2_reconnect() will return -EAGAIN for
specific SMB2 commands (including queries) informing the caller to
retry the command.

This patch makes sure to retry them in possible reconnects.

Signed-off-by: Paulo Alcantara <palcantara@xxxxxxx>
Signed-off-by: Aurelien Aptel <aaptel@xxxxxxxx>
---
 fs/cifs/inode.c   |  7 +++++--
 fs/cifs/smb2ops.c | 23 ++++++++++++++++++-----
 2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index a81a9df997c1..44a76e26f21f 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -771,8 +771,11 @@ cifs_get_inode_info(struct inode **inode, const char *full_path,
 			goto cgii_exit;
 		}
 		data = (FILE_ALL_INFO *)buf;
-		rc = server->ops->query_path_info(xid, tcon, cifs_sb, full_path,
-						  data, &adjust_tz, &symlink);
+		do {
+			rc = server->ops->query_path_info(xid, tcon, cifs_sb,
+							  full_path, data,
+							  &adjust_tz, &symlink);
+		} while (rc == -EAGAIN);
 	}
 
 	if (!rc) {
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 54bedd751e66..dd2e8b4e4cc9 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -1714,8 +1714,13 @@ smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon,
 	oparms.fid = fid;
 	oparms.reconnect = false;
 
-	rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL, NULL);
+	do {
+		rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL,
+			       NULL);
+	} while (rc == -EAGAIN);
+
 	kfree(utf16_path);
+
 	if (rc) {
 		cifs_dbg(FYI, "open dir failed rc=%d\n", rc);
 		return rc;
@@ -1724,8 +1729,11 @@ smb2_query_dir_first(const unsigned int xid, struct cifs_tcon *tcon,
 	srch_inf->entries_in_buffer = 0;
 	srch_inf->index_of_last_entry = 2;
 
-	rc = SMB2_query_directory(xid, tcon, fid->persistent_fid,
-				  fid->volatile_fid, 0, srch_inf);
+	do {
+		rc = SMB2_query_directory(xid, tcon, fid->persistent_fid,
+					  fid->volatile_fid, 0, srch_inf);
+	} while (rc == -EAGAIN);
+
 	if (rc) {
 		cifs_dbg(FYI, "query directory failed rc=%d\n", rc);
 		SMB2_close(xid, tcon, fid->persistent_fid, fid->volatile_fid);
@@ -1738,8 +1746,13 @@ smb2_query_dir_next(const unsigned int xid, struct cifs_tcon *tcon,
 		    struct cifs_fid *fid, __u16 search_flags,
 		    struct cifs_search_info *srch_inf)
 {
-	return SMB2_query_directory(xid, tcon, fid->persistent_fid,
-				    fid->volatile_fid, 0, srch_inf);
+	int rc;
+
+	do {
+		rc = SMB2_query_directory(xid, tcon, fid->persistent_fid,
+					  fid->volatile_fid, 0, srch_inf);
+	} while (rc == -EAGAIN);
+	return rc;
 }
 
 static int
-- 
2.13.7




[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux