]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: don't getxattr and setxattr at the same time
authorYan, Zheng <zyan@redhat.com>
Tue, 24 Nov 2015 12:16:09 +0000 (20:16 +0800)
committerYan, Zheng <zyan@redhat.com>
Mon, 7 Mar 2016 07:59:12 +0000 (15:59 +0800)
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>
src/mds/CInode.cc

index ed3e43dcec905ac7e0439b49941bd5e600b23562..8a643277d3036a3e9b634f43deebb4b9c7fa3610 100644 (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);
       }
     }