diff options
-rw-r--r-- | fs/ecryptfs/file.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c index 9244d653743e..eb3dc4c7ac06 100644 --- a/fs/ecryptfs/file.c +++ b/fs/ecryptfs/file.c | |||
@@ -71,12 +71,11 @@ struct ecryptfs_getdents_callback { | |||
71 | void *dirent; | 71 | void *dirent; |
72 | struct dentry *dentry; | 72 | struct dentry *dentry; |
73 | filldir_t filldir; | 73 | filldir_t filldir; |
74 | int err; | ||
75 | int filldir_called; | 74 | int filldir_called; |
76 | int entries_written; | 75 | int entries_written; |
77 | }; | 76 | }; |
78 | 77 | ||
79 | /* Inspired by generic filldir in fs/readir.c */ | 78 | /* Inspired by generic filldir in fs/readdir.c */ |
80 | static int | 79 | static int |
81 | ecryptfs_filldir(void *dirent, const char *name, int namelen, loff_t offset, | 80 | ecryptfs_filldir(void *dirent, const char *name, int namelen, loff_t offset, |
82 | u64 ino, unsigned int d_type) | 81 | u64 ino, unsigned int d_type) |
@@ -125,18 +124,18 @@ static int ecryptfs_readdir(struct file *file, void *dirent, filldir_t filldir) | |||
125 | buf.dirent = dirent; | 124 | buf.dirent = dirent; |
126 | buf.dentry = file->f_path.dentry; | 125 | buf.dentry = file->f_path.dentry; |
127 | buf.filldir = filldir; | 126 | buf.filldir = filldir; |
128 | retry: | ||
129 | buf.filldir_called = 0; | 127 | buf.filldir_called = 0; |
130 | buf.entries_written = 0; | 128 | buf.entries_written = 0; |
131 | buf.err = 0; | ||
132 | rc = vfs_readdir(lower_file, ecryptfs_filldir, (void *)&buf); | 129 | rc = vfs_readdir(lower_file, ecryptfs_filldir, (void *)&buf); |
133 | if (buf.err) | ||
134 | rc = buf.err; | ||
135 | if (buf.filldir_called && !buf.entries_written) | ||
136 | goto retry; | ||
137 | file->f_pos = lower_file->f_pos; | 130 | file->f_pos = lower_file->f_pos; |
131 | if (rc < 0) | ||
132 | goto out; | ||
133 | if (buf.filldir_called && !buf.entries_written) | ||
134 | goto out; | ||
138 | if (rc >= 0) | 135 | if (rc >= 0) |
139 | fsstack_copy_attr_atime(inode, lower_file->f_path.dentry->d_inode); | 136 | fsstack_copy_attr_atime(inode, |
137 | lower_file->f_path.dentry->d_inode); | ||
138 | out: | ||
140 | return rc; | 139 | return rc; |
141 | } | 140 | } |
142 | 141 | ||