]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
uclient: handle inode with no caps from mds
authorSage Weil <sage@newdream.net>
Fri, 4 Jun 2010 19:54:25 +0000 (12:54 -0700)
committerSage Weil <sage@newdream.net>
Fri, 4 Jun 2010 20:01:21 +0000 (13:01 -0700)
This happens when you readdir and some inodes are in a different snaprealm.

src/client/Client.cc

index 4e1c49d395a385f261475ab12f6c4dc383e22a7a..ad806c7a1d0f1caaef71945ff3310cbf20e0b7c8 100644 (file)
@@ -423,27 +423,29 @@ Inode * Client::add_update_inode(InodeStat *st, utime_t from, int mds)
       cwd = root;
       cwd->get();
     }
+
+    // immutable bits
+    in->ino = st->vino.ino;
+    in->snapid = st->vino.snapid;
+    in->rdev = st->rdev;
+    in->mode = st->mode & S_IFMT;
+    if (in->is_symlink())
+      in->symlink = st->symlink;
   }
 
-  //dout(12) << "update_inode mask " << lease->mask << " ttl " << ttl << dendl;
   dout(12) << "add_update_inode " << *in << " caps " << ccap_string(st->cap.caps) << dendl;
+  if (!st->cap.caps)
+    return in;   // as with readdir returning indoes in different snaprealms (no caps!)
+
   int implemented = 0;
   int issued = in->caps_issued(&implemented) | in->caps_dirty();
   issued |= implemented;
 
-  if (st->cap.caps) {
-    if (in->snapid == CEPH_NOSNAP)
-      add_update_cap(in, mds, st->cap.cap_id, st->cap.caps, st->cap.seq, st->cap.mseq, inodeno_t(st->cap.realm), st->cap.flags);
-    else {
-      in->snap_caps |= st->cap.caps;
-    }
-  }
-  
-  assert(st->cap.caps & CEPH_CAP_PIN);   // right??
+  if (in->snapid == CEPH_NOSNAP)
+    add_update_cap(in, mds, st->cap.cap_id, st->cap.caps, st->cap.seq, st->cap.mseq, inodeno_t(st->cap.realm), st->cap.flags);
+  else
+    in->snap_caps |= st->cap.caps;
 
-  in->ino = st->vino.ino;
-  in->snapid = st->vino.snapid;
-  in->rdev = st->rdev;
   in->dirfragtree = st->dirfragtree;  // FIXME look at the mask!
 
   if ((issued & CEPH_CAP_AUTH_EXCL) == 0) {
@@ -483,10 +485,6 @@ Inode * Client::add_update_inode(InodeStat *st, utime_t from, int mds)
     in->flags |= I_COMPLETE;
   }
 
-  // symlink?
-  if (in->is_symlink())
-    in->symlink = st->symlink;
-
   return in;
 }