ring-buffer: Put back the length if crossed page with add_timestamp
[linux-2.6-block.git] / kernel / trace / ring_buffer.c
index 4dd6d5bc4e11904cfed838c2db2e044aea8ab81f..9c6045a27ba356252546971fb26dbae30149c89c 100644 (file)
@@ -2797,8 +2797,11 @@ rb_reserve_next_event(struct ring_buffer *buffer,
 
        event = __rb_reserve_next(cpu_buffer, &info);
 
-       if (unlikely(PTR_ERR(event) == -EAGAIN))
+       if (unlikely(PTR_ERR(event) == -EAGAIN)) {
+               if (info.add_timestamp)
+                       info.length -= RB_LEN_TIME_EXTEND;
                goto again;
+       }
 
        if (!event)
                goto out_fail;