]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
add setlayout, setdirlayout, setxattr check_access
authorJashan Kamboj <jashank42@gmail.com>
Tue, 21 Jul 2015 17:10:00 +0000 (22:40 +0530)
committerSage Weil <sage@redhat.com>
Thu, 1 Oct 2015 13:39:32 +0000 (09:39 -0400)
Signed-off-by: Jashan Kamboj <jashank42@gmail.com>
src/mds/Server.cc

index d68eceee42b7e8d981102df2a5e4e73df58d8a65..60011f4912e04ce0b9b2466be196d53802e3b989 100644 (file)
@@ -3809,6 +3809,9 @@ void Server::handle_client_setlayout(MDRequestRef& mdr)
   if (!mds->locker->acquire_locks(mdr, rdlocks, wrlocks, xlocks))
     return;
 
+  if (!check_access(mdr, cur, MAY_WRITE))
+    return;
+
   // project update
   inode_t *pi = cur->project_inode();
   pi->layout = layout;
@@ -3850,6 +3853,9 @@ void Server::handle_client_setdirlayout(MDRequestRef& mdr)
   if (!mds->locker->acquire_locks(mdr, rdlocks, wrlocks, xlocks))
     return;
 
+  if (!check_access(mdr, cur, MAY_WRITE))
+    return;
+
   // validate layout
   const inode_t *old_pi = cur->get_projected_inode();
   ceph_file_layout layout;
@@ -4268,6 +4274,9 @@ void Server::handle_client_setxattr(MDRequestRef& mdr)
   if (!mds->locker->acquire_locks(mdr, rdlocks, wrlocks, xlocks))
     return;
 
+  if (!check_access(mdr, cur, MAY_WRITE))
+    return;
+
   map<string, bufferptr> *pxattrs = cur->get_projected_xattrs();
   if ((flags & CEPH_XATTR_CREATE) && pxattrs->count(name)) {
     dout(10) << "setxattr '" << name << "' XATTR_CREATE and EEXIST on " << *cur << dendl;