🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: gmane.linux.kernel
1 messages
1 total messages Started by Rob Landley Sat, 17 Sep 2005 05:37
[PATCH] Fix bd_claim() error code.
#307656
Author: Rob Landley
Date: Sat, 17 Sep 2005 05:37
27 lines
1167 bytes
Signed-off-by: Rob Landley <rob@landley.net>

Problem: In some circumstances, bd_claim() is returning the wrong error code.

If we try to swapon an unused block device that isn't swap formatted, we get
-EINVAL.  But if that same block device is already mounted, we instead get
-EBUSY, even though it still isn't a valid swap device.

This issue came up on the busybox list trying to get the error message
from "swapon -a" right.  If a swap device is already enabled, we get -EBUSY,
and we shouldn't report this as an error.  But we can't distinguish the two
-EBUSY conditions, which are very different errors.

In the code, bd_claim() returns either 0 or -EBUSY, but in this case busy
means "somebody other than sys_swapon has already claimed this", and
_that_ means this block device can't be a valid swap device.  So return
-EINVAL there.

--- linux-2.6.13.1/mm/swapfile.c 2005-09-09 21:42:58.000000000 -0500
+++ linux-2.6.13.1-new/mm/swapfile.c 2005-09-17 02:42:45.000000000 -0500
@@ -1358,6 +1358,7 @@
   error = bd_claim(bdev, sys_swapon);
   if (error < 0) {
    bdev = NULL;
+   error = -EINVAL;
    goto bad_swap;
   }
   p->old_block_size = block_size(bdev);
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads