linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: linux-xfs@vger.kernel.org
Cc: darrick.wong@oracle.com
Subject: [PATCH 2/5] xfs: fix the same_inode check in xfs_file_share_range
Date: Wed, 19 Oct 2016 14:47:25 +0200	[thread overview]
Message-ID: <1476881248-18669-3-git-send-email-hch@lst.de> (raw)
In-Reply-To: <1476881248-18669-1-git-send-email-hch@lst.de>

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>
---
 fs/xfs/xfs_file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 20563f2..012a960 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -1003,7 +1003,7 @@ xfs_file_share_range(
 	    IS_SWAPFILE(inode_out))
 		return -ETXTBSY;
 
-	same_inode = (inode_in->i_ino == inode_out->i_ino);
+	same_inode = (inode_in == inode_out);
 
 	/* Don't reflink dirs, pipes, sockets... */
 	if (S_ISDIR(inode_in->i_mode) || S_ISDIR(inode_out->i_mode))
-- 
2.1.4


  parent reply	other threads:[~2016-10-19 14:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-19 12:47 fix locking for the reflink operation V2 Christoph Hellwig
2016-10-19 12:47 ` [PATCH 1/5] xfs: remove the same fs check from xfs_file_share_range Christoph Hellwig
2016-10-19 12:47 ` Christoph Hellwig [this message]
2016-10-19 12:47 ` [PATCH 3/5] xfs: move inode locking from xfs_reflink_remap_range to xfs_file_share_range Christoph Hellwig
2016-10-19 12:47 ` [PATCH 4/5] xfs: remove xfs_file_wait_for_io Christoph Hellwig
2016-10-19 15:24   ` Darrick J. Wong
2016-10-19 12:47 ` [PATCH 5/5] xfs: merge xfs_reflink_remap_range and xfs_file_share_range Christoph Hellwig
2016-10-19 15:53   ` Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1476881248-18669-3-git-send-email-hch@lst.de \
    --to=hch@lst.de \
    --cc=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).