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. |
/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 |
All times are GMT -5. The time now is 06:10 AM. |