Skip to content

Commit ae05327

Browse files
author
Al Viro
committed
ext4: switch to ->iterate_shared()
Note that we need relax_dir() equivalent for directories locked shared. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 9717a91 commit ae05327

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

‎fs/ext4/dir.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ static int ext4_readdir(struct file *file, struct dir_context *ctx)
266266
ctx->pos += ext4_rec_len_from_disk(de->rec_len,
267267
sb->s_blocksize);
268268
}
269-
if ((ctx->pos < inode->i_size) && !dir_relax(inode))
269+
if ((ctx->pos < inode->i_size) && !dir_relax_shared(inode))
270270
goto done;
271271
brelse(bh);
272272
bh = NULL;
@@ -644,7 +644,7 @@ int ext4_check_all_de(struct inode *dir, struct buffer_head *bh, void *buf,
644644
const struct file_operations ext4_dir_operations = {
645645
.llseek = ext4_dir_llseek,
646646
.read = generic_read_dir,
647-
.iterate = ext4_readdir,
647+
.iterate_shared = ext4_readdir,
648648
.unlocked_ioctl = ext4_ioctl,
649649
#ifdef CONFIG_COMPAT
650650
.compat_ioctl = ext4_compat_ioctl,

‎include/linux/fs.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3134,6 +3134,13 @@ static inline bool dir_relax(struct inode *inode)
31343134
return !IS_DEADDIR(inode);
31353135
}
31363136

3137+
static inline bool dir_relax_shared(struct inode *inode)
3138+
{
3139+
inode_unlock_shared(inode);
3140+
inode_lock_shared(inode);
3141+
return !IS_DEADDIR(inode);
3142+
}
3143+
31373144
extern bool path_noexec(const struct path *path);
31383145
extern void inode_nohighmem(struct inode *inode);
31393146

0 commit comments

Comments
 (0)