[PATCH] plain store: pass errno to err_to_sderr directly

8 views
Skip to first unread message

Meng Lingkun

unread,
Mar 20, 2017, 9:32:59 PM3/20/17
to sheep...@googlegroups.com, Meng Lingkun
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



Liu Yuan

unread,
Mar 28, 2017, 2:35:56 AM3/28/17
to Meng Lingkun, sheep...@googlegroups.com
On Tue, Mar 21, 2017 at 09:32:04AM +0800, Meng Lingkun wrote:
> 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.
>

Applied, thanks.

Yuan
Reply all
Reply to author
Forward
0 new messages