lkml.org 
[lkml]   [1998]   [Feb]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subjectmkswap
I just noticed that I can do
mkswap foo; swapon foo
which fails, ("Unable to find swap-space signature"), while
mkswap foo; sync; swapon foo
succeeds. In other words (2.0.33): the swapon system call
does not look at the cache for the file foo.
This is a kernel bug (but there are more aliasing problems
somewhat like this, like between /dev/hda and /dev/hda1).

I patched mkswap.c, adding a sync:

--- mkswap.c~ Sun Jul 6 02:11:03 1997
+++ mkswap.c Thu Feb 19 21:49:40 1998
@@ -223,5 +223,11 @@
die("unable to rewind swap-device");
if (PAGE_SIZE != write(DEV, signature_page, PAGE_SIZE))
die("unable to write signature page");
+ /*
+ * A subsequent swapon() will fail if the signature
+ * is not actually on disk. (This is a kernel bug.)
+ */
+ if (fsync(DEV))
+ die("fsync failed");
return 0;
}

Andries

cc-ed to linux-kernel

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu

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