Bug 15789 - Bind mounts broken when used with NFSv4
Bind mounts broken when used with NFSv4
Status: CLOSED CODE_FIX
Product: File System
Classification: Unclassified
Component: NFS
All Linux
: P1 high
Assigned To: Trond Myklebust
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-04-15 14:33 UTC by Ian Dall
Modified: 2012-05-14 17:23 UTC (History)
1 user (show)

See Also:
Kernel Version: 2.6.32.9-70
Tree: Fedora
Regression: No


Attachments
Dont' do atomic open on a mountpoint (721 bytes, patch)
2010-04-15 20:13 UTC, Trond Myklebust
Details | Diff

Description Ian Dall 2010-04-15 14:33:17 UTC
There is some serious weirdness if you try and use bind mounts in conjunction with nfs4 mounts.

 $ df -T /var/tmp
Filesystem    Type   1K-blocks      Used Available Use% Mounted on
fs.beware.dropbear.id.au:/tmp/
              nfs4     5160576    403968   4494464   9% /var/tmp
 $ df -T /tmp
Filesystem    Type   1K-blocks      Used Available Use% Mounted on
/tmp         tmpfs      921600         4    921596   1% /tmp
 $ cat /tmp/foo
Over The Lazy Dogs Back
 $ cat /var/tmp/foo
The Quick Brown Fox
#
# So /var/tmp/foo is on an nfs4 mounted filesystem
# /tmp/foo is on a tmpfs. Both files are different.
#
 $ mount --bind /tmp/foo /var/tmp/foo
 $ cat /tmp/foo
Over The Lazy Dogs Back
 $ cat /var/tmp/foo
The Quick Brown Fox
#
# Both files should be the same. ie "Over The Lazy Dogs Back"
#
# In other oddity, ls -l correctly shows both files the same size (31),
# and ls -i correctly shows both have the same inode number, yet:
 $ cat /tmp/foo | wc -c
31
 $ cat /var/tmp/foo | wc -c
20
#
# So much for reading. Now what about writing?
#
 $ echo blah blah > /var/tmp/foo
 $ cat /var/tmp/foo
blah blah
Brown Fox
#
# This should have been truncated
#
 $ cat /tmp/foo
#
# /tmp/foo has been truncated, but it should have "blah blah" in it
#
 $ umount /var/tmp/foo
 $ cat /var/tmp/foo
blah blah
Brown Fox
 $cat /tmp/foo
# Empty
Comment 1 Trond Myklebust 2010-04-15 20:13:10 UTC
Created attachment 26023 [details]
Dont' do atomic open on a mountpoint
Comment 2 Trond Myklebust 2010-04-15 20:13:40 UTC
Does the above patch fix the bug?
Comment 3 Ian Dall 2010-04-15 23:14:30 UTC
That's an impressively quick turn around! Unfortunately, it'll take a bit longer to build and test.
Comment 4 Ian Dall 2010-04-17 03:54:51 UTC
That work fine. Thanks!

Note You need to log in before you can comment on or make changes to this bug.