> If I've understood sys_swapon() correctly, there is no increment
> of inode's usage counter if swapping goes to regular file. If this
> assumption is correct, it is definitely a bug. If it is wrong, please
> tell me why :)
No, sys_swapon is fine, because namei() increments the inode's i_count.
> This was inspired by report of someone who was able to crash
> system just by removing active swap file.
Hmm... strange. I'm unable to replicate this behavior, and the space used
by the swapfile does _not_ get deallocated when the file is unlinked.
However, there is a (small) problem here: since the swapoff procedure is
filename-based and there is no way to reference an unlinked file by
filename, you can't swapoff that file.
Correcting this problem implies changing the parameters for sys_swapoff,
which I definitely don't want to do.
Ionut
-- It is better to keep your mouth shut and be thought a fool, than to open it and remove all doubt.