[sheepdog] [PATCH] sheep/plain_store: remove checking length in default_read_from_path
Ruoyu
liangry at ucweb.com
Fri Jul 18 09:02:14 CEST 2014
Checking length after reading object fileis not a good idea.
Disk auto unplugging will be occurred under one of the two
situations:
1. A new version dog with ledger object supported sends request to
an old version sheep withou ledger object supported
2. Object file is modified by the third party and the length of it
is not the original size
So, I suggest remove checking length.
Signed-off-by: Ruoyu <liangry at ucweb.com>
---
sheep/plain_store.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sheep/plain_store.c b/sheep/plain_store.c
index 07bd107..5991bf3 100644
--- a/sheep/plain_store.c
+++ b/sheep/plain_store.c
@@ -345,7 +345,7 @@ static int default_read_from_path(uint64_t oid, const char *path,
return err_to_sderr(path, oid, errno);
size = xpread(fd, iocb->buf, iocb->length, iocb->offset);
- if (unlikely(size != iocb->length)) {
+ if (size < 0) {
sd_err("failed to read object %"PRIx64", path=%s, offset=%"
PRId32", size=%"PRId32", result=%zd, %m", oid, path,
iocb->offset, iocb->length, size);
--
1.8.3.2
More information about the sheepdog
mailing list