lkml.org 
[lkml]   [2001]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: swapoff() behaviour


On Fri, 21 Sep 2001, Alexander Viro wrote:

> Guys, do we want
>
> swapon /dev/sda6
> cp -a /dev/sda6 /tmp
> swapoff /tmp/sda6
>
> to work? Code in sys_swapoff() looks like an attempt to make it work.
> However, it doesn't -
> if ((p->flags & SWP_WRITEOK) == SWP_WRITEOK) {
> if (p->swap_file) {
> if (p->swap_file == nd.dentry)
> break;
> } else {
> if (S_ISBLK(nd.dentry->d_inode->i_mode)
> && (p->swap_device == nd.dentry->d_inode->i_
> rdev))
> break;
> }
> }
>
> _never_ hits the second break since we have ->swap_file set for all
> active swap components, be they swap files or swap partitions.
>
> Comments? The same goes for 2.2, BTW.

After a look through the CVS, it seems that prior to 2.1.45 we actually
had that behaviour - for swap partitions swapoff() cared only about
major:minor. Since 2.1.45 we really need the same dentry - not even
the same inode (i.e.
swapon /dev/sda6 && ln /dev/sda6 /dev/foo && swapoff /dev/foo
is guaranteed to fail; prior to 2.1.45 it used to work).

In other words, during the last 4 years quite a few pieces of mm/swapfile.c
had been a dead code. Looks like we either need to restore old behaviour
or perform the amputation. Snippet above is not the only place of that
kind.

Linus, it's your call.

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

\
 
 \ /
  Last update: 2005-03-22 13:03    [W:2.047 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site