Re: no way to swapoff a deleted swap file?

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Willy Tarreau
Date: Friday, October 17, 2008 - 10:18 pm

On Fri, Oct 17, 2008 at 09:31:17PM -0300, Peter Cordes wrote:

(...)
I have another idea which might be simpler to implement in userspace.
What happened to you is a typical accident, you did not run on purpose
on a deleted swap file. So we should at least ensure that such types
of accidents could not happen easily.

If swapon did set the immutable bit on a file just after enabling swap
to it, it would at least prevent accidental removal of that file. Swapoff
would have to clean that bit, and swapon would have to clean it upon
startup too (in case of unplanned reboots).

That way, you could still remove such files on purpose provided you do
a preliminary "chattr -i" on them, but "rm -rf" would keep them intact.
It would also prevent accidental modifications, such as "ls .>swapfile"
instead of "ls ./swapfile".

Regards,
Willy

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: no way to swapoff a deleted swap file?, Bodo Eggert, (Fri Oct 17, 1:20 am)
Re: no way to swapoff a deleted swap file?, Hugh Dickins, (Fri Oct 17, 5:17 am)
Re: no way to swapoff a deleted swap file?, David Newall, (Fri Oct 17, 5:36 am)
Re: no way to swapoff a deleted swap file?, Bodo Eggert, (Fri Oct 17, 3:42 pm)
Re: no way to swapoff a deleted swap file?, Peter Cordes, (Fri Oct 17, 5:31 pm)
Re: no way to swapoff a deleted swap file?, Willy Tarreau, (Fri Oct 17, 10:18 pm)
Re: no way to swapoff a deleted swap file?, Hugh Dickins, (Sat Oct 18, 1:45 pm)
Re: no way to swapoff a deleted swap file?, Christoph Hellwig, (Sat Oct 18, 1:49 pm)
Re: no way to swapoff a deleted swap file?, Willy Tarreau, (Sat Oct 18, 1:56 pm)
[PATCH 2.6.28?] don't unlink an active swapfile, Hugh Dickins, (Thu Nov 13, 7:37 pm)
Re: [PATCH 2.6.28?] don't unlink an active swapfile, Peter Cordes, (Thu Nov 13, 9:08 pm)
Re: [PATCH 2.6.28?] don't unlink an active swapfile, Christoph Hellwig, (Fri Nov 14, 10:34 am)
Re: [PATCH 2.6.28?] don't unlink an active swapfile, Hugh Dickins, (Fri Nov 14, 11:02 am)