Skip to contentSkip to conversation

patch for log_enqueue in multipath-tools-0.4.4-pre11

PATCH Applied Benjamin Marzinski 2 participants 2 messages Apr 11, 2005 Device mapper

lore
Share & tools
lore

Benjamin Marzinski

author maintainer
#0 lore raw

It looks to me like log_enqueue can accidentally mess up its la->tail ptr, if it runs out of space for the new message.

If the la->head is just past la->start, and la->tail is just before la->end, la->tail will get updated to be la->start, because there is no room at the end of the buffer for the message. Then when it realizes that there is no room at the start of the buffer, la->tail will be updated to la->start - fwd And the next message will be written before the buffer.

This patch fixes that.

-Ben
Ben Marzinski
[email protected]
(612) 638-0517

multipathd/log.c +1 -1
diff -urN multipath-tools-0.4.4-pre11/multipathd/log.c multipath-tools-0.4.4-log-fixed/multipathd/log.c
@@ -119,7 +119,7 @@
 		logdbg(stderr, "enqueue: log area overrun, drop msg\n");
 
 		if (!la->empty)
-			la->tail -= fwd;
+			la->tail = lastmsg;
 
 		return 1;
 	}
#1 lore raw

Merged, thanks.
Good to see new eyeballs in there.

Have you spoted design flaws in the async logger ?

Regards,
cvaroqui

Quoted 11 lines · Benjamin Marzinski

It looks to me like log_enqueue can accidentally mess up its la->tail ptr, if it runs out of space for the new message.

If the la->head is just past la->start, and la->tail is just before la->end, la->tail will get updated to be la->start, because there is no room at the end of the buffer for the message. Then when it realizes that there is no room at the start of the buffer, la->tail will be updated to la->start - fwd And the next message will be written before the buffer.

This patch fixes that.