diff options
| -rw-r--r-- | fs/overlayfs/readdir.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c index 8c8ce9d87ba3..3fbf0d306e12 100644 --- a/fs/overlayfs/readdir.c +++ b/fs/overlayfs/readdir.c | |||
| @@ -21,9 +21,10 @@ struct ovl_cache_entry { | |||
| 21 | unsigned int len; | 21 | unsigned int len; |
| 22 | unsigned int type; | 22 | unsigned int type; |
| 23 | u64 ino; | 23 | u64 ino; |
| 24 | bool is_whiteout; | ||
| 25 | struct list_head l_node; | 24 | struct list_head l_node; |
| 26 | struct rb_node node; | 25 | struct rb_node node; |
| 26 | bool is_whiteout; | ||
| 27 | bool is_cursor; | ||
| 27 | char name[]; | 28 | char name[]; |
| 28 | }; | 29 | }; |
| 29 | 30 | ||
| @@ -251,7 +252,7 @@ static int ovl_dir_mark_whiteouts(struct dentry *dir, | |||
| 251 | 252 | ||
| 252 | mutex_lock(&dir->d_inode->i_mutex); | 253 | mutex_lock(&dir->d_inode->i_mutex); |
| 253 | list_for_each_entry(p, rdd->list, l_node) { | 254 | list_for_each_entry(p, rdd->list, l_node) { |
| 254 | if (!p->name) | 255 | if (p->is_cursor) |
| 255 | continue; | 256 | continue; |
| 256 | 257 | ||
| 257 | if (p->type != DT_CHR) | 258 | if (p->type != DT_CHR) |
| @@ -307,7 +308,6 @@ static inline int ovl_dir_read_merged(struct path *upperpath, | |||
| 307 | } | 308 | } |
| 308 | out: | 309 | out: |
| 309 | return err; | 310 | return err; |
| 310 | |||
| 311 | } | 311 | } |
| 312 | 312 | ||
| 313 | static void ovl_seek_cursor(struct ovl_dir_file *od, loff_t pos) | 313 | static void ovl_seek_cursor(struct ovl_dir_file *od, loff_t pos) |
| @@ -316,7 +316,7 @@ static void ovl_seek_cursor(struct ovl_dir_file *od, loff_t pos) | |||
| 316 | loff_t off = 0; | 316 | loff_t off = 0; |
| 317 | 317 | ||
| 318 | list_for_each_entry(p, &od->cache->entries, l_node) { | 318 | list_for_each_entry(p, &od->cache->entries, l_node) { |
| 319 | if (!p->name) | 319 | if (p->is_cursor) |
| 320 | continue; | 320 | continue; |
| 321 | if (off >= pos) | 321 | if (off >= pos) |
| 322 | break; | 322 | break; |
| @@ -389,7 +389,7 @@ static int ovl_iterate(struct file *file, struct dir_context *ctx) | |||
| 389 | 389 | ||
| 390 | p = list_entry(od->cursor.l_node.next, struct ovl_cache_entry, l_node); | 390 | p = list_entry(od->cursor.l_node.next, struct ovl_cache_entry, l_node); |
| 391 | /* Skip cursors */ | 391 | /* Skip cursors */ |
| 392 | if (p->name) { | 392 | if (!p->is_cursor) { |
| 393 | if (!p->is_whiteout) { | 393 | if (!p->is_whiteout) { |
| 394 | if (!dir_emit(ctx, p->name, p->len, p->ino, p->type)) | 394 | if (!dir_emit(ctx, p->name, p->len, p->ino, p->type)) |
| 395 | break; | 395 | break; |
| @@ -519,6 +519,7 @@ static int ovl_dir_open(struct inode *inode, struct file *file) | |||
| 519 | od->realfile = realfile; | 519 | od->realfile = realfile; |
| 520 | od->is_real = (type != OVL_PATH_MERGE); | 520 | od->is_real = (type != OVL_PATH_MERGE); |
| 521 | od->is_upper = (type != OVL_PATH_LOWER); | 521 | od->is_upper = (type != OVL_PATH_LOWER); |
| 522 | od->cursor.is_cursor = true; | ||
| 522 | file->private_data = od; | 523 | file->private_data = od; |
| 523 | 524 | ||
| 524 | return 0; | 525 | return 0; |
