From patchwork Tue Jul 23 05:56:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve French X-Patchwork-Id: 13739367 Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 402EF13CFB7 for ; Tue, 23 Jul 2024 05:56:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721714190; cv=none; b=UYHd3OfjzD2tInDVrF37UJMyNZbMbA1wrANU0cz5YQj6qGNY779xxNROjLVutCyOU71XvkSm3F7WpH3gv6hh/Ua033OIIcSuM72oOrU1/o4ue0HNBOuJwsaeNGmdvqrZo4wbxzzJTH9kdFOCLRvZFHkbEcWMGhDGxRvN0AesvaQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721714190; c=relaxed/simple; bh=9nejVXi2mwNz/4TMQc7mgbuRaDUffHG639Vo4ppv6i0=; h=MIME-Version:From:Date:Message-ID:Subject:To:Cc:Content-Type; b=fCj5SuXotseiCHeF6gbD1DOy6OFwkoodGzPTFaeo6Y+XKe4Ikan3n+0HDT7MzSIx6Vgl/NMK4eKoiAdrQ3kT2+8LU4+W3FTOyX1I2MQVPqRxinRCy2hGspc/60/t+2mRYElTvUAcAADNUMxOPQA89tObfsD2pYms5lY9qUDe5U0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gPR9YRFX; arc=none smtp.client-ip=209.85.167.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gPR9YRFX" Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-52ed741fe46so5849121e87.0 for ; Mon, 22 Jul 2024 22:56:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721714187; x=1722318987; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=Eyg85J8K9ihH82p0hRx+2qtj9MLkxnAavrxsh5Wv+NE=; b=gPR9YRFXt9Qx1LkYvPjkhhUOPImSkqe8Hvwb3KGzSawDcHq34eGJP4fJ33jcpuMOzM 8+QG91OWIPDdc28CelBx+eBAVYXtLcuZTcY87X205Z6h2rz79rt3REGI6fGWe+fAojgS F8brKl/yL+tb6izEoHI2JtqddghPmpYnfTqAcafXhXbNJUQKXKKonPmIANfvzKPVddul ZDLXNEMJV5m4DFst3jX5vwC75BNnx+COKMsTo3C6M+1tghNDS/95tyruRDk2odjBWLVY 0i78TDByMZLxnb6NiH+YVnkO+UYs4Q6kO8jPJ7W3zFcHMqbpXmdwqlrIFMPc/XlIPHqg WljQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721714187; x=1722318987; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Eyg85J8K9ihH82p0hRx+2qtj9MLkxnAavrxsh5Wv+NE=; b=rU1a32GeMfQzijDpVAycWFoyWq9kR0b4ViyGcQIYE5W4syVX1I+GEJrc9wbGkmIkZX SRscxpQw7DcljLnPPmuj/ygt7eG3E+5IXlF2/mhHdUJd47ZROOG5kYTSN8k7ls4HiQg/ i+kCCUVM6lPyiK5Z3U5QeDDgEOulinYJB7Na1cT3FJH3SmZnPHDQ0MWUAYBLS9Kefvh7 cg9TPgJXIpnh3snoMsSR+Qs9QeCub+g1yo6e3+BrvD6hwsmTQXpqqcmIIKkJAn2y4n+M DYxVsaxhiKvk7x5cCvE7vd5rYGJKGr7kdaBwTj9ST+Qy0yrSbhuJx7DDNsrqOdi1TeX1 kfHw== X-Gm-Message-State: AOJu0YxQQC5V5Bui+TNdvvCozVFg38WGWjsVZbHWUoRxmXfWshVNsAN6 PVjtNY4UXaOBRHsLkv+zwQrGpgpjlvgdakFyQEX5RSegOPYtUKgvPnXaCIC/bnfxXDW+2hDLJvf Os5NByJXD6X1sdBjALaSvV3I6Iwy4pERh X-Google-Smtp-Source: AGHT+IE7ebaVGF0FCj1gjWT7OgagQGgXPXNxI8yTB+YxqCDVea1beFx94JHCQNlZ3cG/eqoEhJFuvr91vfrvReVtKR8= X-Received: by 2002:a05:6512:2209:b0:52e:f2a6:8e1a with SMTP id 2adb3069b0e04-52efb7e8103mr6190757e87.29.1721714186771; Mon, 22 Jul 2024 22:56:26 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-cifs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Steve French Date: Tue, 23 Jul 2024 00:56:15 -0500 Message-ID: Subject: [PATCH][CIFS] mount with "unix" mount option for SMB1 incorrectly handled To: CIFS , samba-technical , Andrew Bartlett , Kevin Ottens Cc: Paulo Alcantara When Andrew Bartlett mentioned problems using the SMB1 Unix Extensions to Samba I noticed a couple of client bugs. This fixes the second problem I noticed. Although by default we negotiate CIFS Unix Extensions for SMB1 mounts to Samba (and they work if the user does not specify "unix" or "posix" or "linux" on mount), and we do properly handle when a user turns them off with "nounix" mount parm, ... but with the changes to the mount API we broke cases where the user explicitly specified the "unix" option (or equivalently "linux" or "posix") on mount with vers=1.0 to Samba or other servers which support the CIFS Unix Extensions. "mount error(95): Operation not supported" and logged: "CIFS: VFS: Check vers= mount option. SMB3.11 disabled but required for POSIX extensions" even though CIFS Unix Extensions are supported for vers=1.0 This patch fixes the case where the user specifies both "unix" (or equivalently "posix" or "linux") and "vers=1.0" on mount to a server which supports the CIFS Unix Extensions. See attached From 6be36ee0acceef03ab61985786ca238a132721e6 Mon Sep 17 00:00:00 2001 From: Steve French Date: Tue, 23 Jul 2024 00:44:48 -0500 Subject: [PATCH] cifs: mount with "unix" mount option for SMB1 incorrectly handled Although by default we negotiate CIFS Unix Extensions for SMB1 mounts to Samba (and they work if the user does not specify "unix" or "posix" or "linux" on mount), and we do properly handle when a user turns them off with "nounix" mount parm. But with the changes to the mount API we broke cases where the user explicitly specifies the "unix" option (or equivalently "linux" or "posix") on mount with vers=1.0 to Samba or other servers which support the CIFS Unix Extensions. "mount error(95): Operation not supported" and logged: "CIFS: VFS: Check vers= mount option. SMB3.11 disabled but required for POSIX extensions" even though CIFS Unix Extensions are supported for vers=1.0 This patch fixes the case where the user specifies both "unix" (or equivalently "posix" or "linux") and "vers=1.0" on mount to a server which supports the CIFS Unix Extensions. Cc: stable@vger.kernel.org Signed-off-by: Steve French --- fs/smb/client/connect.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c index b66d8b03a389..c3d8d7b7b46a 100644 --- a/fs/smb/client/connect.c +++ b/fs/smb/client/connect.c @@ -2614,6 +2614,13 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb3_fs_context *ctx) cifs_dbg(VFS, "Server does not support mounting with posix SMB3.11 extensions\n"); rc = -EOPNOTSUPP; goto out_fail; + } else if (ses->server->vals->protocol_id == SMB10_PROT_ID) + if (cap_unix(ses)) + cifs_dbg(FYI, "Unix Extensions requested on SMB1 mount\n"); + else { + cifs_dbg(VFS, "SMB1 Unix Extensions not supported by server\n"); + rc = -EOPNOTSUPP; + goto out_fail; } else { cifs_dbg(VFS, "Check vers= mount option. SMB3.11 disabled but required for POSIX extensions\n"); -- 2.43.0