From patchwork Thu Nov 15 14:20:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Aur=C3=A9lien_Aptel?= X-Patchwork-Id: 10684411 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BBFB8109C for ; Thu, 15 Nov 2018 14:21:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A649A2C810 for ; Thu, 15 Nov 2018 14:21:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9ADDC2C820; Thu, 15 Nov 2018 14:21:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E7282C810 for ; Thu, 15 Nov 2018 14:21:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388019AbeKPA3n (ORCPT ); Thu, 15 Nov 2018 19:29:43 -0500 Received: from mx2.suse.de ([195.135.220.15]:42620 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387839AbeKPA3n (ORCPT ); Thu, 15 Nov 2018 19:29:43 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 3AB1CAF4C; Thu, 15 Nov 2018 14:21:40 +0000 (UTC) From: Aurelien Aptel To: linux-cifs@vger.kernel.org Cc: smfrench@gmail.com, Paulo Alcantara , Paulo Alcantara , Aurelien Aptel Subject: [PATCH v1 05/14] cifs: Respect -EAGAIN when querying paths Date: Thu, 15 Nov 2018 15:20:54 +0100 Message-Id: <20181115142103.24617-6-aaptel@suse.com> X-Mailer: git-send-email 2.13.7 In-Reply-To: <20181115142103.24617-1-aaptel@suse.com> References: <20181115142103.24617-1-aaptel@suse.com> Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Paulo Alcantara 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 Signed-off-by: Aurelien Aptel --- 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