fix /proc/vmcore seek

Arnd Bergmann arnd at arndb.de
Fri Sep 3 07:45:50 EDT 2010


On Friday 03 September 2010, Ken'ichi Ohmichi wrote:
> Thank you for investigating.
> IIUC, this problem may happen if using "cp" command instead of
> makedumpfile.
> 
> Does the following method in generic_file_llseek_unlocked() fail ?
> Is inode->i_sb->s_maxbytes too small ?
> 
>      65         if (offset < 0 || offset > inode->i_sb->s_maxbytes)
>      66                 return -EINVAL;
> 

Yes, that is the main difference between generic_file_llseek and
default_llseek, besides the use of the BKL. We have discussed
changing this before, but so far without a conclusive answer.

If we can come up with a better test here, we might be able
to just kill default_llseek in favor of generic_file_llseek.

The problem is handling the special cases here. For a /proc file,
s_maxbytes is probably always zero, but that could be changed,
same for file systems using get_sb_single.
For some reason, get_sb_pseudo sets does set s_maxbytes while
get_sb_single/simple_fill_super does not.

Character devices are also special, because the s_maxbytes for
them AFAICT is the one from the file system holding the device,
so using generic_file_llseek would definitely be incorrect for them.

	Arnd



More information about the kexec mailing list