LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 05-12-2024, 01:16 PM   #1
Pravin Shedage
LQ Newbie
 
Registered: Jun 2008
Posts: 2

Rep: Reputation: 0
Question How to call path_has_submounts(struct path *path) if I have dentry as a input


I was writing kernel module in which I am trying to find out the current dentry is of sub-mount or not using function path_has_submounts().
I am using Ubuntu24.04 6.8 linux kernel.

int test_submount(struct dentry *dentry)
{
struct path path;
path.dentry = dentry;
path.mnt = ? // how to convert dentry to vfsmount

return path_has_submounts(&path);
}

Solution I get which is not possible because struct namespace is private to VFS fs/mount.h

struct path path;
path.dentry = parent;
path.mnt = NULL;

struct mnt_namespace *ns = current->nsproxy->mnt_ns;
struct rb_root *tree = &ns->mounts;
struct mount *l_mount, *n;
bool is_covered = false;

down_read(&namespace_sem);
rbtree_postorder_for_each_entry_safe(l_mount, n, tree, mnt_node) {
is_covered = (l_mount->mnt_mountpoint == parent);
if (is_covered) {
path.mnt = l_mount->mnt;
break;
}
}
up_read(&namespace_sem);

ret = path_has_submounts(&path);

You help or any pointer is really helpful to compile and successfully test submounts in 6.8 kernel.

Last edited by Pravin Shedage; 05-12-2024 at 01:19 PM.
 
  


Reply

Tags
filesystems, kernel 5.15, mount point, vfs



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Does the qstr struct in a kernel dentry hold the filename of a Linux file? dlevy022 Linux - Kernel 1 12-24-2015 07:54 AM
Some questions about struct dentry involved with list ao.yuan.young Linux - Kernel 1 05-31-2009 08:08 PM
Some questions about struct dentry involved with list ao.yuan.young Linux - Kernel 1 05-31-2009 02:52 AM
GCC compile problem:struct A have a member variable which is just a struct type name? leon.zcom Programming 3 04-18-2008 04:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 11:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration