[sheepdog] [PATCH] object cache: use the correct unlock flag for lockf()

Liu Yuan namei.unix at gmail.com
Fri May 18 16:06:10 CEST 2012


From: Liu Yuan <tailai.ly at taobao.com>

Manual says we should use F_ULOCK to unlock lockf()

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 sheep/object_cache.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sheep/object_cache.c b/sheep/object_cache.c
index 2b5563d..799cb23 100644
--- a/sheep/object_cache.c
+++ b/sheep/object_cache.c
@@ -279,7 +279,7 @@ static int write_cache_object(uint32_t vid, uint32_t idx, void *buf, size_t coun
 		goto out;
 	}
 	size = xpwrite(fd, buf, count, offset);
-	if (xlockf(fd, F_UNLCK, offset, count) < 0) {
+	if (xlockf(fd, F_ULOCK, offset, count) < 0) {
 		ret = SD_RES_EIO;
 		eprintf("%m\n");
 		goto out;
@@ -313,7 +313,7 @@ static int read_cache_object(uint32_t vid, uint32_t idx, void *buf, size_t count
 	}
 
 	size = xpread(fd, buf, count, offset);
-	if (xlockf(fd, F_UNLCK, offset, count) < 0) {
+	if (xlockf(fd, F_ULOCK, offset, count) < 0) {
 		ret = SD_RES_EIO;
 		eprintf("%m\n");
 		goto out;
-- 
1.7.8.2




More information about the sheepdog mailing list