Re: [RFC PATCH 1/6] fs/9p: Add ability to identify inode by path for .L
From: Al Viro <viro@zeniv.linux.org.uk>
Date: 2025-07-05 00:19:19
Also in:
linux-fsdevel, v9fs
From: Al Viro <viro@zeniv.linux.org.uk>
Date: 2025-07-05 00:19:19
Also in:
linux-fsdevel, v9fs
On Sun, Apr 06, 2025 at 09:43:02PM +0100, Tingmao Wang wrote:
+struct v9fs_ino_path *make_ino_path(struct dentry *dentry)
+{
+ struct v9fs_ino_path *path;
+ size_t path_components = 0;
+ struct dentry *curr = dentry;
+ ssize_t i;
+
+ lockdep_assert_held_read(&v9fs_dentry2v9ses(dentry)->rename_sem);
+
+ rcu_read_lock();
+
+ /* Don't include the root dentry */
+ while (curr->d_parent != curr) {
+ path_components++;
+ curr = curr->d_parent;
+ }
+ if (WARN_ON(path_components > SSIZE_MAX)) {
+ rcu_read_unlock();
+ return NULL;
+ }
+
+ path = kmalloc(struct_size(path, names, path_components),
+ GFP_KERNEL);Blocking allocation under rcu_read_lock().