Re: rfc: handle broken /proc/swaps

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

 



On Tuesday 13 October 2009 05:27:19 Karel Zak wrote:
> On Sat, Oct 10, 2009 at 11:34:18PM -0400, Mike Frysinger wrote:
> > i dont see any mention of this issue in the util-linux-ng archives (or i
> > cant search), but linux-2.6.19 and older had a bug in the /proc/swaps
> > code where
> 
>  yeah, I have never seen this problem.

i used to see it every once in a while when i was running older kernels, but 
whenever i looked into it, the issue wouldnt reproduce itself.  googling for 
the error message shows that many people used to hit it from time to time.

> > the header would not be displayed (the first line).  most people report
> > the issue as a sequence of swapon/swapoff calls to trigger, but for some
> > "lucky" reason it triggers for me all the time (no swap calls).
> >
> > there are two aspects to the issue ... the first of which i think we
> > should handle while i'm on the fence about the second.
> >
> > first, i dont think we should whine about unexpected format if the file
> > is empty (the default at boot).  this is easy to do by putting the
> > warning behind a check to ferror().
> 
>  The file is empty for kernel <= 2.6.19, right? It seems that the
>  current mm/swapfile.c implementation always returns the header line.

the header line was semi-often missing for <=2.6.19.  so during boot it'd be 
empty (and yield the aforementioned error message), but after adding at least 
one swap file, sometimes the first line would be lost due to the current 
parsing.

> > second, we could detect that the first line we read isnt actually the
> > header but instead is a valid swap line and so needs processing.  this
> > relies on the assumption that the first line will always be the same
> > format.  looking quickly at older versions shows that this header has
> > retained its exact format since at least linux-2.2.0 and considering the
> > concern that goes along with /proc/ files and the ABI, it's highly
> > unlikely it will ever change.
> 
>  OK. Please, send a real patch :-)

rgr
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux