reiserfs: fix race in readdir
authorJeff Mahoney <jeffm@suse.com>
Wed, 2 Apr 2014 18:40:26 +0000 (14:40 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 6 May 2014 14:55:30 +0000 (07:55 -0700)
commit1d06be05aadf7f66d8415f8e803a28495082dcfe
treeed4df72f1a3237f3845e117f9891352c8ec0597e
parent35d5134b7d5a55e269c953096224248b9f6f72c2
reiserfs: fix race in readdir

commit 01d8885785a60ae8f4c37b0ed75bdc96d0fc6a44 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>
fs/reiserfs/dir.c