Bug 16014

Summary: [Regression] `mount --bind` no longer works with files in 2.6.34
Product: File System Reporter: Adam Tkac (vonsch)
Component: VFSAssignee: fs_vfs
Status: CLOSED CODE_FIX    
Severity: normal CC: akpm, maciej.rutecki, rjw
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.34 Subsystem:
Regression: Yes Bisected commit-id:
Bug Depends on:    
Bug Blocks: 15310    
Attachments: Reproducer

Description Adam Tkac 2010-05-20 12:53:58 UTC
In 2.6.34-rc7 `mount --bind` worked fine with both directories and files but in 2.6.34 it no longer works with files.

Version:
vanilla 2.6.34 kernel, compiled with gcc 4.4.4 (gcc version 4.4.4 20100514 (Red Hat 4.4.4-3))

Steps to reproduce:
1. $ echo 'asd' > file1
2. $ touch file2
3. $ mount --bind file1 file2

I bisected 2.6.34-rc7 (good) and 2.6.34 (bad) kernels and I've found commit which caused this regression. It's:

commit d83c49f3e36cecd2e8823b6c48ffba083b8a5704
Author: Al Viro <viro@zeniv.linux.org.uk>
Date:   Fri Apr 30 17:17:09 2010 -0400

    Fix the regression created by "set S_DEAD on unlink()..." commit

Feel free to ask me if you need more information.
Comment 1 Adam Tkac 2010-05-20 13:04:16 UTC
(In reply to comment #0)
> Steps to reproduce:
> 1. $ echo 'asd' > file1
> 2. $ touch file2
> 3. $ mount --bind file1 file2

Hm, after little more inspection this is not sufficient reproducer, I will attach a script which triggers this bug.
Comment 2 Adam Tkac 2010-05-20 13:16:09 UTC
Created attachment 26457 [details]
Reproducer

This is part of the /etc/init.d/named init script used in Fedora 13 and newer. 

Use it this way (on Fedora system)

1. rm -rf /var/named/chroot/
2. create non-empty files /etc/named.conf, /etc/named.dnssec.keys, /etc/named.rfc1912.zones, /etc/rndc.conf, /etc/rndc.key and /etc/named.iscdlv.key
3. create directories /etc/named, /etc/pki/dnssec-keys
4. execute the script twice

You will see following:

[root@evileye atkac]# ./reproducer 
[root@evileye atkac]# ./reproducer 
mount: No such file or directory
mount: No such file or directory
mount: No such file or directory
mount: No such file or directory
mount: No such file or directory
Comment 3 Rafael J. Wysocki 2010-06-13 11:40:52 UTC
Presumably fixed in 2.6.34 (final) or 2.6.35-rc1.