Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2781109rdb; Mon, 12 Feb 2024 17:11:09 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXGJgSK1W8PY9JpEGd2qUg930DPA+tzcXZb09WAV2s6m3NbVRR3GqLJgh9QJMYhMGNxPLSNuDB0oj2o3G1bO8j3Yy+/iPm2+/Dt/1PP+g== X-Google-Smtp-Source: AGHT+IGcYDJmfCfimlazfYSdlrp/O1nrb/xXtc3W6GcYhkKi/If7s8aAJctUHMHFi71nNaijtVWk X-Received: by 2002:a17:90a:157:b0:290:6b49:e6b6 with SMTP id z23-20020a17090a015700b002906b49e6b6mr5357767pje.25.1707786669728; Mon, 12 Feb 2024 17:11:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707786669; cv=pass; d=google.com; s=arc-20160816; b=slWcb3Ynt0iKAXv5OJ5pPJS/2q/FhjxqV5uBsfI6oerAgKuiEKnMj5GgBP1JoxJm4s MjQoB4un09GtKe4wP7F1DjVG/Ast1EtOqHa+X1gLhQa6SrtOzvztWGAN7RZH+Ftgf2IW huEUEjboqOgY6DEfH8YVZiPWh0edhFhTQz6jkjxYwyfTHR4FFcsE+RMJf/srj6nYBIxh 1U1TOv0zGcys9qzdeO6sXdkfxyrUAptrK6jX1gnaB6lUPmc/tZnmAVInvmk3mNy5lFUg ht8Q73gleosEjVvUeePCQVd2R0pDD/0qA6EgmiJ5jZ4K6e8Y5ru2Wh/P8gwMDoSsKZPu kZyg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=bTGsy0dzkom/85+sOB5269MkY5OGIdqd/t1OEcqGTN8=; fh=LTLV/WFW9ETBoKwrjML5ztSfJ2OOzRGhw/QWFHStdBw=; b=EUXfcuhkM2bEdvVKhci1YqEkDxSbzHkM5hy0Wk0Ul31xF+jzO9Jp8nuKCKulMkvTkW 4fCMJIf8ZNGmdFIPPfMBuA2mJL8E7jt3nGRhwMDRcpxEGa2h+zcmvNw1+Bj6BvLYfH1r 07+4cOXvlbro3xGZQS8e8VIPScM8wehL/wnV9q5/BjO881VJ4U/n+H1Z7LdisdZCJEuS RrAdQPF7ce5nniNyOfoMGKHgpFZvHR2UV2O5px1TPgwY8HOkWOJwLQBN3BzIqJ+BMSl+ exd8VIXR63en8jDyI//H2pzWYnfh5Obzc6ONuAPPgCH23P5Q6ugLU1Uq+tiwvaKqw8W1 fqAA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="MtSd0z/2"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-62710-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62710-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCVLaH4K3UmTcWvE35NgYSJw2i2uD5Aiq94EphzbZdMDcBhWMNF0ggmWZpuLEbIHY3WvscIx5LZUNUlrlR2tdKBeVfkxvArqZ38RVCq4vg== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id b9-20020a17090a9bc900b0029898dc0b1bsi840817pjw.116.2024.02.12.17.11.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 17:11:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62710-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="MtSd0z/2"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-62710-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62710-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 5E23CB234E9 for ; Tue, 13 Feb 2024 00:57:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ED4D883A19; Tue, 13 Feb 2024 00:23:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MtSd0z/2" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0BDA322EE4; Tue, 13 Feb 2024 00:23:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707783801; cv=none; b=HoUgZUjDG+IsR6cA5zsX6Ho1TFc5VfsqAxnac3YsBcT6vaG8lG0M7M37u597qIK16GTlp11wvJC5cg7l6qQ+rp8g9l1grzbY7/cvNghkt9rMZyjkX73a02S6i3O2oPh/LjywU3OmFtBFOjP5Fe9gZWoekv8eO0iwLEyql//d0y8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707783801; c=relaxed/simple; bh=lg8Lw1w8lD303Ba5+M9irf+AqfB0Qx21xaSCyNWgxDE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IJSGiEP4xcb1R8FrqrM9BPsqkdIOLn6013n9qHW7PuUvCnwaZsZ3TAvuBwN/IIZJcB6s03M8TI3OPy2MFlJ3938rkEOnwKq+zxUVfgARK6s3aGWbBmcRov/VU2n+8/Yv2mcuNcxAh84PDgveryhjVHm6N/SlA+rjO2rgfXB94Eg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MtSd0z/2; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9A5EC43394; Tue, 13 Feb 2024 00:23:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707783800; bh=lg8Lw1w8lD303Ba5+M9irf+AqfB0Qx21xaSCyNWgxDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MtSd0z/2aQ6s/YeK1r7KoMxj1nvORARCv1jZWuB86Iwo++8l6zgPvBUoDZzv6tcjq EElqJLlsuIiu63uLnwH7l2n5Eyv9HfNQYCjWX0RjRtxbNqUdKCZVr9jcBGmLiyKvB7 5xwqkYQv58/OnwYWLH6YJHjXO8nFxxAyAqUBqXnqKrqzRUWqWBjWh6IZbgVqqxUr09 jHtOsZ8plsCeaS1YNVN2UAk8zikgozlEU6VYtwscX9baw+CFGx1C4v/tP6rJMvMK+X y9jaUkCBTQlVwmKrVG1yY8kljfaE9B5x7hP0LBcI2hEFAd++J7TyQNGvmTQQFhinHA vc5WS3otmsv0A== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Paulo Alcantara , Steve French , Sasha Levin , sfrench@samba.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org Subject: [PATCH AUTOSEL 6.1 26/28] smb: client: set correct d_type for reparse points under DFS mounts Date: Mon, 12 Feb 2024 19:22:24 -0500 Message-ID: <20240213002235.671934-26-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240213002235.671934-1-sashal@kernel.org> References: <20240213002235.671934-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.1.77 Content-Transfer-Encoding: 8bit From: Paulo Alcantara [ Upstream commit 55c7788c37242702868bfac7861cdf0c358d6c3d ] Send query dir requests with an info level of SMB_FIND_FILE_FULL_DIRECTORY_INFO rather than SMB_FIND_FILE_DIRECTORY_INFO when the client is generating its own inode numbers (e.g. noserverino) so that reparse tags still can be parsed directly from the responses, but server won't send UniqueId (server inode number) Signed-off-by: Paulo Alcantara Signed-off-by: Steve French Signed-off-by: Sasha Levin --- fs/smb/client/readdir.c | 15 ++++++++------- fs/smb/client/smb2pdu.c | 6 ++++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/fs/smb/client/readdir.c b/fs/smb/client/readdir.c index 2d75ba5aaa8a..5990bdbae598 100644 --- a/fs/smb/client/readdir.c +++ b/fs/smb/client/readdir.c @@ -304,14 +304,16 @@ cifs_dir_info_to_fattr(struct cifs_fattr *fattr, FILE_DIRECTORY_INFO *info, } static void cifs_fulldir_info_to_fattr(struct cifs_fattr *fattr, - SEARCH_ID_FULL_DIR_INFO *info, + const void *info, struct cifs_sb_info *cifs_sb) { + const FILE_FULL_DIRECTORY_INFO *di = info; + __dir_info_to_fattr(fattr, info); - /* See MS-FSCC 2.4.19 FileIdFullDirectoryInformation */ + /* See MS-FSCC 2.4.14, 2.4.19 */ if (fattr->cf_cifsattrs & ATTR_REPARSE) - fattr->cf_cifstag = le32_to_cpu(info->EaSize); + fattr->cf_cifstag = le32_to_cpu(di->EaSize); cifs_fill_common_info(fattr, cifs_sb); } @@ -425,7 +427,7 @@ _initiate_cifs_search(const unsigned int xid, struct file *file, } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { cifsFile->srch_inf.info_level = SMB_FIND_FILE_ID_FULL_DIR_INFO; } else /* not srvinos - BB fixme add check for backlevel? */ { - cifsFile->srch_inf.info_level = SMB_FIND_FILE_DIRECTORY_INFO; + cifsFile->srch_inf.info_level = SMB_FIND_FILE_FULL_DIRECTORY_INFO; } search_flags = CIFS_SEARCH_CLOSE_AT_END | CIFS_SEARCH_RETURN_RESUME; @@ -1019,10 +1021,9 @@ static int cifs_filldir(char *find_entry, struct file *file, (FIND_FILE_STANDARD_INFO *)find_entry, cifs_sb); break; + case SMB_FIND_FILE_FULL_DIRECTORY_INFO: case SMB_FIND_FILE_ID_FULL_DIR_INFO: - cifs_fulldir_info_to_fattr(&fattr, - (SEARCH_ID_FULL_DIR_INFO *)find_entry, - cifs_sb); + cifs_fulldir_info_to_fattr(&fattr, find_entry, cifs_sb); break; default: cifs_dir_info_to_fattr(&fattr, diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c index e65f998ea4cf..f760189dd870 100644 --- a/fs/smb/client/smb2pdu.c +++ b/fs/smb/client/smb2pdu.c @@ -4991,6 +4991,9 @@ int SMB2_query_directory_init(const unsigned int xid, case SMB_FIND_FILE_POSIX_INFO: req->FileInformationClass = SMB_FIND_FILE_POSIX_INFO; break; + case SMB_FIND_FILE_FULL_DIRECTORY_INFO: + req->FileInformationClass = FILE_FULL_DIRECTORY_INFORMATION; + break; default: cifs_tcon_dbg(VFS, "info level %u isn't supported\n", info_level); @@ -5060,6 +5063,9 @@ smb2_parse_query_directory(struct cifs_tcon *tcon, /* note that posix payload are variable size */ info_buf_size = sizeof(struct smb2_posix_info); break; + case SMB_FIND_FILE_FULL_DIRECTORY_INFO: + info_buf_size = sizeof(FILE_FULL_DIRECTORY_INFO); + break; default: cifs_tcon_dbg(VFS, "info level %u isn't supported\n", srch_inf->info_level); -- 2.43.0