Re: 2.6.1: kernel BUG at mm/swapfile.c:806

From: Andrew Morton
Date: Fri Jan 16 2004 - 13:46:34 EST


Mike Fedyk <mfedyk@xxxxxxxxxxxxx> wrote:
>
> On Fri, Jan 16, 2004 at 05:05:55PM +0000, Hugh Dickins wrote:
> > On Fri, 16 Jan 2004, marcel cotta wrote:
> > > i just tried to less it - the process went right into D state :p
> >
> > That sounds like an issue that came up a month or two back: seems that
> > sys_swapon intentionally leaves a semaphore down on a swapfile, until
> > sys_swapoff. I don't like that at all! The noble reason was to stop
> > that file from being deleted or truncated while in use for swap,
> > but perhaps we can devise a better way to achieve that sometime -
> > set S_IMMUTABLE?
>
> Can't the kernel just keep a reference to the inode while it is used for
> swap, and let it unlink after swapoff (and all other refs are gone) using
> normal unix semantics?

Unlink is not the problem. The problem is truncation. swapon holds i_sem
to prevent people from adding or removing blocks while the swapfile is in
use.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/