From patchwork Thu Sep 25 07:14:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 4973501 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9D5589F1D4 for ; Thu, 25 Sep 2014 07:15:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F3BB0201E4 for ; Thu, 25 Sep 2014 07:15:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4B73220204 for ; Thu, 25 Sep 2014 07:15:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752467AbaIYHP2 (ORCPT ); Thu, 25 Sep 2014 03:15:28 -0400 Received: from mail-qg0-f43.google.com ([209.85.192.43]:56712 "EHLO mail-qg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752344AbaIYHPP (ORCPT ); Thu, 25 Sep 2014 03:15:15 -0400 Received: by mail-qg0-f43.google.com with SMTP id f51so6991025qge.2 for ; Thu, 25 Sep 2014 00:15:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:cc:content-type; bh=6zq0/X4XmimI2nuAgH0V6PvWyb4SwyngQ8Q6KsCdGwE=; b=UOslcf6WUVEZG8JcUmEwiTLe8MCHuBaf3zB6e/L0RY/+d6OKK7mTj6/7FgFPOU5nRz hZWlg367AFA2affEDQHp0Gsggp3GzEAxtfuFrn42u5bjhV2dQ8L5GN9V6P8NO4caTtcw ejYs7TbnOYHJvJoY28KWOhuFHBdkRb+iu32EtdNwnNgFEh70jz8qdirbDtXzogR+4y1B +VZ3K5kXIidWTPByJlxjl8MjJXeCDV6Vg0/bkgANdb8cMxWHPZ/4qG8kN2DeNJE0LQPs n9YAdGfcyj8asX4l6HucT4Z5yWdhXsP9/Gd9hTAY55yQ5gtjQPp7xpa1AgwjH3kPC5pV H1qA== X-Received: by 10.140.92.98 with SMTP id a89mr16249914qge.85.1411629314648; Thu, 25 Sep 2014 00:15:14 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.32.116 with HTTP; Thu, 25 Sep 2014 00:14:54 -0700 (PDT) From: Steve French Date: Thu, 25 Sep 2014 02:14:54 -0500 Message-ID: Subject: [PATCH][CIFS] Fix problem incorrectly closing file during query of reparse points To: "linux-cifs@vger.kernel.org" Cc: Pavel Shilovsky Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, T_TVD_MIME_EPI,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP [PATCH] Fix problem recognizing symlinks Changeset eb85d94bd introduced a problem where if a cifs open fails during query info of a file we will still try to close the file (happens with certain types of reparse points) even though the file handle is not valid. In addition for SMB2/SMB3 we were not mapping the return code returned by Windows when trying to open a file (like a Windows NFS symlink) which is a reparse point. Signed-off-by: Steve French CC: Pavel Shilovsky CC: stable #v3.13+ See attached or git tree at http://git.samba.org/?p=sfrench/cifs-2.6.git;a=shortlog;h=refs/heads/for-next Reviewed-by: Pavel Shilovsky From 2b20ac4fcd7b9e492a56aa4fd12ebbac830859e7 Mon Sep 17 00:00:00 2001 From: Steve French Date: Thu, 25 Sep 2014 01:26:55 -0500 Subject: [PATCH] Fix problem recognizing symlinks Changeset eb85d94bd introduced a problem where if a cifs open fails during query info of a file we will still try to close the file (happens with certain types of reparse points) even though the file handle is not valid. In addition for SMB2/SMB3 we were not mapping the return code returned by Windows when trying to open a file (like a Windows NFS symlink) which is a reparse point. Signed-off-by: Steve French CC: Pavel Shilovsky CC: stable #v3.13+ --- fs/cifs/smb1ops.c | 2 +- fs/cifs/smb2maperror.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index 8601807..b7d16ef 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c @@ -586,7 +586,7 @@ cifs_query_path_info(const unsigned int xid, struct cifs_tcon *tcon, tmprc = CIFS_open(xid, &oparms, &oplock, NULL); if (tmprc == -EOPNOTSUPP) *symlink = true; - else + else if (rc == 0) CIFSSMBClose(xid, tcon, fid.netfid); } diff --git a/fs/cifs/smb2maperror.c b/fs/cifs/smb2maperror.c index af59d03..8257a5a 100644 --- a/fs/cifs/smb2maperror.c +++ b/fs/cifs/smb2maperror.c @@ -256,6 +256,8 @@ static const struct status_to_posix_error smb2_error_map_table[] = { {STATUS_DLL_MIGHT_BE_INCOMPATIBLE, -EIO, "STATUS_DLL_MIGHT_BE_INCOMPATIBLE"}, {STATUS_STOPPED_ON_SYMLINK, -EOPNOTSUPP, "STATUS_STOPPED_ON_SYMLINK"}, + {STATUS_IO_REPARSE_TAG_NOT_HANDLED, -EOPNOTSUPP, + "STATUS_REPARSE_NOT_HANDLED"}, {STATUS_DEVICE_REQUIRES_CLEANING, -EIO, "STATUS_DEVICE_REQUIRES_CLEANING"}, {STATUS_DEVICE_DOOR_OPEN, -EIO, "STATUS_DEVICE_DOOR_OPEN"}, -- 1.9.1