Hi everybody,

I am a happy user of aufs for our Gibraltar firewall distribution. However, 
there is one issue that I have not managed to solve so far. aufs code has been 
taken from CVS head as of today (2009-04-17) with kernel 2.6.28.9 with only a 
few patches (including PaX).

[~]# modinfo aufs
filename:       /lib/modules/2.6.28.9/kernel/fs/aufs/aufs.ko
version:        20090126
description:    aufs -- Another unionfs
author:         Junjiro Okajima
license:        GPL
srcversion:     E3370452FEAC89EDB52A420
depends:        exportfs
vermagic:       2.6.28.9 SMP preempt mod_unload 586
parm:           nwkq:the number of workqueue thread, aufsd (short)
parm:           brs:use <sysfs>/fs/aufs/si_*/brN (int)

By default, /etc and /var are mounted with aufs:

/dev/loop0 on /system/root type squashfs (ro,noatime)
tmpfs on /system/ramdisks/etc type tmpfs (rw,size=8192k,mode=755)
aufs on /etc type aufs 
(rw,si=158ccebd,xino=/system/ramdisks/etc/.aufs.xino,br:/system/ramdisks/etc=rw:/system/root/etc=rr)
tmpfs on /system/ramdisks/var type tmpfs (rw,mand,size=32768k,mode=755)
aufs on /var type aufs 
(rw,mand,si=145a95fd,xino=/system/ramdisks/var/.aufs.xino,br:/system/ramdisks/var=rw:/system/root/var=rr)
tmpfs on /var/tmp type tmpfs (rw,mand,size=32768k,mode=755)

with tmpdisk as writeable and squashfs (LZMA compressed) as the readonly 
branch.

The problem is now a specific directory under /etc:

[~]# touch /etc/gibraltar/test
[ 1574.915789] aufs au_lkup_neg:393:touch[6175]: I/O Error, b0 gibraltar 
should be negative.
touch: cannot touch `/etc/gibraltar/test': Input/output error

while all other directories under /etc are properly writable:

[~]# touch /etc/test
[~]# touch /etc/test2
[~]# touch /etc/network/test
[~]# touch /etc/init.d/test4
[~]# echo test > /etc/event.d/foo

I don't see anything special with that directory:

[~]# ls -ld /etc/gibraltar/
drwxr-xr-x 3 root root 67 Mar 24 19:15 /etc/gibraltar//

[~]# ls -l /etc/gibraltar/
total 4
-rw-r--r-- 1 root root 2164 Mar 24 19:15 config
drwxr-xr-x 2 root root    3 Sep 16  2008 patches/
-rw-r--r-- 1 root root  328 Sep 16  2008 update-excludes
-rw-r--r-- 1 root root   13 Apr 17 11:54 version

which is a direct view of the underlying readonly branch:

[~]# ls -ld /system/root/etc/gibraltar/
drwxr-xr-x 3 root root 67 Mar 24 19:15 /system/root/etc/gibraltar//
[~]# ls -l /system/root/etc/gibraltar/
total 4
-rw-r--r-- 1 root root 2164 Mar 24 19:15 config
drwxr-xr-x 2 root root    3 Sep 16  2008 patches/
-rw-r--r-- 1 root root  328 Sep 16  2008 update-excludes
-rw-r--r-- 1 root root   13 Apr 17 11:54 version

Reading from it works:

[~]# cat /etc/gibraltar/version
2.99alpha065

Interestingly, when a script tries to write to this directory with

echo `date +%s` > /etc/gibraltar/config_lastsaved
echo `date` >> /etc/gibraltar/config_lastsaved

I get the error

[ 1975.325099] aufs au_lkup_neg:393:save-config[7847]: I/O Error, b0 gibraltar 
should be negative.
/sbin/save-config: line 609: /etc/gibraltar/config_lastsaved: Input/output error

but the file appears in the read-write branch:

[~]# ls -la /system/ramdisks/etc/gibraltar/
total 4
drwxr-xr-x  2 root root  60 Apr 17 09:37 ./
drwxr-xr-x 15 root root 480 Apr 17 11:56 ../
-rw-------  1 root root  41 Apr 17 09:37 config_lastsaved

[~]# cat /system/ramdisks/etc/gibraltar/config_lastsaved
1239953831
Fri Apr 17 09:37:11 CEST 2009

but not in the aufs tree:

[~]# ls -l /etc/gibraltar/
total 4
-rw-r--r-- 1 root root 2164 Mar 24 19:15 config
drwxr-xr-x 2 root root    3 Sep 16  2008 patches/
-rw-r--r-- 1 root root  328 Sep 16  2008 update-excludes
-rw-r--r-- 1 root root   13 Apr 17 11:54 version

So, I am stumped and currently don't even have a clue on where to start 
looking. Is this a bug in the kernel module or something stupid on my side?

The only difference between this directory and others that I can think of is 
that it is the first that the bootup script tries to write to immediately after 
having mounted the /etc tree with aufs. The state immediately after mounting 
/etc is:

rootfs on / type rootfs (rw)                           
none on /sys type [   88.348768] aufs au_lkup_neg:393:prepareroot[1119]: I/O 
Error, b0 gibraltar should be negative.
sysfs (rw,nosuid,nodev,noexec)                                                  
                                    
none on /proc type proc (rw,nosuid,nodev,noexec)                                
                                    
udev on /dev type tmpfs (rw,size=10240k,mode=755)                               
                                    
/dev/hda1 on /live/image type vfat 
(ro,noatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=utf8)                
 
/dev/loop0 on /gibraltar.squashfs type squashfs (ro,noatime)                    
                                    
tmpfs on /live/cow type tmpfs (rw,noatime,mode=755)                             
                                    
/dev/loop0 on / type squashfs (ro,noatime)                                      
                                    
tmpfs on /live type tmpfs (rw)                                                  
                                    
none on /proc type proc (rw,nosuid,nodev,noexec)                                
                                    
none on /sys type sysfs (rw,nosuid,nodev,noexec)                                
                                    
udev on /dev type tmpfs (rw,size=10240k,mode=755)                               
                                    
none on /var/tmp type tmpfs (rw,size=16384k)                                    
                                    
/dev/sda1 on /mnt/configmedia type vfat 
(ro,fmask=0022,dmask=0022,codepage=cp437,iocharset=utf8)                    
/dev/loop0 on /system/root type squashfs (ro,noatime)                           
                                    
tmpfs on /system/ramdisks type tmpfs (rw,mand,size=256k,mode=755)               
                                    
tmpfs on /system/ramdisks/etc type tmpfs (rw,size=8192k,mode=755)               
                                    
aufs on /etc type aufs 
(rw,si=158ccebd,xino=/system/ramdisks/etc/.aufs.xino,br:/system/ramdisks/etc=rw:/system/root/etc=rr)

Which then causes the same error while trying to write to 
/etc/gibraltar/config_source:

/sbin/prepareroot: line 77: /etc/gibraltar/config_source: Input/output error    
                                           

which indeed doesn't appear under /etc:

total 4                                                                         
                                           
-rw-r--r-- 1 root root 2164 Mar 24 19:15 config                                 
                                           
drwxr-xr-x 2 root root    3 Sep 16  2008 patches                                
                                           
-rw-r--r-- 1 root root  328 Sep 16  2008 update-excludes                        
                                           
-rw-r--r-- 1 root root   13 Apr 17 11:54 version                                
                                           

I would highly appreciate any pointers on how this can be fixed.

best regards,
Rene
-- 
-------------------------------------------------
Gibraltar firewall       http://www.gibraltar.at/

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p

Reply via email to