reiserfs: fix race in readdir
authorJeff Mahoney <jeffm@suse.com>
Wed, 2 Apr 2014 18:40:26 +0000 (14:40 -0400)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 30 Apr 2014 15:23:25 +0000 (16:23 +0100)
commit078a6830af35e480d2882ad08cede954bb84ad64
treeece4d075cc5c997b6ce80861897eb371641c0554
parent47b1cf907952463052def12fca6a07f7df0c34c4
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: Ben Hutchings <ben@decadent.org.uk>
fs/reiserfs/dir.c