diff options
author | Yan, Zheng <zyan@redhat.com> | 2015-01-19 00:12:24 -0500 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2015-02-19 05:31:39 -0500 |
commit | 2f92b3d0a9a583a5a4dd786a84fc42e6f1aa40fa (patch) | |
tree | 3e53915348d4181da3b54982ec6fceb2fcbdbd3f /fs/ceph | |
parent | a6a5ce4f0df9146ba8cb61121b80aa191fbb1f04 (diff) |
ceph: properly mark empty directory as complete
ceph_add_cap() calls __check_cap_issue(), which clears directory
inode' complete flag. so we should set the complete flag for empty
directory should be set after calling ceph_add_cap().
Signed-off-by: Yan, Zheng <zyan@redhat.com>
Diffstat (limited to 'fs/ceph')
-rw-r--r-- | fs/ceph/inode.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index d0fe2f437fbb..f88a0f059dc8 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
@@ -840,30 +840,31 @@ static int fill_inode(struct inode *inode, struct page *locked_page, | |||
840 | ceph_vinop(inode), inode->i_mode); | 840 | ceph_vinop(inode), inode->i_mode); |
841 | } | 841 | } |
842 | 842 | ||
843 | /* set dir completion flag? */ | ||
844 | if (S_ISDIR(inode->i_mode) && | ||
845 | ci->i_files == 0 && ci->i_subdirs == 0 && | ||
846 | ceph_snap(inode) == CEPH_NOSNAP && | ||
847 | (le32_to_cpu(info->cap.caps) & CEPH_CAP_FILE_SHARED) && | ||
848 | (issued & CEPH_CAP_FILE_EXCL) == 0 && | ||
849 | !__ceph_dir_is_complete(ci)) { | ||
850 | dout(" marking %p complete (empty)\n", inode); | ||
851 | __ceph_dir_set_complete(ci, atomic_read(&ci->i_release_count), | ||
852 | ci->i_ordered_count); | ||
853 | } | ||
854 | |||
855 | /* were we issued a capability? */ | 843 | /* were we issued a capability? */ |
856 | if (info->cap.caps) { | 844 | if (info->cap.caps) { |
857 | if (ceph_snap(inode) == CEPH_NOSNAP) { | 845 | if (ceph_snap(inode) == CEPH_NOSNAP) { |
846 | unsigned caps = le32_to_cpu(info->cap.caps); | ||
858 | ceph_add_cap(inode, session, | 847 | ceph_add_cap(inode, session, |
859 | le64_to_cpu(info->cap.cap_id), | 848 | le64_to_cpu(info->cap.cap_id), |
860 | cap_fmode, | 849 | cap_fmode, caps, |
861 | le32_to_cpu(info->cap.caps), | ||
862 | le32_to_cpu(info->cap.wanted), | 850 | le32_to_cpu(info->cap.wanted), |
863 | le32_to_cpu(info->cap.seq), | 851 | le32_to_cpu(info->cap.seq), |
864 | le32_to_cpu(info->cap.mseq), | 852 | le32_to_cpu(info->cap.mseq), |
865 | le64_to_cpu(info->cap.realm), | 853 | le64_to_cpu(info->cap.realm), |
866 | info->cap.flags, &new_cap); | 854 | info->cap.flags, &new_cap); |
855 | |||
856 | /* set dir completion flag? */ | ||
857 | if (S_ISDIR(inode->i_mode) && | ||
858 | ci->i_files == 0 && ci->i_subdirs == 0 && | ||
859 | (caps & CEPH_CAP_FILE_SHARED) && | ||
860 | (issued & CEPH_CAP_FILE_EXCL) == 0 && | ||
861 | !__ceph_dir_is_complete(ci)) { | ||
862 | dout(" marking %p complete (empty)\n", inode); | ||
863 | __ceph_dir_set_complete(ci, | ||
864 | atomic_read(&ci->i_release_count), | ||
865 | ci->i_ordered_count); | ||
866 | } | ||
867 | |||
867 | wake = true; | 868 | wake = true; |
868 | } else { | 869 | } else { |
869 | dout(" %p got snap_caps %s\n", inode, | 870 | dout(" %p got snap_caps %s\n", inode, |