{"id":2224156,"url":"http://patchwork.ozlabs.org/api/patches/2224156/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260417001550.1301260-1-pc@manguebit.org/","project":{"id":12,"url":"http://patchwork.ozlabs.org/api/projects/12/?format=json","name":"Linux CIFS Client","link_name":"linux-cifs-client","list_id":"linux-cifs.vger.kernel.org","list_email":"linux-cifs@vger.kernel.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260417001550.1301260-1-pc@manguebit.org>","list_archive_url":null,"date":"2026-04-17T00:15:50","name":"smb: client: fix dir separator in SMB1 UNIX mounts","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"988a4b6bf1819097b36bd9c64d21e7659eb37154","submitter":{"id":91025,"url":"http://patchwork.ozlabs.org/api/people/91025/?format=json","name":"Paulo Alcantara","email":"pc@manguebit.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-cifs-client/patch/20260417001550.1301260-1-pc@manguebit.org/mbox/","series":[{"id":500218,"url":"http://patchwork.ozlabs.org/api/series/500218/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-cifs-client/list/?series=500218","date":"2026-04-17T00:15:50","name":"smb: client: fix dir separator in SMB1 UNIX mounts","version":1,"mbox":"http://patchwork.ozlabs.org/series/500218/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2224156/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2224156/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <linux-cifs+bounces-10881-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-cifs@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=manguebit.org header.i=@manguebit.org header.a=rsa-sha256\n header.s=dkim header.b=lMvcKvYX;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-cifs+bounces-10881-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=manguebit.org header.i=@manguebit.org\n header.b=\"lMvcKvYX\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=143.255.12.172","smtp.subspace.kernel.org;\n dmarc=pass (p=quarantine dis=none) header.from=manguebit.org","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=manguebit.org"],"Received":["from tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fxb5L0d7Hz1yD3\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 17 Apr 2026 10:16:05 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 1B8303019FDC\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 17 Apr 2026 00:16:02 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 2C1C663CB;\n\tFri, 17 Apr 2026 00:15:59 +0000 (UTC)","from mx1.manguebit.org (mx1.manguebit.org [143.255.12.172])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id B3AA940DFC0;\n\tFri, 17 Apr 2026 00:15:57 +0000 (UTC)","from pc by mx1.manguebit.org with local (Exim 4.99.1)\n\tid 1wDWsC-00000000J7g-1R9N;\n\tThu, 16 Apr 2026 21:15:52 -0300"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776384959; cv=none;\n b=Wqi2qzs/fI20veFg6JDkH8WN8AnPkyzIc9rxqP6s72su7lwiOlapCTnkF4fnJDyW1r5No+Qg0ZJygJKxVLmLXjuo+r2JjEy6RKbhtvjzHEP7VHg9kWy6vld3VShYw1IN3YXyuLlxFEhN3w4AH5BVVZkF+eOUcrSRxGTL8aqkHoA=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776384959; c=relaxed/simple;\n\tbh=GaLR26YMKHEpPTz6l7m9Ngr/Gvcz/0LL5V+80n4wqj0=;\n\th=From:To:Cc:Subject:Date:Message-ID:MIME-Version;\n b=RZWQfSow4h0tzbnZWKR1NRDfiHhwumLhuXewiUgLcDnpZ8ejv5V2e92HVq0/nnJT3lGqVfBSzHSxsWaNEGpNQ+0YhcdHA9XE7/y5txuYCVHT/+yUVh1V7J72H541PvZRcKdr3FDPKGzaxGT7g4QkXB2uq2deLei96BgUa3U7jMQ=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=quarantine dis=none) header.from=manguebit.org;\n spf=pass smtp.mailfrom=manguebit.org;\n dkim=pass (2048-bit key) header.d=manguebit.org header.i=@manguebit.org\n header.b=lMvcKvYX; arc=none smtp.client-ip=143.255.12.172","DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=manguebit.org; s=dkim; h=Content-Transfer-Encoding:MIME-Version:Message-ID:\n\tDate:Subject:Cc:To:From:Sender:Content-Type:Reply-To:Content-ID:\n\tContent-Description:In-Reply-To:References;\n\tbh=aRybrhZ3O2xQQ8KQ99MAu6C0wcCHqBdT1DKsr4ddO7E=; b=lMvcKvYXGVVqqbm/AES0fGaD2E\n\tB3/rc9We9KQOO4aM7grwrUZxgdpbyhU06XhTQKc5QSnXRGCSqHYHUy1i3inp9M/q16lhfQD2vCZ8y\n\tHTBE9lDzxFmrQTQcfi18TjPe9K4i6qGQHV9sXEpiGFMDJLeGkV4i3Cc3Bj9G+I6Wcj/BZPYOrDcDW\n\t68UrVid4KVS+v6u44El6kWafKgW2YM/fccURp0BZQcAw87gmBBqqkSlR2bzNXzydXpbt7HGZ4R2wD\n\tCzAnCDWFdBrPqz4pHovflblnqIs4MTkB/+YuXLoFUEKSJRI84ORxyh+FzRgAJTI9Af7BhwqYipwNB\n\tpAjldcFw==;","From":"Paulo Alcantara <pc@manguebit.org>","To":"Steve French <smfrench@gmail.com>","Cc":"\"Kris Karas (Bug Reporting)\" <bugs-a21@moonlit-rail.com>,\n\t\"Paulo Alcantara (Red Hat)\" <pc@manguebit.org>,\n\tDavid Howells <dhowells@redhat.com>,\n\tlinux-cifs@vger.kernel.org,\n\tstable@vger.kernel.org","Subject":"[PATCH] smb: client: fix dir separator in SMB1 UNIX mounts","Date":"Thu, 16 Apr 2026 21:15:50 -0300","Message-ID":"<20260417001550.1301260-1-pc@manguebit.org>","X-Mailer":"git-send-email 2.53.0","Precedence":"bulk","X-Mailing-List":"linux-cifs@vger.kernel.org","List-Id":"<linux-cifs.vger.kernel.org>","List-Subscribe":"<mailto:linux-cifs+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-cifs+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit"},"content":"When calling cifs_mount_get_tcon() with SMB1 UNIX mounts,\n@cifs_sb->mnt_cifs_flags needs to be read or updated only after\ncalling reset_cifs_unix_caps(), otherwise it might end up with missing\nCIFS_MOUNT_POSIXACL and CIFS_MOUNT_POSIX_PATHS bits.\n\nThis fixes the wrong dir separator used in paths caused by the missing\nCIFS_MOUNT_POSIX_PATHS bit in cifs_sb_info::mnt_cifs_flags.\n\nReported-by: \"Kris Karas (Bug Reporting)\" <bugs-a21@moonlit-rail.com>\nCloses: https://lore.kernel.org/r/f758f4ff-4d54-4244-931d-38f469c3ff14@moonlit-rail.com\nFixes: 4fc3a433c139 (\"smb: client: use atomic_t for mnt_cifs_flags\")\nSigned-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>\nCc: David Howells <dhowells@redhat.com>\nCc: linux-cifs@vger.kernel.org\nCc: stable@vger.kernel.org\n---\n fs/smb/client/connect.c | 10 +++++-----\n fs/smb/client/smb1ops.c | 19 ++++++++-----------\n 2 files changed, 13 insertions(+), 16 deletions(-)","diff":"diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c\nindex 69b38f0ccf2b..e9eeb9f8a561 100644\n--- a/fs/smb/client/connect.c\n+++ b/fs/smb/client/connect.c\n@@ -3610,7 +3610,6 @@ int cifs_mount_get_tcon(struct cifs_mount_ctx *mnt_ctx)\n \tserver = mnt_ctx->server;\n \tctx = mnt_ctx->fs_ctx;\n \tcifs_sb = mnt_ctx->cifs_sb;\n-\tsbflags = cifs_sb_flags(cifs_sb);\n \n \t/* search for existing tcon to this server share */\n \ttcon = cifs_get_tcon(mnt_ctx->ses, ctx);\n@@ -3625,9 +3624,10 @@ int cifs_mount_get_tcon(struct cifs_mount_ctx *mnt_ctx)\n \t * path (i.e., do not remap / and \\ and do not map any special characters)\n \t */\n \tif (tcon->posix_extensions) {\n-\t\tsbflags |= CIFS_MOUNT_POSIX_PATHS;\n-\t\tsbflags &= ~(CIFS_MOUNT_MAP_SFM_CHR |\n-\t\t\t     CIFS_MOUNT_MAP_SPECIAL_CHR);\n+\t\tatomic_or(CIFS_MOUNT_POSIX_PATHS, &cifs_sb->mnt_cifs_flags);\n+\t\tatomic_andnot(CIFS_MOUNT_MAP_SFM_CHR |\n+\t\t\t      CIFS_MOUNT_MAP_SPECIAL_CHR,\n+\t\t\t      &cifs_sb->mnt_cifs_flags);\n \t}\n \n #ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY\n@@ -3651,6 +3651,7 @@ int cifs_mount_get_tcon(struct cifs_mount_ctx *mnt_ctx)\n #endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */\n \t\ttcon->unix_ext = 0; /* server does not support them */\n \n+\tsbflags = cifs_sb_flags(cifs_sb);\n \t/* do not care if a following call succeed - informational */\n \tif (!tcon->pipe && server->ops->qfs_tcon) {\n \t\tserver->ops->qfs_tcon(mnt_ctx->xid, tcon, cifs_sb);\n@@ -3675,7 +3676,6 @@ int cifs_mount_get_tcon(struct cifs_mount_ctx *mnt_ctx)\n \n out:\n \tmnt_ctx->tcon = tcon;\n-\tatomic_set(&cifs_sb->mnt_cifs_flags, sbflags);\n \treturn rc;\n }\n \ndiff --git a/fs/smb/client/smb1ops.c b/fs/smb/client/smb1ops.c\nindex 9694117050a6..e198e3dda917 100644\n--- a/fs/smb/client/smb1ops.c\n+++ b/fs/smb/client/smb1ops.c\n@@ -49,7 +49,6 @@ void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon,\n \n \tif (!CIFSSMBQFSUnixInfo(xid, tcon)) {\n \t\t__u64 cap = le64_to_cpu(tcon->fsUnixInfo.Capability);\n-\t\tunsigned int sbflags;\n \n \t\tcifs_dbg(FYI, \"unix caps which server supports %lld\\n\", cap);\n \t\t/*\n@@ -76,29 +75,27 @@ void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon,\n \t\tif (cap & CIFS_UNIX_TRANSPORT_ENCRYPTION_MANDATORY_CAP)\n \t\t\tcifs_dbg(VFS, \"per-share encryption not supported yet\\n\");\n \n-\t\tif (cifs_sb)\n-\t\t\tsbflags = cifs_sb_flags(cifs_sb);\n-\n \t\tcap &= CIFS_UNIX_CAP_MASK;\n \t\tif (ctx && ctx->no_psx_acl)\n \t\t\tcap &= ~CIFS_UNIX_POSIX_ACL_CAP;\n \t\telse if (CIFS_UNIX_POSIX_ACL_CAP & cap) {\n \t\t\tcifs_dbg(FYI, \"negotiated posix acl support\\n\");\n-\t\t\tif (cifs_sb)\n-\t\t\t\tsbflags |= CIFS_MOUNT_POSIXACL;\n+\t\t\tif (cifs_sb) {\n+\t\t\t\tatomic_or(CIFS_MOUNT_POSIXACL,\n+\t\t\t\t\t  &cifs_sb->mnt_cifs_flags);\n+\t\t\t}\n \t\t}\n \n \t\tif (ctx && ctx->posix_paths == 0)\n \t\t\tcap &= ~CIFS_UNIX_POSIX_PATHNAMES_CAP;\n \t\telse if (cap & CIFS_UNIX_POSIX_PATHNAMES_CAP) {\n \t\t\tcifs_dbg(FYI, \"negotiate posix pathnames\\n\");\n-\t\t\tif (cifs_sb)\n-\t\t\t\tsbflags |= CIFS_MOUNT_POSIX_PATHS;\n+\t\t\tif (cifs_sb) {\n+\t\t\t\tatomic_or(CIFS_MOUNT_POSIX_PATHS,\n+\t\t\t\t\t  &cifs_sb->mnt_cifs_flags);\n+\t\t\t}\n \t\t}\n \n-\t\tif (cifs_sb)\n-\t\t\tatomic_set(&cifs_sb->mnt_cifs_flags, sbflags);\n-\n \t\tcifs_dbg(FYI, \"Negotiate caps 0x%x\\n\", (int)cap);\n #ifdef CONFIG_CIFS_DEBUG2\n \t\tif (cap & CIFS_UNIX_FCNTL_CAP)\n","prefixes":[]}