[sheepdog] [PATCH] sheep/plain_store: remove checking length in default_read_from_path

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Tue Jul 22 07:52:31 CEST 2014


At Fri, 18 Jul 2014 15:02:14 +0800,
Ruoyu wrote:
> 
> 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(-)

Applied, thanks.

But I think modifying sheepdog objects via thirt party is too
dangerous. It should be avoided.

Thanks,
Hitoshi

> 
> 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
> 
> 
> -- 
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog



More information about the sheepdog mailing list