If default_exist sets errno to EIO (maybe caused by a bad block),
and pass ENOENT instead of EIO, err_to_sderr can not call md_handle_eio
to unplug the bad disk (is_dir_corrupted may return false). Worsely,
it will cause SD_RES_NO_OBJ to callers. So, just pass the errno, and
let err_to_sderr to handle more exceptions.
Signed-off-by: Meng Lingkun <
mengl...@cmss.chinamobile.com>
---
sheep/store/plain_store.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sheep/store/plain_store.c b/sheep/store/plain_store.c
index 85d4ce4..f3d2d76 100644
--- a/sheep/store/plain_store.c
+++ b/sheep/store/plain_store.c
@@ -78,7 +78,7 @@ int default_write(uint64_t oid, const struct siocb *iocb)
* any bugs. We need call err_to_sderr() to return EIO if disk is broken
*/
if (!default_exist(oid, iocb->ec_index))
- return err_to_sderr(path, oid, ENOENT);
+ return err_to_sderr(path, oid, errno);
fd = open(path, flags, sd_def_fmode);
if (unlikely(fd < 0))
@@ -156,7 +156,7 @@ static int default_read_from_path(uint64_t oid, const char *path,
* For stale path, get_store_stale_path already does default_exist job.
*/
if (!is_stale_path(path) && !default_exist(oid, iocb->ec_index))
- return err_to_sderr(path, oid, ENOENT);
+ return err_to_sderr(path, oid, errno);
fd = open(path, flags);
if (fd < 0)
--
1.8.3.1