Even if a file is opened with O_DIRECT we still need O_DSYNC / fdatasync
to make sure all metadata required to find the data made it to disk.

Also clean up the flags handling in ob_open a bit.

Signed-off-by: Christoph Hellwig <[email protected]>

Index: sheepdog/sheep/store.c
===================================================================
--- sheepdog.orig/sheep/store.c 2011-11-10 21:25:28.385296608 +0100
+++ sheepdog/sheep/store.c      2011-11-10 21:26:58.527796616 +0100
@@ -158,7 +158,7 @@ out:
        return res;
 }
 
-static int ob_open(uint32_t epoch, uint64_t oid, int aflags, int *ret);
+static int ob_open(uint32_t epoch, uint64_t oid, int flags, int *ret);
 
 static int read_from_one(struct request *req, uint32_t epoch, uint64_t oid,
                         unsigned *ori_rlen, void *buf, uint64_t offset)
@@ -430,16 +430,14 @@ out:
        return ret;
 }
 
-static int ob_open(uint32_t epoch, uint64_t oid, int aflags, int *ret)
+static int ob_open(uint32_t epoch, uint64_t oid, int flags, int *ret)
 {
        char path[1024];
-       int flags;
        int fd;
 
+       flags |= O_DSYNC | O_RDWR;
        if (sys->use_directio && is_data_obj(oid))
-               flags = O_DIRECT | O_RDWR | aflags;
-       else
-               flags = O_DSYNC | O_RDWR | aflags;
+               flags |= O_DIRECT;
 
        snprintf(path, sizeof(path), "%s%08u/%016" PRIx64, obj_path, epoch, 
oid);
 
-- 
sheepdog mailing list
[email protected]
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to