mds: don't getxattr and setxattr at the same time

If an osd request contains write operation, the reply will not
carry output data. So we can't getxattr and setxattr in single
OSD request.

Signed-off-by: Yan, Zheng <zyan@redhat.com>
This commit is contained in:
Yan, Zheng 2015-11-24 20:16:09 +08:00
parent 1cc9d52ef7
commit a2def5e29f

View File

@ -3741,23 +3741,18 @@ void CInode::validate_disk_state(CInode::validated_data *results,
object_t oid = CInode::get_object_name(in->ino(), frag_t(), "");
ObjectOperation fetch;
fetch.getxattr("parent", bt, bt_r);
// We want to tag even if we get ENODATA fetching the backtrace
fetch.set_last_op_flags(CEPH_OSD_OP_FLAG_FAILOK);
in->mdcache->mds->objecter->read(oid, object_locator_t(pool), fetch, CEPH_NOSNAP,
NULL, 0, fin);
if (!tag.empty()) {
ObjectOperation scrub_tag;
bufferlist tag_bl;
::encode(tag, tag_bl);
fetch.setxattr("scrub_tag", tag_bl);
}
if (tag.empty()) {
in->mdcache->mds->objecter->read(oid, object_locator_t(pool), fetch, CEPH_NOSNAP,
NULL, 0, fin);
} else {
SnapContext snapc;
in->mdcache->mds->objecter->mutate(oid, object_locator_t(pool), fetch,
snapc,ceph::real_clock::now(
g_ceph_context), 0, NULL, fin);
scrub_tag.setxattr("scrub_tag", tag_bl);
SnapContext snapc;
in->mdcache->mds->objecter->mutate(oid, object_locator_t(pool), scrub_tag, snapc,
ceph::real_clock::now(g_ceph_context),
0, NULL, NULL);
}
}