diff --git a/pseudo_db.c b/pseudo_db.c
index 9713e0c..6a33f20 100644
--- a/pseudo_db.c
+++ b/pseudo_db.c
@@ -2196,7 +2196,9 @@ pdb_update_inode(pseudo_msg_t *msg) {
 	found_existing = !pdb_find_file_path(oldmsg);
 	if (found_existing) {
 		/* we have an existing file entry */
-		pdb_copy_xattrs(oldmsg, msg);
+		if (oldmsg->dev != msg->dev || oldmsg->ino != msg->ino) {
+			pdb_copy_xattrs(oldmsg, msg);
+		}
 	}
 	sqlite3_bind_int(update, 1, msg->dev);
 	sqlite3_bind_int64(update, 2, signed_ino(msg->ino));
diff --git a/test/test-xattr.sh b/test/test-xattr.sh
index 6ac6b3c..89fbd35 100755
--- a/test/test-xattr.sh
+++ b/test/test-xattr.sh
@@ -65,6 +65,18 @@ then
     exit 1
 fi
 
+mv f1 f2
+attrs=`getfattr -d -m - f2 | grep -v '^#'`
+expected=$'security.dummy="test_f2"\nuser.dummy="test_f1"'
+if [ "$attrs" != "$expected" ]
+then
+	#echo "Fail, unpexected getfattr result '$attrs'"
+	rm -f f1
+	rm -f f2
+	exit 1
+fi
+
 #echo "Passed."
 rm -f f1
+rm -f f2
 exit 0
