]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: don't croak on open_files without caps
authorSage Weil <sage@newdream.net>
Fri, 13 Nov 2009 22:44:22 +0000 (14:44 -0800)
committerSage Weil <sage@newdream.net>
Fri, 13 Nov 2009 23:21:32 +0000 (15:21 -0800)
We can get a capless inode here if we replay an open file, the client
fails to reconnect it, but does REPLAY an open request (that adds it
to the logseg).  AFAICS it's ok for the client to replay an open on a
file it doesn't have in it's cache anymore.

src/mds/journal.cc

index f5b8f4b83662e02ed2e8c1fd1d7ba10c54bbe160..fe33f519a97776e1f71bd12f4ad21037f50d0752 100644 (file)
@@ -162,11 +162,24 @@ C_Gather *LogSegment::try_to_expire(MDS *mds)
     while (!p.end()) {
       CInode *in = *p;
       ++p;
-      dout(20) << "try_to_expire requeueing open file " << *in << dendl;
-      assert(in->is_any_caps());
-      if (!le) le = new EOpen(mds->mdlog);
-      le->add_clean_inode(in);
-      ls->open_files.push_back(&in->xlist_open_file);
+      if (in->is_any_caps()) {
+       dout(20) << "try_to_expire requeueing open file " << *in << dendl;
+       if (!le) le = new EOpen(mds->mdlog);
+       le->add_clean_inode(in);
+       ls->open_files.push_back(&in->xlist_open_file);
+      } else {
+       /*
+        * we can get a capless inode here if we replay an open file, the client fails to
+        * reconnect it, but does REPLAY an open request (that adds it to the logseg).  AFAICS
+        * it's ok for the client to replay an open on a file it doesn't have in it's cache
+        * anymore.
+        *
+        * this makes the mds less sensitive to strict open_file consistency, although it does
+        * make it easier to miss subtle problems.
+        */
+       dout(20) << "try_to_expire not requeueing and delisting capless file " << *in << dendl;
+       in->xlist_open_file.remove_myself();
+      }
     }
     if (le) {
       if (!gather) gather = new C_Gather;