LinuxQuestions.org
Review your favorite Linux distribution.
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-15-2023, 03:21 AM   #1
Dekel Nueman
LQ Newbie
 
Registered: May 2023
Posts: 1

Rep: Reputation: 0
calling kern_path during mount process


I'm trying to get devt of mountpoint (path*) in one of the LSM hooks. Assuming I have the following mount:

/dev/mmcblk0p5 is mounted to /mnt/photos

I would expect that calling

kern_path("/mnt/photos", ...)

will return a struct path with path.mnt->mnt_sb->s_dev = 0x0b300005 since /dev/mmcblk0p5 is 179:5, but I always get 0x0b300002 (i.e. 179:2) - which is the root-fs device. Only after mounting again /dev/mmcblk0p5 to /mnt/photos, kern_path returns 0x0b300005.

Why is that? How can I fix it?
It happens with both kernel 4.14 and 5.15.
 
Old 05-23-2023, 08:20 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,153

Rep: Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265Reputation: 1265
/mnt/photos is a real directory on your root filesystem. Mounting a different directory on top of it does not change that.

Maybe you want something like lookup_mnt. https://elixir.bootlin.com/linux/lat...mespace.c#L692
 
  


Reply



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
API for current running process details like process name, process id, amount of memory used anki123 Linux - General 1 01-20-2019 02:06 AM
vfork - suspends the calling process or the calling thread? zmau Linux - Software 3 04-21-2015 02:38 PM
Finding the Process ID of a Process While Initiating the Process senthilmuthiah Linux - Newbie 7 04-02-2009 10:37 AM
Mount. Umount. Mount. Umount. Mount. Umount. Mount.. cwizardone Slackware 10 03-22-2007 09:30 AM
odd recursion: calling "by hand" vs calling by cronscript... prx Programming 4 02-12-2005 04:59 PM

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

All times are GMT -5. The time now is 12:34 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