diff options
Diffstat (limited to 'fs/ceph/dir.c')
-rw-r--r-- | fs/ceph/dir.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 6da4df84ba30..45eda6d7a40c 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -100,6 +100,14 @@ static unsigned fpos_off(loff_t p) | |||
100 | return p & 0xffffffff; | 100 | return p & 0xffffffff; |
101 | } | 101 | } |
102 | 102 | ||
103 | static int fpos_cmp(loff_t l, loff_t r) | ||
104 | { | ||
105 | int v = ceph_frag_compare(fpos_frag(l), fpos_frag(r)); | ||
106 | if (v) | ||
107 | return v; | ||
108 | return (int)(fpos_off(l) - fpos_off(r)); | ||
109 | } | ||
110 | |||
103 | /* | 111 | /* |
104 | * When possible, we try to satisfy a readdir by peeking at the | 112 | * When possible, we try to satisfy a readdir by peeking at the |
105 | * dcache. We make this work by carefully ordering dentries on | 113 | * dcache. We make this work by carefully ordering dentries on |
@@ -156,7 +164,7 @@ more: | |||
156 | if (!d_unhashed(dentry) && dentry->d_inode && | 164 | if (!d_unhashed(dentry) && dentry->d_inode && |
157 | ceph_snap(dentry->d_inode) != CEPH_SNAPDIR && | 165 | ceph_snap(dentry->d_inode) != CEPH_SNAPDIR && |
158 | ceph_ino(dentry->d_inode) != CEPH_INO_CEPH && | 166 | ceph_ino(dentry->d_inode) != CEPH_INO_CEPH && |
159 | ctx->pos <= di->offset) | 167 | fpos_cmp(ctx->pos, di->offset) <= 0) |
160 | break; | 168 | break; |
161 | dout(" skipping %p %.*s at %llu (%llu)%s%s\n", dentry, | 169 | dout(" skipping %p %.*s at %llu (%llu)%s%s\n", dentry, |
162 | dentry->d_name.len, dentry->d_name.name, di->offset, | 170 | dentry->d_name.len, dentry->d_name.name, di->offset, |
@@ -695,9 +703,8 @@ static int ceph_mknod(struct inode *dir, struct dentry *dentry, | |||
695 | ceph_mdsc_put_request(req); | 703 | ceph_mdsc_put_request(req); |
696 | 704 | ||
697 | if (!err) | 705 | if (!err) |
698 | err = ceph_init_acl(dentry, dentry->d_inode, dir); | 706 | ceph_init_acl(dentry, dentry->d_inode, dir); |
699 | 707 | else | |
700 | if (err) | ||
701 | d_drop(dentry); | 708 | d_drop(dentry); |
702 | return err; | 709 | return err; |
703 | } | 710 | } |
@@ -735,7 +742,9 @@ static int ceph_symlink(struct inode *dir, struct dentry *dentry, | |||
735 | if (!err && !req->r_reply_info.head->is_dentry) | 742 | if (!err && !req->r_reply_info.head->is_dentry) |
736 | err = ceph_handle_notrace_create(dir, dentry); | 743 | err = ceph_handle_notrace_create(dir, dentry); |
737 | ceph_mdsc_put_request(req); | 744 | ceph_mdsc_put_request(req); |
738 | if (err) | 745 | if (!err) |
746 | ceph_init_acl(dentry, dentry->d_inode, dir); | ||
747 | else | ||
739 | d_drop(dentry); | 748 | d_drop(dentry); |
740 | return err; | 749 | return err; |
741 | } | 750 | } |
@@ -776,7 +785,9 @@ static int ceph_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
776 | err = ceph_handle_notrace_create(dir, dentry); | 785 | err = ceph_handle_notrace_create(dir, dentry); |
777 | ceph_mdsc_put_request(req); | 786 | ceph_mdsc_put_request(req); |
778 | out: | 787 | out: |
779 | if (err < 0) | 788 | if (!err) |
789 | ceph_init_acl(dentry, dentry->d_inode, dir); | ||
790 | else | ||
780 | d_drop(dentry); | 791 | d_drop(dentry); |
781 | return err; | 792 | return err; |
782 | } | 793 | } |