mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
reiserfs: fix race in readdir
commit 01d8885785
upstream.
jdm-20004 reiserfs_delete_xattrs: Couldn't delete all xattrs (-2)
The -ENOENT is due to readdir calling dir_emit on the same entry twice.
If the dir_emit callback sleeps and the tree is changed underneath us,
we won't be able to trust deh_offset(deh) anymore. We need to save
next_pos before we might sleep so we can find the next entry.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
86455b800f
commit
15e5f90c0f
1 changed files with 4 additions and 2 deletions
|
@ -128,6 +128,7 @@ int reiserfs_readdir_dentry(struct dentry *dentry, void *dirent,
|
|||
char *d_name;
|
||||
off_t d_off;
|
||||
ino_t d_ino;
|
||||
loff_t cur_pos = deh_offset(deh);
|
||||
|
||||
if (!de_visible(deh))
|
||||
/* it is hidden entry */
|
||||
|
@ -200,8 +201,9 @@ int reiserfs_readdir_dentry(struct dentry *dentry, void *dirent,
|
|||
if (local_buf != small_buf) {
|
||||
kfree(local_buf);
|
||||
}
|
||||
// next entry should be looked for with such offset
|
||||
next_pos = deh_offset(deh) + 1;
|
||||
|
||||
/* deh_offset(deh) may be invalid now. */
|
||||
next_pos = cur_pos + 1;
|
||||
|
||||
if (item_moved(&tmp_ih, &path_to_entry)) {
|
||||
goto research;
|
||||
|
|
Loading…
Reference in a new issue