Discussion:
Possible bug when getting batched xattrs
Joaquim Rocha
2014-10-17 09:28:17 UTC
Permalink
Hi,

I need to get a list of xattrs from one object (so I'm batching them in
one ObjectReadOperation) but I don't know in advance if all of those
xattrs exist.

I was expecting to figure out the ones that don't exist from the return
code of each getxattr call but I have however noticed that as soon one
nonexistent xattr is processed, its return code gets correctly set to
-ENODATA but the remaining xattrs are never checked. And what is worse,
the remaining getxattr op's return codes get assigned to 0.

I am attaching a small test case I've quickly written that proves the
case. (I am using Ceph 0.80.5)

Could you confirm that this is not the intended behavior (that all read
op's calls should be processed)?


Thank you in advance,

--
Joaquim Rocha
http://www.joaquimrocha.com
Sebastien Ponce
2014-10-17 11:01:18 UTC
Permalink
I can confirm that head of master has the same behavior.

On top, having had a look at the osd code (name ly ReplicatedPG.cc
around line 4756 in master), it seems to be intended : we are in a for
loop going through the operations and executing them and the code says :
if (result < 0)
break;
So we exit the loop on the first error and do not execute the remaining
ops.

Sebastien
Post by Joaquim Rocha
Hi,
I need to get a list of xattrs from one object (so I'm batching them in
one ObjectReadOperation) but I don't know in advance if all of those
xattrs exist.
I was expecting to figure out the ones that don't exist from the return
code of each getxattr call but I have however noticed that as soon one
nonexistent xattr is processed, its return code gets correctly set to
-ENODATA but the remaining xattrs are never checked. And what is worse,
the remaining getxattr op's return codes get assigned to 0.
I am attaching a small test case I've quickly written that proves the
case. (I am using Ceph 0.80.5)
Could you confirm that this is not the intended behavior (that all read
op's calls should be processed)?
Thank you in advance,
--
Joaquim Rocha
http://www.joaquimrocha.com
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Sage Weil
2014-10-17 14:02:53 UTC
Permalink
Hi,
I need to get a list of xattrs from one object (so I'm batching them in one
ObjectReadOperation) but I don't know in advance if all of those xattrs exist.
I was expecting to figure out the ones that don't exist from the return code
of each getxattr call but I have however noticed that as soon one nonexistent
xattr is processed, its return code gets correctly set to -ENODATA but the
remaining xattrs are never checked. And what is worse, the remaining getxattr
op's return codes get assigned to 0.
I am attaching a small test case I've quickly written that proves the case. (I
am using Ceph 0.80.5)
Could you confirm that this is not the intended behavior (that all read op's
calls should be processed)?
This is by design.

What you want is the

void set_op_flags(ObjectOperationFlags flags);

method on the ObjectOperation, and the OP_FAILOK flag. That will set a
bit on the last op (getxattr) you added that will make processing continue
even if it got an error. Then you'll get the behavior you were
looking for.

sage
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to ***@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Loading...