The zero-length component (stands for snapdir) must be at very
beginning of path. This allow us to easily check if a client request
want to access snapshot
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
return false;
}
+
+ bool is_last_snap() const {
+ // walk into snapdir?
+ return depth() > 0 && bits[0].length() == 0;
+ }
};
WRITE_CLASS_ENCODER(filepath)
// walk into snapdir?
if (path[depth].length() == 0) {
dout(10) << "traverse: snapdir" << dendl;
- if (!mdr)
+ if (!mdr || depth > 0) // snapdir must be the first component
return -EINVAL;
snapid = CEPH_SNAPDIR;
mdr->snapid = snapid;