mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 10:57:46 +00:00
xfs: fix the same_inode check in xfs_file_share_range
The VFS i_ino is an unsigned long, while XFS inode numbers are 64-bit wide, so checking i_ino for equality could lead to rate false positives on 32-bit architectures. Just compare the inode pointers themselves to be safe. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
parent
4fbc2c6525
commit
a62e82b35b
1 changed files with 1 additions and 1 deletions
|
@ -965,7 +965,7 @@ xfs_file_share_range(
|
||||||
IS_SWAPFILE(inode_out))
|
IS_SWAPFILE(inode_out))
|
||||||
return -ETXTBSY;
|
return -ETXTBSY;
|
||||||
|
|
||||||
same_inode = (inode_in->i_ino == inode_out->i_ino);
|
same_inode = (inode_in == inode_out);
|
||||||
|
|
||||||
/* Don't reflink dirs, pipes, sockets... */
|
/* Don't reflink dirs, pipes, sockets... */
|
||||||
if (S_ISDIR(inode_in->i_mode) || S_ISDIR(inode_out->i_mode))
|
if (S_ISDIR(inode_in->i_mode) || S_ISDIR(inode_out->i_mode))
|
||||||
|
|
Loading…
Reference in a new issue