Messages in this thread Patch in this message | | | Date | Thu, 19 Feb 1998 22:22:32 +0100 (MET) | From | Andries.Brouwer@cwi ... | Subject | mkswap |
| |
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
| |