Re: chmod of active swap file blocks

From: Andrew Morton
Date: Mon Dec 29 2003 - 04:33:40 EST


Paul Jakma <paul@xxxxxxxx> wrote:
>
> Hi,
>
> Trying to chmod a file being used for swap causes chmod() to block,
> with permissions change /not/ having taken effect, until the swap
> file is swapoff'd, at which point chmod() carries on and chmod (the
> command) finishes.

The kernel holds the swapfile's i_sem while it is in use. This is to
prevent the filesystem destruction which would result if some silly person
were to truncate a swapfile while it was in active use.

It is not a particularly important safety feature ("don't do that") and it
can be taken out if it is causing serious side-effects.

Is chmod of an in-use swapfile an important thing to be able to do?
-
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/