xfs
[Top] [All Lists]

[PATCH] xfstests: fix msync() call in fsx.c:domapwrite()

To: xfs@xxxxxxxxxxx
Subject: [PATCH] xfstests: fix msync() call in fsx.c:domapwrite()
From: Curt Wohlgemuth <curtw@xxxxxxxxxx>
Date: Tue, 7 Feb 2012 11:16:06 -0800
Cc: linux-ext4@xxxxxxxxxxxxxxx, Curt Wohlgemuth <curtw@xxxxxxxxxx>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; bh=Q/HaWHQBhEzEtF6wq+MZ2dmaQOczzAuRCn2UXasqpxA=; b=LSp7HCTWqE8iPSyBEET3w4/wT7fSG6vUrHQ5toINjd+IC17YjJ42pCetKiNj0Ea3QS 3BkaDC6Xp3x7aZ3g6NPDsOlqRoloLNai0Wt+5UaHYZ4WsMuJy6us5uuw/cVCNZPDLyk1 n7xSqXXCawjiLuNAJy5dJPZCSC3bCw/CK6Q0w=
This explicitly sends MS_SYNC as the flag to msync() in
fsx.c, in domapwrite().  Without this flag, the memory
written to the mmap'ed region will not be flushed to disk;
in fact, on Linux, calling msync() with a '0' or MS_ASYNC
flag is a no-op.

Signed-off-by: Curt Wohlgemuth <curtw@xxxxxxxxxx>
---
 ltp/fsx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ltp/fsx.c b/ltp/fsx.c
index b36c201..2f1e3e8 100644
--- a/ltp/fsx.c
+++ b/ltp/fsx.c
@@ -779,7 +779,7 @@ domapwrite(unsigned offset, unsigned size)
                report_failure(202);
        }
        memcpy(p + pg_offset, good_buf + offset, size);
-       if (msync(p, map_size, 0) != 0) {
+       if (msync(p, map_size, MS_SYNC) != 0) {
                prterr("domapwrite: msync");
                report_failure(203);
        }
-- 
1.7.7.3

<Prev in Thread] Current Thread [Next in Thread>