]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
add checks for being a snapshot root to dir_is_nonempty
authorGreg Farnum <gregf@hq.newdream.net>
Mon, 7 Jun 2010 17:04:33 +0000 (10:04 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Tue, 8 Jun 2010 23:25:04 +0000 (16:25 -0700)
src/mds/Server.cc

index e7f64ad1605643e41ae7d979192b4d7195bf39b3..6d5a2b66785d1ed092ee3bcea2a175469cf5c1e7 100644 (file)
@@ -3696,8 +3696,12 @@ void Server::handle_client_unlink(MDRequest *mdr)
   if (in->is_dir()) {
     if (rmdir) {
       // do empty directory checks
-      if (_dir_is_nonempty(mdr, in))
+      if (_dir_is_nonempty(mdr, in)) {
+       dout(7) << "handle_client_unlink on dir " << *in
+               << ", returning ENOTEMPTY" << dendl;
+       reply_request(mdr, -ENOTEMPTY);
        return;
+      }
     } else {
       dout(7) << "handle_client_unlink on dir " << *in << ", returning error" << dendl;
       reply_request(mdr, -EISDIR);
@@ -3954,6 +3958,10 @@ bool Server::_dir_is_nonempty(MDRequest *mdr, CInode *in)
   dout(10) << "dir_is_nonempty " << *in << dendl;
   assert(in->is_auth());
 
+  
+  if (in->snaprealm && in->snaprealm->snaps.size()) {
+    return true; //in a snapshot!
+
   list<frag_t> frags;
   in->dirfragtree.get_leaves(frags);