xfs: Fix file type directory corruption for btree directories
authorJan Kara <jack@suse.com>
Tue, 25 Aug 2015 00:05:13 +0000 (10:05 +1000)
committerDave Chinner <david@fromorbit.com>
Tue, 25 Aug 2015 00:05:13 +0000 (10:05 +1000)
commit037542345a82aaaa228ec280fe6ddff1568d169f
treeabed6c8eadeff201f27be37db709065a6e029730
parentb6a9947efdbe0c9135d94b26b2f912f5b0b9dc45
xfs: Fix file type directory corruption for btree directories

Users have occasionally reported that file type for some directory
entries is wrong. This mostly happened after updating libraries some
libraries. After some debugging the problem was traced down to
xfs_dir2_node_replace(). The function uses args->filetype as a file type
to store in the replaced directory entry however it also calls
xfs_da3_node_lookup_int() which will store file type of the current
directory entry in args->filetype. Thus we fail to change file type of a
directory entry to a proper type.

Fix the problem by storing new file type in a local variable before
calling xfs_da3_node_lookup_int().

cc: <stable@vger.kernel.org> # 3.16 - 4.x
Reported-by: Giacomo Comes <comes@naic.edu>
Signed-off-by: Jan Kara <jack@suse.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/libxfs/xfs_dir2_node.c