How to safely access inode/dentry obtained from struct page *?

Joshi joshiiitr at gmail.com
Wed Sep 3 13:07:26 EDT 2014


On Mon, Sep 1, 2014 at 9:40 AM,  <Valdis.Kletnieks at vt.edu> wrote:
> On Sat, 30 Aug 2014 10:41:16 +0530, Joshi said:
>> I am trying to obtain file name at block layer level (above IO scheduler).
>
> Nope.  Won't work.  There is no single unique name for a file.
>
> Consider:
>
> touch a
> ln a b
>
> There's now 2 names for the same inode.

Yes, I ignore hard-link case. No harm.

> And why should the block level care about the file name, anyhow?  It doesn't
> even know if it's a file or metadata... or even if there's a filesystem
> on the partition at all.....

I do this only when I know that I am working on a partition which has filesystem
If it's metadata, file name is not associated with it. Either I would
find inode or dentry as NULL, that's all.
I just want to eliminate the possibility of crash while accessing
inode/dentry if it exists.


-- 
Joshi



More information about the Kernelnewbies mailing list