From: Liu Yuan <[email protected]>

For now the entry access is protected by get/put_object_entry(), when object
is not added to the object list, other threads can't access it.

Signed-off-by: Liu Yuan <[email protected]>
---
 sheep/object_cache.c |   12 ------------
 1 file changed, 12 deletions(-)

diff --git a/sheep/object_cache.c b/sheep/object_cache.c
index 814b528..d6b5604 100644
--- a/sheep/object_cache.c
+++ b/sheep/object_cache.c
@@ -717,18 +717,7 @@ static int create_cache_object(struct object_cache *oc, 
uint32_t idx,
                goto out;
        }
 
-       if (flock(fd, LOCK_EX) < 0) {
-               ret = SD_RES_EIO;
-               eprintf("%m\n");
-               goto out_close;
-       }
        ret = xpwrite(fd, buffer, buf_size, 0);
-       if (flock(fd, LOCK_UN) < 0) {
-               ret = SD_RES_EIO;
-               eprintf("%m\n");
-               goto out_close;
-       }
-
        if (ret != buf_size) {
                ret = SD_RES_EIO;
                eprintf("failed, vid %"PRIx32", idx %"PRIx32"\n", oc->vid, idx);
@@ -743,7 +732,6 @@ out:
        return ret;
 }
 
-
 /* Fetch the object, cache it in success */
 static int object_cache_pull(struct object_cache *oc, uint32_t idx)
 {
-- 
1.7.10.2

-- 
sheepdog mailing list
[email protected]
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to