If the positive dentry is known to be a reparse point already, save a roundtrip in ->query_path_info() by sending compound request with OPEN_REPARSE_POINT. Signed-off-by: Paulo Alcantara (SUSE) <pc@xxxxxxxxxxxxx> --- fs/smb/client/inode.c | 2 ++ fs/smb/client/smb2inode.c | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/fs/smb/client/inode.c b/fs/smb/client/inode.c index bd83b080b184..79240f1d252a 100644 --- a/fs/smb/client/inode.c +++ b/fs/smb/client/inode.c @@ -1142,6 +1142,8 @@ static int cifs_get_fattr(struct cifs_open_info_data *data, */ if (!data) { + if (*inode && CIFS_I(*inode)->reparse) + tmp_data.reparse_point = true; rc = server->ops->query_path_info(xid, tcon, cifs_sb, full_path, &tmp_data); data = &tmp_data; diff --git a/fs/smb/client/smb2inode.c b/fs/smb/client/smb2inode.c index 3e8ba41b790d..9d1b043b8356 100644 --- a/fs/smb/client/smb2inode.c +++ b/fs/smb/client/smb2inode.c @@ -667,7 +667,6 @@ int smb2_query_path_info(const unsigned int xid, int rc, rc2; data->adjust_tz = false; - data->reparse_point = false; if (strcmp(full_path, "")) rc = -ENOENT; @@ -689,6 +688,9 @@ int smb2_query_path_info(const unsigned int xid, in_iov[0].iov_len = sizeof(*data); in_iov[1] = in_iov[0]; + if (data->reparse_point) + goto open_reparse; + cifs_get_readable_path(tcon, full_path, &cfile); rc = smb2_compound_op(xid, tcon, cifs_sb, full_path, FILE_READ_ATTRIBUTES, FILE_OPEN, @@ -714,6 +716,7 @@ int smb2_query_path_info(const unsigned int xid, /* symlink already parsed in create response */ num_cmds = 1; } else { +open_reparse: cmds[1] = SMB2_OP_GET_REPARSE; num_cmds = 2; } @@ -766,8 +769,6 @@ int smb311_posix_query_path_info(const unsigned int xid, int i, num_cmds; data->adjust_tz = false; - data->reparse_point = false; - /* * BB TODO: Add support for using the cached root handle. * Create SMB2_query_posix_info worker function to do non-compounded query @@ -778,6 +779,9 @@ int smb311_posix_query_path_info(const unsigned int xid, in_iov[0].iov_len = sizeof(*data); in_iov[1] = in_iov[0]; + if (data->reparse_point) + goto open_reparse; + cifs_get_readable_path(tcon, full_path, &cfile); rc = smb2_compound_op(xid, tcon, cifs_sb, full_path, FILE_READ_ATTRIBUTES, FILE_OPEN, @@ -802,6 +806,7 @@ int smb311_posix_query_path_info(const unsigned int xid, /* symlink already parsed in create response */ num_cmds = 1; } else { +open_reparse: cmds[1] = SMB2_OP_GET_REPARSE; num_cmds = 2; } -- 2.43.0