<p dir="ltr"><br>
On 01-Sep-2014 10:18 AM, "Pranay Srivastava" <<a href="mailto:pranjas@gmail.com">pranjas@gmail.com</a>> wrote:<br>
><br>
><br>
> On 30-Aug-2014 10:49 AM, "Joshi" <<a href="mailto:joshiiitr@gmail.com">joshiiitr@gmail.com</a>> wrote:<br>
> ><br>
> > I am trying to obtain file name at block layer level (above IO scheduler).<br>
> > At this level I receive bio structure, within which page pointers are kept.<br>
> ><br>
> > Thereby I do following to obtain the inode and dentry -<br>
> ><br>
> > struct inode *inode_ptr = page->mapping->host;<br>
> > if (inode_ptr != NULL)<br>
> > /* Access dentry i.e. i_dentry in the inode */<br>
> ><br>
><br>
> Are you doing this in readpage(s) or writepage(s) callback? If that's the case your page would be locked and dentry/inode wouldn't go away.<br>
><br>
> If you are doing something else then first make sure you do lock_page and proceed only if you get that page lock.<br>
><br>
> Second you can try dget and dput before you start working with dentry.<br>
><br>
> ><br>
> > This works usually. But problem is, inode and dentry may get released<br>
> > from inode and dentry cache at any time.<br>
> > While accessing inode/dentry I need to ensure that till the time I am<br>
> > accessing'em these structure remain valid in memory.<br>
> > Is it possible to ensure that? Which structures/locks I need to check<br>
> > for the purpose.<br>
><br>
> is this your observation from your test case? Can you explain your test case a bit.<br>
><br>
Have you seen d_alias and see if that can help you with filename?<br>
> ><br>
> > Appreciate any help.<br>
> ><br>
> > Thanks!<br>
> ><br>
> > --<br>
> > Joshi<br>
> ><br>
> > _______________________________________________<br>
> > Kernelnewbies mailing list<br>
> > <a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
> > <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</p>