From patchwork Wed Oct 21 04:03:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 11848229 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA269C4363D for ; Wed, 21 Oct 2020 04:03:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7404621D6C for ; Wed, 21 Oct 2020 04:03:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SA4hdklV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725782AbgJUEDo (ORCPT ); Wed, 21 Oct 2020 00:03:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725274AbgJUEDo (ORCPT ); Wed, 21 Oct 2020 00:03:44 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B20FC0613CE for ; Tue, 20 Oct 2020 21:03:44 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id c141so1114613lfg.5 for ; Tue, 20 Oct 2020 21:03:44 -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:cc; bh=NNk8LRssaqazn1wXk6uTM5muK8cWXjM1KrI2CzX5ITY=; b=SA4hdklVZTpZ13GcktHfxVVop4A/J/9h24QQNRz7dfss55GqxE3qYgFNAUxT6VHaya 4Y6ueJiPS6uayhuiOLbcWIyEgVe6bT7TEgJ8awMaWKOYAnt3UKimAsjcLJVV05tpiNUu JOUF5+xR6FU4qHsMZRJ/K+Pn+dWc/vo3klhqeiRnNNJEwrNwh4eWC9sBXR4NGS4OoDzq rUtZuiGRl1K+oRHIxuMSd80trAHI3bnR3IDUd4Qh3OKIZzR0SEZNi24zzqt1hFIJQzA/ JbR7RCo5JShp8efWFefyJeurNfI6VyMjzWeambCeOYVYP05ZimHroWkVgz2kB3vCKkNa WMwA== 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:cc; bh=NNk8LRssaqazn1wXk6uTM5muK8cWXjM1KrI2CzX5ITY=; b=MRboBuEDE3anvFSwqbftXas/2eekgQM94sw0/7j3sDY9lekWfYK9MgHaETvo5wsbfN vfkOXgLcoWNvNK/Nk5A2xLY19u+SMcmplnaRrRdw/cBkPvKb9b+k6xZz/iv21ngi3/6Q OUPABNCIoY1tA6t5/CJzMLv3GH/fvOJtotaOJzRxkWlr6bdsIh6sWTfCz/Xq8aSGXcCL RMCZGKTrxAmSbrYp2EVWecux+fH/r5RCCJOnHZGMTda6ZDxQX7xrwy3uV59mKYiDb/bx X7WPKZwPV9tkK9V/KoMRFu7eT7DVoeafuNFg9EUkALcWqutLFGC+ojbxcxhsudrpcfOw yXkA== X-Gm-Message-State: AOAM530Gy3ci/ElSFFenGEJ41r5tnzUVBEzGylbAi45bHOw84jRGTLtW ur4BtSZ9fG7la1tAlnXW5wtrFDk6TPyM45/QefZI/iRqJKbpgQ== X-Google-Smtp-Source: ABdhPJwnyzNztBeW809vxMgFmnm35Wkfcn55N99/KgenvjcmCbHeAPizsnekNxwMNfwvGMt5VJaxGEh6LxE2/X14azs= X-Received: by 2002:a19:83c1:: with SMTP id f184mr364549lfd.97.1603253022188; Tue, 20 Oct 2020 21:03:42 -0700 (PDT) MIME-Version: 1.0 From: Steve French Date: Tue, 20 Oct 2020 23:03:31 -0500 Message-ID: Subject: [PATCH][SMB3] fix stat when special device file and mounted with modefromsid To: CIFS Cc: samba-technical Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org When mounting with modefromsid mount option, it was possible to get the error on stat of a fifo or char or block device: "cannot stat : Operation not supported" Special devices can be stored as reparse points by some servers (e.g. Windows NFS server and when using the SMB3.1.1 POSIX Extensions) but when the modefromsid mount option is used the client attempts to get the ACL for the file which requires opening with OPEN_REPARSE_POINT create option. --- Thanks, Steve From de3fe18663801dded6987441664cd54b3276703a Mon Sep 17 00:00:00 2001 From: Steve French Date: Tue, 20 Oct 2020 22:53:57 -0500 Subject: [PATCH] smb3: fix stat when special device file and mounted with modefromsid When mounting with modefromsid mount option, it was possible to get the error on stat of a fifo or char or block device: "cannot stat : Operation not supported" Special devices can be stored as reparse points by some servers (e.g. Windows NFS server and when using the SMB3.1.1 POSIX Extensions) but when the modefromsid mount option is used the client attempts to get the ACL for the file which requires opening with OPEN_REPARSE_POINT create option. Signed-off-by: Steve French --- fs/cifs/smb2ops.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 2c3cfb2e8e72..7e3edcda054e 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -3099,6 +3099,12 @@ get_smb2_acl_by_path(struct cifs_sb_info *cifs_sb, rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL, NULL, NULL); + if (rc == -EOPNOTSUPP) { + oparms.create_options |= OPEN_REPARSE_POINT; + rc = SMB2_open(xid, &oparms, utf16_path, &oplock, NULL, NULL, + NULL, NULL); + cifs_dbg(VFS, "open retry rc %d\n", rc); /* BB removeme */ + } kfree(utf16_path); if (!rc) { rc = SMB2_query_acl(xid, tlink_tcon(tlink), fid.persistent_fid, -- 2.25.1