Re: [PATCH] swapon: handle <=linux-2.6.19 bug in /proc/swaps

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

 



On Tue, Oct 13, 2009 at 06:05:19AM -0400, Mike Frysinger wrote:
> Linux <=2.6.19 contained a bug in the /proc/swaps code where 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 people,
> it triggers all the time at initial boot.  Since this throws up an error,
> init systems don't actually activate any swap files.
> 
> First, swapon shouldn't 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().
> 
> Second, we can detect that the first line isn't actually the header but
> instead is a valid swap line and so need to be processed.  This assumes
> 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.
> 
> Signed-off-by: Mike Frysinger <vapier@xxxxxxxxxx>
> ---
>  mount/swapon.c |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)

 Applied, thanks.

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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