From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37639) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqNq1-0003MH-SZ for qemu-devel@nongnu.org; Tue, 10 Dec 2013 08:59:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VqNpw-0003bK-Ez for qemu-devel@nongnu.org; Tue, 10 Dec 2013 08:59:01 -0500 Received: from mail-pb0-x235.google.com ([2607:f8b0:400e:c01::235]:45853) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VqNpw-0003bG-7X for qemu-devel@nongnu.org; Tue, 10 Dec 2013 08:58:56 -0500 Received: by mail-pb0-f53.google.com with SMTP id ma3so7652208pbc.26 for ; Tue, 10 Dec 2013 05:58:55 -0800 (PST) Message-ID: <52A71E14.6060907@gmail.com> Date: Tue, 10 Dec 2013 21:58:44 +0800 From: lijun MIME-Version: 1.0 References: <52864C79.20800@gmail.com> <52864EEE.3000900@redhat.com> <52865824.7070600@redhat.com> <20131118133133.GB31173@stefanha-thinkpad.hitronhub.home> <20131209121729.GA9611@stefanha-thinkpad.redhat.com> In-Reply-To: <20131209121729.GA9611@stefanha-thinkpad.redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] HMP: snapshot_blkdev can not consider //root/sn1 and /root/sn1 as the same file List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: lcapitulino@redhat.com, qemu-devel@nongnu.org, Max Reitz On 12/09/2013 08:17 PM, Stefan Hajnoczi wrote: > On Mon, Dec 09, 2013 at 02:06:21PM +0800, jun muzi wrote: >> If mount a local file(disk) in two different dirctories, it is similar to the >> network storage. Detecting identical "files" is still a problem. >> Such as: >> dd if=/dev/zero of=aa bs=1M count=10 >> mkfs.ext4 aa >> Then mount aa to two directories. >> mount aa /mnt/dir1 >> mount aa /mnt/dir2 > (Off-topic, but you should never mount a regular file system read/write > more than once at a time. This example is wrong, it can corrupt the > file system.) yes, I should not to mount a regular file more than once at a time. But I just want to say the network storage will be mount more than once at a time. Such as : Create a nfs server, and mount it as followings: # mount $IP:/home/ /mnt/dir1 # mount $IP:/home/ /mnt/dir2 If create a new file named test in /mnt/dir1, /mnt/dir2 will know this new file "test". So the linux kernel can know the file in /mnt/dir1 and /mnt/dir2 whether it is the same file or not. Based on above info, qemu-kvm can know whether file1 in /mnt/dir1 and file2 in /mnt/dir2 are the same file or not. How do qemu-kvm distinguish between file1 and file2 is the problem we should solve. To solve this issue, maybe could refer to the linux kernel. But I don't know now. ---- How to fix this bug: 1, realpath() ---- string-only detection 2, hard/soft link. ----maybe ref https://lists.gnu.org/archive/html/qemu-devel/2013-11/msg01840.html 3, distinguish network storage file mounted on different dir is the same file or not. > My question was about the bug. What is the problem you are seeing and > how do you reproduce it (including the HMP commands)? Now I am seeing is how to "distinguish network storage file mounted on different dir is the same file or not". Reproduce this bug using nfs mounted in different directories: Create a nfs server, and mount it as followings: # mount $IP:/home/ /mnt/dir1 # mount $IP:/home/ /mnt/dir2 (qemu) snapshot_blkdev drive-scsi0-0-0 /mnt/dir1/sn1 Formatting '/mnt/dir1/sn1', fmt=qcow2 size=32212254720 backing_file='/home/juli/RHEL-7.0-20131127.1.qcow2_v3' backing_fmt='qcow2' encryption=off cluster_size=65536 lazy_refcounts=off (qemu) snapshot_blkdev drive-scsi0-0-0 /mnt/dir2/sn1 Formatting '/mnt/dir2/sn1', fmt=qcow2 size=32212254720 backing_file='/mnt/dir1/sn1' backing_fmt='qcow2' encryption=off cluster_size=65536 lazy_refcounts=off (qemu) info block drive-scsi0-0-0: removable=0 io-status=ok file=/mnt/dir2/sn1 backing_file=/mnt/dir1/sn1 backing_file_depth=2 ro=0 drv=qcow2 encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0 drive-virtio-disk1: removable=0 io-status=ok file=/home/juli/data_disk.qcow2_v3 ro=0 drv=qcow2 encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0 ide1-cd0: removable=1 locked=0 tray-open=0 io-status=ok [not inserted] floppy0: removable=1 locked=0 tray-open=0 [not inserted] sd0: removable=1 locked=0 tray-open=0 [not inserted] (qemu) snapshot_blkdev drive-scsi0-0-0 /mnt/dir2/sn2 Could not open '/mnt/dir2/sn1': Could not set AIO state: Too many open files: Too many open files Best Regards, Jun Li > > Stefan