#!/bin/bash -x
set -e
+set -x
# detect data pool
datapool=
getfattr -n ceph.file.layout.pool file2 | grep -q $datapool
setfattr -n ceph.file.layout.pool_namespace -v foons file2
getfattr -n ceph.file.layout.pool_namespace file2 | grep -q foons
+setfattr -x ceph.file.layout.pool_namespace file2
+getfattr -n ceph.file.layout.pool_namespace file2 | grep -q -v foons
getfattr -n ceph.file.layout.stripe_unit file2 | grep -q 1048576
getfattr -n ceph.file.layout.stripe_count file2 | grep -q 8
getfattr -n ceph.dir.layout.object_size dir | grep -q 10485760
getfattr -n ceph.dir.layout.pool_namespace dir | grep -q dirns
+
setfattr -n ceph.file.layout -v "stripe_count=16" file2
getfattr -n ceph.file.layout.stripe_count file2 | grep -q 16
setfattr -n ceph.file.layout -v "object_size=10485760 stripe_count=8 stripe_unit=1048576 pool=$datapool pool_namespace=dirns" file2
getfattr -n ceph.file.layout.object_size dir/file | grep -q 10485760
getfattr -n ceph.file.layout.pool_namespace dir/file | grep -q dirns
+setfattr -x ceph.dir.layout.pool_namespace dir
+getfattr -n ceph.dir.layout dir | grep -q -v pool_namespace=dirns
+
setfattr -x ceph.dir.layout dir
getfattr -n ceph.dir.layout dir 2>&1 | grep -q 'No such attribute'
if (!mds->locker->acquire_locks(mdr, rdlocks, wrlocks, xlocks))
return;
- if (cur->inode.layout.pool_id != layout.pool_id) {
+ if (cur->inode.layout.pool_id != layout.pool_id
+ || cur->inode.layout.pool_ns != layout.pool_ns) {
if (!check_access(mdr, cur, MAY_SET_POOL)) {
return;
}
}
void Server::handle_remove_vxattr(MDRequestRef& mdr, CInode *cur,
+ file_layout_t *dir_layout,
set<SimpleLock*> rdlocks,
set<SimpleLock*> wrlocks,
set<SimpleLock*> xlocks)
{
MClientRequest *req = mdr->client_request;
string name(req->get_path2());
+
+ dout(10) << __func__ << " " << name << " on " << *cur << dendl;
+
if (name == "ceph.dir.layout") {
if (!cur->is_dir()) {
respond_to_request(mdr, -ENODATA);
journal_and_reply(mdr, cur, 0, le, new C_MDS_inode_update_finish(this, mdr, cur));
return;
+ } else if (name == "ceph.dir.layout.pool_namespace"
+ || name == "ceph.file.layout.pool_namespace") {
+ // Namespace is the only layout field that has a meaningful
+ // null/none value (empty string, means default layout). Is equivalent
+ // to a setxattr with empty string: pass through the empty payload of
+ // the rmxattr request to do this.
+ handle_set_vxattr(mdr, cur, dir_layout, rdlocks, wrlocks, xlocks);
+ return;
}
respond_to_request(mdr, -ENODATA);
}
if (name.compare(0, 5, "ceph.") == 0) {
- handle_remove_vxattr(mdr, cur, rdlocks, wrlocks, xlocks);
+ handle_remove_vxattr(mdr, cur, dir_layout, rdlocks, wrlocks, xlocks);
return;
}
set<SimpleLock*> wrlocks,
set<SimpleLock*> xlocks);
void handle_remove_vxattr(MDRequestRef& mdr, CInode *cur,
+ file_layout_t *dir_layout,
set<SimpleLock*> rdlocks,
set<SimpleLock*> wrlocks,
set<SimpleLock*> xlocks);