From: Paulo Alcantara <pc@manguebit.com>
To: "Steinbeißer, Sebastian" <Sebastian.Steinbeisser@lrz.de>,
"tom@talpey.com" <tom@talpey.com>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
Cc: "smfrench@gmail.com" <smfrench@gmail.com>,
"regressions@lists.linux.dev" <regressions@lists.linux.dev>
Subject: Re: Potential smb/dfs regression introduced in kernel 6.6
Date: Tue, 30 Jul 2024 23:35:45 -0300 [thread overview]
Message-ID: <ac58f36e10af65cd672fba66e99faa2c@manguebit.com> (raw)
In-Reply-To: <aed542086314197bcec6a50c7d6ee76cb6e65f96.camel@lrz.de>
[-- Attachment #1: Type: text/plain, Size: 246 bytes --]
Hi Sebastian,
Steinbeißer, Sebastian <Sebastian.Steinbeisser@lrz.de> writes:
> Find the logs attached.
Thanks.
Could you please try the attached patch instead?
Whether it works or not, please provide new network traces and logs.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-smb-client-handle-lack-of-FSCTL_GET_REPARSE_POINT-su.patch --]
[-- Type: text/x-patch, Size: 4169 bytes --]
From 667667048d5f2762689b19d8f2e99e3858abf259 Mon Sep 17 00:00:00 2001
From: Paulo Alcantara <pc@manguebit.com>
Date: Tue, 30 Jul 2024 23:07:45 -0300
Subject: [PATCH] smb: client: handle lack of FSCTL_GET_REPARSE_POINT support
As per MS-FSA 2.1.5.10.14, support for FSCTL_GET_REPARSE_POINT is
optional and if the server doesn't support it,
STATUS_INVALID_DEVICE_REQUEST must be returned for the operation.
If we find files with reparse points and we can't parse them due to
lack of client or server support, just ignore it and then treat them
as regular files or junctions.
Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
---
fs/smb/client/inode.c | 17 +++++++++++++++--
fs/smb/client/reparse.c | 4 ++++
fs/smb/client/reparse.h | 19 +++++++++++++++++--
fs/smb/client/smb2inode.c | 2 ++
4 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c
index 4a8aa1de9522..dd0afa23734c 100644
--- a/fs/smb/client/inode.c
+++ b/fs/smb/client/inode.c
@@ -1042,13 +1042,26 @@ static int reparse_info_to_fattr(struct cifs_open_info_data *data,
}
rc = -EOPNOTSUPP;
- switch ((data->reparse.tag = tag)) {
- case 0: /* SMB1 symlink */
+ data->reparse.tag = tag;
+ if (!data->reparse.tag) {
if (server->ops->query_symlink) {
rc = server->ops->query_symlink(xid, tcon,
cifs_sb, full_path,
&data->symlink_target);
}
+ if (rc == -EOPNOTSUPP)
+ data->reparse.tag = IO_REPARSE_TAG_INTERNAL;
+ }
+
+ switch (data->reparse.tag) {
+ case 0: /* SMB1 symlink */
+ break;
+ case IO_REPARSE_TAG_INTERNAL:
+ rc = 0;
+ if (le32_to_cpu(data->fi.Attributes) & ATTR_DIRECTORY) {
+ cifs_create_junction_fattr(fattr, sb);
+ goto out;
+ }
break;
case IO_REPARSE_TAG_MOUNT_POINT:
cifs_create_junction_fattr(fattr, sb);
diff --git a/fs/smb/client/reparse.c b/fs/smb/client/reparse.c
index a0ffbda90733..689d8a506d45 100644
--- a/fs/smb/client/reparse.c
+++ b/fs/smb/client/reparse.c
@@ -505,6 +505,10 @@ bool cifs_reparse_point_to_fattr(struct cifs_sb_info *cifs_sb,
}
switch (tag) {
+ case IO_REPARSE_TAG_INTERNAL:
+ if (!(fattr->cf_cifsattrs & ATTR_DIRECTORY))
+ return false;
+ fallthrough;
case IO_REPARSE_TAG_DFS:
case IO_REPARSE_TAG_DFSR:
case IO_REPARSE_TAG_MOUNT_POINT:
diff --git a/fs/smb/client/reparse.h b/fs/smb/client/reparse.h
index 6b55d1df9e2f..2c0644bc4e65 100644
--- a/fs/smb/client/reparse.h
+++ b/fs/smb/client/reparse.h
@@ -12,6 +12,12 @@
#include "fs_context.h"
#include "cifsglob.h"
+/*
+ * Used only by cifs.ko to ignore reparse points from files when client or
+ * server doesn't support FSCTL_GET_REPARSE_POINT.
+ */
+#define IO_REPARSE_TAG_INTERNAL ((__u32)~0U)
+
static inline dev_t reparse_nfs_mkdev(struct reparse_posix_data *buf)
{
u64 v = le64_to_cpu(*(__le64 *)buf->DataBuffer);
@@ -78,10 +84,19 @@ static inline u32 reparse_mode_wsl_tag(mode_t mode)
static inline bool reparse_inode_match(struct inode *inode,
struct cifs_fattr *fattr)
{
+ struct cifsInodeInfo *cinode = CIFS_I(inode);
struct timespec64 ctime = inode_get_ctime(inode);
- return (CIFS_I(inode)->cifsAttrs & ATTR_REPARSE) &&
- CIFS_I(inode)->reparse_tag == fattr->cf_cifstag &&
+ /*
+ * Do not match reparse tags when client or server doesn't support
+ * FSCTL_GET_REPARSE_POINT. @fattr->cf_cifstag should contain correct
+ * reparse tag from query dir response but the client won't be able to
+ * read the reparse point data anyway. This spares us a revalidation.
+ */
+ if (cinode->reparse_tag != IO_REPARSE_TAG_INTERNAL &&
+ cinode->reparse_tag != fattr->cf_cifstag)
+ return false;
+ return (cinode->cifsAttrs & ATTR_REPARSE) &&
timespec64_equal(&ctime, &fattr->cf_ctime);
}
diff --git a/fs/smb/client/smb2inode.c b/fs/smb/client/smb2inode.c
index 5c02a12251c8..062b86a4936f 100644
--- a/fs/smb/client/smb2inode.c
+++ b/fs/smb/client/smb2inode.c
@@ -930,6 +930,8 @@ int smb2_query_path_info(const unsigned int xid,
switch (rc) {
case 0:
+ rc = parse_create_response(data, cifs_sb, &out_iov[0]);
+ break;
case -EOPNOTSUPP:
/*
* BB TODO: When support for special files added to Samba
--
2.45.2
next prev parent reply other threads:[~2024-07-31 2:35 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-27 13:28 Potential smb/dfs regression introduced in kernel 6.6 Steinbeißer, Sebastian
2024-06-27 13:37 ` Greg KH
[not found] ` <f3a02647b6fcb27a70da4c334930ad3c@manguebit.com>
2024-06-28 8:19 ` Steinbeißer, Sebastian
2024-07-11 6:20 ` Steinbeißer, Sebastian
2024-07-11 7:27 ` gregkh
2024-07-11 15:20 ` Christian Heusel
2024-07-14 19:12 ` Paulo Alcantara
2024-07-15 5:41 ` Steinbeißer, Sebastian
2024-07-15 12:21 ` Paulo Alcantara
2024-07-15 13:26 ` Steinbeißer, Sebastian
2024-07-15 14:24 ` Paulo Alcantara
2024-07-16 6:14 ` Steinbeißer, Sebastian
2024-07-17 18:24 ` Paulo Alcantara
2024-07-17 20:03 ` Tom Talpey
2024-07-18 5:43 ` Steinbeißer, Sebastian
2024-07-25 1:28 ` Paulo Alcantara
2024-07-26 8:19 ` Steinbeißer, Sebastian
2024-07-26 18:00 ` Paulo Alcantara
2024-07-29 5:57 ` Steinbeißer, Sebastian
2024-07-29 12:34 ` Paulo Alcantara
2024-07-30 5:25 ` Steinbeißer, Sebastian
2024-07-31 2:35 ` Paulo Alcantara [this message]
2024-07-31 5:02 ` Steinbeißer, Sebastian
2024-07-31 5:07 ` Steinbeißer, Sebastian
2024-07-31 14:25 ` Paulo Alcantara
2024-08-01 13:07 ` Steinbeißer, Sebastian
2024-08-01 16:25 ` Paulo Alcantara
2024-08-01 19:02 ` Tom Talpey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ac58f36e10af65cd672fba66e99faa2c@manguebit.com \
--to=pc@manguebit.com \
--cc=Sebastian.Steinbeisser@lrz.de \
--cc=gregkh@linuxfoundation.org \
--cc=regressions@lists.linux.dev \
--cc=smfrench@gmail.com \
--cc=tom@talpey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.