Checking if a Buffer head is valid or not

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I've a question regarding how to check if a buffer head is valid.
Suppose that I've read  in a block using sb_bread and that buffer head
hasn't been touched in a while so that it's uptodate.

Now suppose that somebody drops the caches from user space. I looked
at the code and found the following,

Beginning from drop_caches_sysctl_handler

--->iterate_supers
     ---->drop_pagecache_sb
             --->invalidate_mapping_pages
                   ---->invalidate_inode_page
                          --->invalidate_complete_page
                               --->try_to_release_page

In the try_to_release_page there's call to try_to_free_buffers

Now since i would be having a pointer to the buffer head which is
already uptodate and nothing going on with it this would actually free
the buffer. There's a call to kmem_cache_free, so i would be left with
a pointer which is invalid [Correct?]

Now how do I check if i need to re-read this buffer from disk since
the pointer is actually not valid anymore so checking for bh_uptodate
doesn't make sense. Reading the buffer from disk always isn't
something i'm looking for so any advice on how to check it?

Regards,
Pranay Kr. Srivastava

-- 
Pranay Srivastava

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux