Skip to contentSkip to conversation

swapoff weird

DISCUSSION Pavel Machek 5 participants 8 messages Dec 9, 2000 – Dec 15, 2000

lore
Share & tools
lore
#0 lore raw

Hi!

It is possible to remove swapfile in use. Great, but how do you swap off then? Who is to blame?

root@bug:~# swapoff /tmp/swap
swapoff: /tmp/swap: No such file or directory
root@bug:~# > /tmp/swap
root@bug:~# swapoff /tmp/swap
swapoff: /tmp/swap: Invalid argument
root@bug:~#

How do I get out of this bad situation?
Pavel
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#1 lore raw
Quoted 2 lines · Pavel Machek

It is possible to remove swapfile in use. Great, but how do you swap off then? Who is to blame?

As usual, root is to blame ;)

Quoted 6 lines
root@bug:~# swapoff /tmp/swap
swapoff: /tmp/swap: No such file or directory
root@bug:~# > /tmp/swap
root@bug:~# swapoff /tmp/swap
swapoff: /tmp/swap: Invalid argument
root@bug:~#

Don't let your automatic /tmp cleaners remove the swap file ;)

Quoted 1 line

How do I get out of this bad situation?

Reboot.

cheers,

Rik
--
Hollywood goes for world dumbination,

	Trailer at 11.

		http://www.surriel.com/

http://www.conectiva.com/ http://distro.conectiva.com.br/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#2 lore raw
In reply to Pavel Machek
Quoted 6 lines · Pavel Machek
Quoted 3 lines

It is possible to remove swapfile in use. Great, but how do you swap off then? Who is to blame?

As usual, root is to blame ;)

I do not agree. It is too easy to get to situation like this.

Quoted 7 lines
Quoted 6 lines
root@bug:~# swapoff /tmp/swap
swapoff: /tmp/swap: No such file or directory
root@bug:~# > /tmp/swap
root@bug:~# swapoff /tmp/swap
swapoff: /tmp/swap: Invalid argument
root@bug:~#
Quoted 6 lines

Don't let your automatic /tmp cleaners remove the swap file ;)

Quoted 1 line

How do I get out of this bad situation?

Reboot.

I'm afraid even reboot will not work.

I can't swapoff. Therefore filesystem is busy (it must be -- kernel might be writing to file on it!). And no way to get out of that.

Signature · 6 lines
The best software in life is free (not shareware)!		Pavel
GCM d? s-: !g p?:+ au- a--@ w+ v- C++@ UL+++ L++ N++ E++ W--- M- Y- R+
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
#3 lore raw
In reply to Pavel Machek

At 10:24 PM 12/9/2000 +0100, you wrote:d

Quoted 2 lines

It is possible to remove swapfile in use. Great, but how do you swap off then? Who is to blame?

Perhaps it would be good to put a check in unlink to make sure that this is not the last link to a swapfile. Are there any other sorts of files that don't belong to any user process and may remain active after unlink?

--
This message has been brought to you by the letter alpha and the number pi. Open Source: Think locally; act globally.
David Feuer
[email protected]

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#4 lore raw

Hi!

Quoted 8 lines
Quoted 7 lines

[David Feuer]

Quoted 2 lines

Perhaps it would be good to put a check in unlink to make sure that this is not the last link to a swapfile.

Much better to add code to /sbin/swapon and /sbin/swapoff to set and clear immutable bit. Sure it only works on ext2 but how far do you want to take this thing?

Quoted 7 lines
Quoted 3 lines · In a private email, [email protected] wrote:

No; we should add some more magic-symlink /proc entries, like /proc/<pid>/fd/<n> for swap files. Then they can be accessed by swapoff even if they're deleted.

Seems like a good idea to me...

We could make them opened by kswapd.

Pavel

Signature · 6 lines
I'm [email protected]. "In my country we have almost anarchy and I don't care."
Panos Katsaloulis describing me w.r.t. patents at [email protected]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/
#5 lore raw
In reply to Pavel Machek
Quoted 2 lines

I can't swapoff. Therefore filesystem is busy (it must be -- kernel might be writing to file on it!). And no way to get out of that.

It's busy because some portion of memory is in use. manually kill things as best you can. this will clean out the swap. once you've gotten all applications killed cleanly you can forcibly reboot with little damage. this is pretty much the only way out. we don't have any method (currently) to turn off a swap file if it's deleted.

Some ideas for the future, /var/run/swap.inode files, some form of sysctl.

-d

begin:vcard
n:Ford;David
x-mozilla-html:TRUE
url:www.blue-labs.org
adr:;;;;;;
version:2.1
email;internet:[email protected]
title:Blue Labs Developer
note;quoted-printable:GPG key: http://www.blue-labs.org/[email protected]=0D=0A
x-mozilla-cpt:;9952
fn:David Ford
end:vcard

#6 lore raw
In reply to Pavel Machek

[David Feuer]

Quoted 2 lines

Perhaps it would be good to put a check in unlink to make sure that this is not the last link to a swapfile.

Much better to add code to /sbin/swapon and /sbin/swapoff to set and clear immutable bit. Sure it only works on ext2 but how far do you want to take this thing?

Peter
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/

#7 lore raw
Quoted 7 lines · Peter Samuelson

[David Feuer]

Quoted 2 lines

Perhaps it would be good to put a check in unlink to make sure that this is not the last link to a swapfile.

Much better to add code to /sbin/swapon and /sbin/swapoff to set and clear immutable bit. Sure it only works on ext2 but how far do you want to take this thing?

Quoted 3 lines · In a private email, [email protected] wrote:

No; we should add some more magic-symlink /proc entries, like /proc/<pid>/fd/<n> for swap files. Then they can be accessed by swapoff even if they're deleted.

Seems like a good idea to me...

--
This message has been brought to you by the letter alpha and the number pi. Open Source: Think locally; act globally.
David Feuer
[email protected]

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/