[DRBD-user] DRBD fsync() seems to return before writing to disk

Matteo Frigo athena at fftw.org
Fri Jun 22 20:01:13 CEST 2012

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.


Phil Frost writes:

> Unfortunately, I don't feel very qualified in this area, so can anyone
> tell me if I'm totally off base here? Any suggestions on how I might
> test this?

I don't know much about the kernel myself, but your post suggested a
fix.  I applied the patch below to linux-3.4.1 and this patch appears to
fix the problem.  Specifically, fsync() is too fast before the patch,
and it runs at non-drbd speed after the patch.

diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 211fc44..96e400b 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -3413,6 +3413,7 @@ struct drbd_conf *drbd_new_device(unsigned int minor)
 	set_disk_ro(disk, true);
 
 	disk->queue = q;
+	blk_queue_flush(disk->queue, REQ_FLUSH | REQ_FUA);
 	disk->major = DRBD_MAJOR;
 	disk->first_minor = minor;
 	disk->fops = &drbd_ops;




More information about the drbd-user mailing list