diff options
author | Sage Weil <sage@inktank.com> | 2013-01-19 10:04:05 -0800 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-02-04 12:09:51 -0800 |
commit | 0407af4641ea19697f8feb0f48a92cde8dd4fbe4 (patch) | |
tree | 80db7f01df87561f3e25af17297bed5739c37e6b | |
parent | 8ce834d3f50b00fdd59cd237f3fb5fef1d57e1dd (diff) | |
download | ceph-0407af4641ea19697f8feb0f48a92cde8dd4fbe4.tar.gz |
mds: fix client view of dir layout when layout is removed
We weren't handling the case where the projected node has NULL for the
layout properly. Fixes the client's view when we remove the dir layout.
Signed-off-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 09f28541e374ffac198e4d48082b064aae93cb2c)
-rw-r--r-- | src/mds/CInode.cc | 11 | ||||
-rw-r--r-- | src/mds/CInode.h | 6 |
2 files changed, 10 insertions, 7 deletions
diff --git a/src/mds/CInode.cc b/src/mds/CInode.cc index af70b681ffc..e72d419784c 100644 --- a/src/mds/CInode.cc +++ b/src/mds/CInode.cc @@ -2663,13 +2663,14 @@ int CInode::encode_inodestat(bufferlist& bl, Session *session, i = pfile ? pi:oi; if (is_file()) { e.layout = i->layout; - } else { - if (ppolicy && get_projected_dir_layout()) - e.layout = *get_projected_dir_layout(); - else if (default_layout) - e.layout = default_layout->layout; + } else if (is_dir()) { + ceph_file_layout *l = ppolicy ? get_projected_dir_layout() : ( default_layout ? &default_layout->layout : NULL ); + if (l) + e.layout = *l; else memset(&e.layout, 0, sizeof(e.layout)); + } else { + memset(&e.layout, 0, sizeof(e.layout)); } e.size = i->size; e.truncate_seq = i->truncate_seq; diff --git a/src/mds/CInode.h b/src/mds/CInode.h index e43ecf50fa3..ceb551071a4 100644 --- a/src/mds/CInode.h +++ b/src/mds/CInode.h @@ -279,7 +279,8 @@ public: } ceph_file_layout *get_projected_dir_layout() { - if (!inode.is_dir()) return NULL; + if (!inode.is_dir()) + return NULL; if (projected_nodes.empty()) { if (default_layout) return &default_layout->layout; @@ -288,7 +289,8 @@ public: } else if (projected_nodes.back()->dir_layout) return &projected_nodes.back()->dir_layout->layout; - else return NULL; + else + return NULL; } version_t get_projected_version() { |