From patchwork Fri Oct 19 07:09:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 10648765 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 0FF6D14E2 for ; Fri, 19 Oct 2018 07:09:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB65E28AF5 for ; Fri, 19 Oct 2018 07:09:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DFDF828AF8; Fri, 19 Oct 2018 07:09:17 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,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 4804B28AF5 for ; Fri, 19 Oct 2018 07:09:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726930AbeJSPOD (ORCPT ); Fri, 19 Oct 2018 11:14:03 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:36825 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726653AbeJSPOD (ORCPT ); Fri, 19 Oct 2018 11:14:03 -0400 Received: by mail-pg1-f194.google.com with SMTP id f18-v6so15388915pgv.3 for ; Fri, 19 Oct 2018 00:09:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=P3f5ytnhUSzos+zPl9pskuCzGJGunuZYWxZStPpTHGE=; b=M02Bi42eNZDVDrRcYUv8ErbEGyBXvOWTWF9OK4Nt3zpanHJC5Q6AYkp0iLQsWFCN1Q j5dVnQ27sMajnhbTnYslMOIcfjAObKnyznXccHoA0yUawdTQPQ88FUBWMRR5D7MKLLw8 IxN5qAJ7XBTmPFsmDALONa76Gn2U6F+RCnAsxv0w63WH2AdGH4rYAO0toBmGAeOCDO9n F0TSYNLGCN4Eoa+AKIdkdnPPI7UiEUAexDQ1G3ztt8+44XNErcFGcxpYhuUdThZPZYq2 ZJ1Fym6rTpo8wXwnSR6zy2pFKe7EfJh/iTPx8UvSYdZC9JfO2cfqeFK5QpEA9VhmKoWr GimQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=P3f5ytnhUSzos+zPl9pskuCzGJGunuZYWxZStPpTHGE=; b=cF/6nrJQ9uCXn18Tcgx41F2QfsUH1xgqf7wP2CarZY/lddCAZo323Jihfio73XYrSV rfsAF8+UTqglcN4HXFqUME0+qdTvS9i7otT9RJY/Ylo/dvQjxV1dkkD8MvHCtVmupRnY tdV+dkOM5NbpQ/iq8AVwbr9DZUpxe7aSmZq3if9AxMf2o7sxH8cmWPozJ2JaF/oDTq8G exLAzk8YsSE8k494+OZ+l1LCSbt1Bt/lwfA2p8slpUHJNdxkdfedVU4iAMWvO/5AZGdv 51TQK7grI7f1jdM96mmZt40G13x5mv18/5TjtqSOu37J1OLQFyYHBsBwIS7byISXj3q9 pejA== X-Gm-Message-State: ABuFfoh5FSHGO9RNDzYcCiaDIlcMk8H9pcHt/ShCwO0skJxIpzfcMx9n CnLYwj9Gz3ZmKXwy9aPMO2XOkRVy61E/L8okKxr6KWlr X-Google-Smtp-Source: ACcGV61TFkvLozFK3HAEXA5uxPs9B40Afk8NolaXBfVF09cMqs9WFqF3vHpvQptGAGvswDxh7TwCDBa7OSWttJWKpw8= X-Received: by 2002:a62:ca4d:: with SMTP id n74-v6mr32907799pfg.10.1539932955396; Fri, 19 Oct 2018 00:09:15 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Fri, 19 Oct 2018 02:09:03 -0500 Message-ID: Subject: [CIFS][PATCH] cifs: fallback to older infolevels on findfirst queryinfo retry To: CIFS 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 In cases where queryinfo fails, we have cases in cifs (vers=1.0) where with backupuid mounts we retry the query info with findfirst. This doesn't work to some NetApp servers which don't support WindowsXP (and later) infolevel 261 (SMB_FIND_FILE_ID_FULL_DIR_INFO) so in this case use other info levels (in this case it will usually be level 257, SMB_FIND_FILE_DIRECTORY_INFO). Also fixes indentation. See kernel bugzilla 201435 Signed-off-by: Steve French --- fs/cifs/inode.c | 67 +++++++++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 30 deletions(-) From ee68033e78aaaf0b15b2361346bdcc0d132edc7c Mon Sep 17 00:00:00 2001 From: Steve French Date: Fri, 19 Oct 2018 01:58:22 -0500 Subject: [PATCH 2/2] cifs: fallback to older infolevels on findfirst queryinfo retry In cases where queryinfo fails, we have cases in cifs (vers=1.0) where with backupuid mounts we retry the query info with findfirst. This doesn't work to some NetApp servers which don't support WindowsXP (and later) infolevel 261 (SMB_FIND_FILE_ID_FULL_DIR_INFO) so in this case use other info levels (in this case it will usually be level 257, SMB_FIND_FILE_DIRECTORY_INFO). See kernel bugzilla 201435 Signed-off-by: Steve French --- fs/cifs/inode.c | 67 +++++++++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 30 deletions(-) diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 7483c09317b9..1023d78673fb 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -784,43 +784,50 @@ cifs_get_inode_info(struct inode **inode, const char *full_path, } else if ((rc == -EACCES) && backup_cred(cifs_sb) && (strcmp(server->vals->version_string, SMB1_VERSION_STRING) == 0)) { - /* - * For SMB2 and later the backup intent flag is already - * sent if needed on open and there is no path based - * FindFirst operation to use to retry with - */ + /* + * For SMB2 and later the backup intent flag is already + * sent if needed on open and there is no path based + * FindFirst operation to use to retry with + */ - srchinf = kzalloc(sizeof(struct cifs_search_info), - GFP_KERNEL); - if (srchinf == NULL) { - rc = -ENOMEM; - goto cgii_exit; - } + srchinf = kzalloc(sizeof(struct cifs_search_info), + GFP_KERNEL); + if (srchinf == NULL) { + rc = -ENOMEM; + goto cgii_exit; + } - srchinf->endOfSearch = false; + srchinf->endOfSearch = false; + if (tcon->unix_ext) + srchinf->info_level = SMB_FIND_FILE_UNIX; + else if ((tcon->ses->capabilities & + tcon->ses->server->vals->cap_nt_find) == 0) + srchinf->info_level = SMB_FIND_FILE_INFO_STANDARD; + else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) srchinf->info_level = SMB_FIND_FILE_ID_FULL_DIR_INFO; + else /* no srvino useful for fallback to some netapp */ + srchinf->info_level = SMB_FIND_FILE_DIRECTORY_INFO; - srchflgs = CIFS_SEARCH_CLOSE_ALWAYS | - CIFS_SEARCH_CLOSE_AT_END | - CIFS_SEARCH_BACKUP_SEARCH; + srchflgs = CIFS_SEARCH_CLOSE_ALWAYS | + CIFS_SEARCH_CLOSE_AT_END | + CIFS_SEARCH_BACKUP_SEARCH; - rc = CIFSFindFirst(xid, tcon, full_path, - cifs_sb, NULL, srchflgs, srchinf, false); - if (!rc) { - data = - (FILE_ALL_INFO *)srchinf->srch_entries_start; + rc = CIFSFindFirst(xid, tcon, full_path, + cifs_sb, NULL, srchflgs, srchinf, false); + if (!rc) { + data = (FILE_ALL_INFO *)srchinf->srch_entries_start; - cifs_dir_info_to_fattr(&fattr, - (FILE_DIRECTORY_INFO *)data, cifs_sb); - fattr.cf_uniqueid = le64_to_cpu( - ((SEARCH_ID_FULL_DIR_INFO *)data)->UniqueId); - validinum = true; + cifs_dir_info_to_fattr(&fattr, + (FILE_DIRECTORY_INFO *)data, cifs_sb); + fattr.cf_uniqueid = le64_to_cpu( + ((SEARCH_ID_FULL_DIR_INFO *)data)->UniqueId); + validinum = true; - cifs_buf_release(srchinf->ntwrk_buf_start); - } - kfree(srchinf); - if (rc) - goto cgii_exit; + cifs_buf_release(srchinf->ntwrk_buf_start); + } + kfree(srchinf); + if (rc) + goto cgii_exit; } else goto cgii_exit; -- 2.17.1