From 7e7a79e57b5898e374febf3a5eab576cd52b8f6a Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 13 Nov 2009 14:44:22 -0800 Subject: [PATCH] mds: don't croak on open_files without caps 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 | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/mds/journal.cc b/src/mds/journal.cc index f5b8f4b83662e..fe33f519a9777 100644 --- a/src/mds/journal.cc +++ b/src/mds/journal.cc @@ -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; -- 2.39.5