[sheepdog] [PATCH] sheep: remove invalid error logs produced by dog vdi setattr

Yuichi Bando bando.yuichi at lab.ntt.co.jp
Wed Mar 19 03:32:43 CET 2014


This bug is reported in https://bugs.launchpad.net/sheepdog-project/+bug/1273080
To remove invalid error logs, I changed to skip sd_read_object() for existence check in sheep/vdi.c
if -x option is not specified to dog vdi setattr.

=== Bug Description ===
I got error logs when I added new attribute on vdi.
It seems that sheep searched for existing attr and couldn't find. Then logged error but created attr normaly.
I think these log should be INFO or WARN level.

Environment and versions
sheepdog : tag 0.7.6 (4 nodes)
operating system : CentOS 6.4

Here's the operations.

$ dog vdi list
  Name Id Size Used Shared Creation time VDI id Copies Tag
$ dog cluster format
using backend plain store
$ dog cluster format
using backend plain store
$ dog vdi create disk1 10m
$ dog vdi list
  Name Id Size Used Shared Creation time VDI id Copies Tag
  disk1 0 10 MB 0.0 MB 0.0 MB 2014-01-23 18:51 e8b18f 3
$ dog vdi setattr disk1 key1 value1
$ dog vdi getattr disk1 key1
value1

This returned 'value1' for key1 normally.

Here's the sheep.log

Jan 23 18:53:15 ERROR [gway 12101] sheep_exec_req(1062) failed No object found
Jan 23 18:53:15 ERROR [gway 12101] sheep_exec_req(1062) failed No object found
Jan 23 18:53:15 ERROR [gway 12101] sheep_exec_req(1062) failed No object found
Jan 23 18:53:15 ERROR [block] read_backend_object(414) failed to read object 20e8b18fc3b4ab67, No object found

No output on log when 'dog vdi getattr'.

Thanks
Yoshinori Matsuo

Reported-by: Yoshinori Matsuo <matsuo.yoshinori at lab.ntt.co.jp>
Signed-off-by: Yuichi Bando <bando.yuichi at lab.ntt.co.jp>
---
 sheep/vdi.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/sheep/vdi.c b/sheep/vdi.c
index 7af743e..baac2f9 100644
--- a/sheep/vdi.c
+++ b/sheep/vdi.c
@@ -1187,7 +1187,7 @@ int get_vdi_attr(struct sheepdog_vdi_attr *vattr, int data_len,
 	struct sheepdog_vdi_attr tmp_attr;
 	uint64_t oid;
 	uint32_t end;
-	int ret;
+	int ret = SD_RES_NO_OBJ;
 
 	vattr->ctime = create_time;
 
@@ -1196,8 +1196,9 @@ int get_vdi_attr(struct sheepdog_vdi_attr *vattr, int data_len,
 	end = *attrid - 1;
 	while (*attrid != end) {
 		oid = vid_to_attr_oid(vid, *attrid);
-		ret = sd_read_object(oid, (char *)&tmp_attr,
-				     sizeof(tmp_attr), 0);
+		if (excl || !wr)
+			ret = sd_read_object(oid, (char *)&tmp_attr,
+					sizeof(tmp_attr), 0);
 
 		if (ret == SD_RES_NO_OBJ && wr) {
 			ret = sd_write_object(oid, (char *)vattr, data_len, 0,
-- 
1.7.1





More information about the sheepdog mailing list