From owner-freebsd-hackers Wed Apr 7 18:43:33 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from huset.math.ntnu.no (huset.math.ntnu.no [129.241.211.212]) by hub.freebsd.org (Postfix) with SMTP id 85F5B14E65 for ; Wed, 7 Apr 1999 18:43:11 -0700 (PDT) (envelope-from perhov@stud.math.ntnu.no) Received: (qmail 11065 invoked by uid 29119); 8 Apr 1999 01:41:11 -0000 Date: Thu, 8 Apr 1999 03:41:10 +0200 (MET DST) From: Per Kristian Hove X-Sender: perhov@huset.math.ntnu.no To: freebsd-hackers@freebsd.org Subject: data corruption using loopback fs Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I'm experiencing severe data corruption when I use loopback mounting of filesystes. Am I doing anything really really wrong, or is there a problem with nullfs? I'm running 3.1-RELEASE. I have a filesystem /export, and my homedir is /home/a/perhov. When /home/a is a symlink to /export/home/a, everything works fine: perhov@phi:~$ pwd /home/a/perhov perhov@phi:~$ ls -l /home/a lrwxr-xr-x 1 root wheel 14 Apr 8 02:41 /home/a -> /export/home/a perhov@phi:~$ df . Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/wd0s4f 6222892 4970752 754309 87% /export perhov@phi:~$ md5sum foo 5c137d93793d1c6b75344de07f4ccb76 foo perhov@phi:~$ cp foo bar perhov@phi:~$ md5sum foo bar 5c137d93793d1c6b75344de07f4ccb76 foo 5c137d93793d1c6b75344de07f4ccb76 bar But when /export/home/a is mounted on /home/a, it fails: phi:~# cd /home phi:/home# ls a@ b@ phi:/home# rm a phi:/home# mkdir a phi:/home# mount_null /export/home/a /home/a perhov@phi:~$ md5sum foo 5c137d93793d1c6b75344de07f4ccb76 foo perhov@phi:~$ cp foo bar cp: bar: Bad address perhov@phi:~$ md5sum foo bar 5c137d93793d1c6b75344de07f4ccb76 foo d41d8cd98f00b204e9800998ecf8427e bar and the file 'bar' is empty. syslog says: Apr 8 02:43:59 phi /kernel: vm_fault: pager read error, pid 327 (cp) It also happens when mounting /export itself and not a subdirectory: /export mounted onto /mnt2: phi:/mnt2# mount | grep mnt2 /export on /mnt2 (local) phi:/mnt2# df . Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/wd0s4f 6222892 5074152 650909 89% /export phi:/mnt2# cp foo bar (this time no kernel messages appears, and 'bar' is the same size as 'foo') phi:/mnt2# md5sum foo bar 58e14256750b3eb43079de73dc14e616 foo eef586fa9bfd12b496912e78e4e2680f bar phi:/mnt2# md5sum foo bar 58e14256750b3eb43079de73dc14e616 foo eef586fa9bfd12b496912e78e4e2680f bar well, at least it's equally wrong for both invocations of md5sum. I copy the file again: phi:/mnt2# cp foo bar phi:/mnt2# md5sum foo bar 58e14256750b3eb43079de73dc14e616 foo ada96c644ec1992213c61a87c1e1d744 bar and now it's different. But when I try to copy the file in /export, not in /mnt2, it works fine: phi:/mnt2# cd /export phi:/export# cp foo bar phi:/export# md5sum foo bar 58e14256750b3eb43079de73dc14e616 foo 58e14256750b3eb43079de73dc14e616 bar Strange. Then, when I go back to /mnt2 and tries again, it also works fine there, presumably because it's in the cache. If this unexpected behaviour is a bug, is it fixed in 3.1-STABLE? If it's not a bug, what am I doing wrong? Most of the times i try, it only says cp: bar: Bad address and the destination file ends up empty. I didn't save the "wrong" bar-file, but from taking a quick glance at its contents, it seemed that the beginning of the file was damaged, but the end was okay. -- per kristian To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message