]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
xfs: dirent dtype presence is dependent on directory magic numbers
authorDave Chinner <dchinner@redhat.com>
Sun, 29 Sep 2013 23:37:04 +0000 (09:37 +1000)
committerBen Myers <bpm@sgi.com>
Fri, 4 Oct 2013 18:55:48 +0000 (13:55 -0500)
commit6d313498f035abc9d8ad3a1b3295f133bfab9638
tree3e463fde556205e48fe9b01dd4dabb7a249f778e
parent89c6c89af2ef41cb127c9694ef7783e585e96337
xfs: dirent dtype presence is dependent on directory magic numbers

The determination of whether a directory entry contains a dtype
field originally was dependent on the filesystem having CRCs
enabled. This meant that the format for dtype beign enabled could be
determined by checking the directory block magic number rather than
doing a feature bit check. This was useful in that it meant that we
didn't need to pass a struct xfs_mount around to functions that
were already supplied with a directory block header.

Unfortunately, the introduction of dtype fields into the v4
structure via a feature bit meant this "use the directory block
magic number" method of discriminating the dirent entry sizes is
broken. Hence we need to convert the places that use magic number
checks to use feature bit checks so that they work correctly and not
by chance.

The current code works on v4 filesystems only because the dirent
size roundup covers the extra byte needed by the dtype field in the
places where this problem occurs.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
(cherry picked from commit 367993e7c6428cb7617ab7653d61dca54e2fdede)
fs/xfs/xfs_dir2_block.c
fs/xfs/xfs_dir2_format.h
fs/xfs/xfs_dir2_readdir.c
fs/xfs/xfs_dir2_sf.c