From: Marwan Al-S. <ma...@co...> - 2008-04-06 21:10:33
|
On Sun, Apr 6, 2008 at 2:43 PM, Henry Nestler <Hen...@ar...> wrote: > Hello Marwan, > > > > Marwan Al-Sabbagh wrote: > > On Thu, Apr 3, 2008 at 6:43 PM, David Kaufman <da...@gi...> wrote: > >> Hi, > >> > >> I'd like to use unionfs in colinux: > >> http://www.fsl.cs.sunysb.edu/project-unionfs.html > >> > >> My goal is to have several colinux instances sharing a large read-only > >> filesystem (like the OS images that ship with colinux) and saving their > >> local changes to smaller writable local "unioned" filesystems. This would > >> help me to repeatedly test-install large, complicated software packages > >> that we develop (such as http://krang.sf.net), with the ability to quickly > >> roll back the O/S to its pristine state and re-do as many times as needed, > >> and also to make it easy to identify and isolate all changes made to the > >> underlying distro afterwards (by examining the writable directory mounted). > >> > >> I read that unionfs was "baked in" to the linux kernel since 2.6.14 and > >> also see that it is supported by my distro (debian etch) so I was > >> disappointed when: > >> > >> mount -t unionfs -o dirs=/Fruits:/Vegetables none /mnt/healthy > >> > >> complained that: > >> > >> unknown file system unionfs > >> > >> Is unionfs not baked into the colinux kernel, too? Am I doing something > >> wrong (or not doing something else right?) Do I need to get the source, > >> compile and load the kernel module for colinux? I've never done that > >> before, but for this I'd be anxious to give it a try! > >> > >> I'm running a recent 0.8.0 snapshot (at the moment) but would be willing to > >> up-, down-, or side-grade to get unionfs running! > >> > >> Thanks! > >> > >> -dave > >> > > > > > > Dear David, > > Unionfs is not in the default Linux kernel yet but should be in the > > future, this Quote is taken from http://en.wikipedia.org/wiki/UnionFS > > > > "As of January 2007, Unionfs 2.0 has been included into Andrew > > Morton's Linux -mm tree, thus slated for eventual inclusion in the > > Linux kernel mainline source tree." > > > > I've patched and compiled unionfs support into the colinux kernel, > > and it works great. As Henry mentioned there are no conflicts. I > > compiled it using coLinux-0.7.2 on debian 4 Etch. But the process > > pretty much applies to whichever distro and coLinux versions. I wrote > > a bash script that does the whole thing for you, as follows: > > > > * download colinux source, unionfs source, linux kernel source > > * patch kernel with colinux patch and unionfs patch > > * configure kernel for unionfs > > * compile the kernel image and modules > > > > The script isn't too long about 60 lines, I've also tried to make it > > structured and readable. So you should be able to easily see what it's > > doing, and modify it for other versions or purposes. You can download > > the script at http://marwan.tv/build-unionfs-kernel.sh > > > > Two additional notes. Run the script as root or sudo, and run the > > following before running the scripts to install the packages needed to > > compile the Linux kernel: > > > > apt-get install build-essential gettext bison flex automake autoconf unzip bzip2 > > > > Best of luck, and I hope you find the script and this post helpful. > > > > Marwan Al-Sabbagh > > We have tried the module on Debian 4. We have build coLinux kernel > 2.6.22.18 with unionfs patch 2.6.22.19. But it crashes the Kernel. The > minor differ version from .18 to .19 versions should not the problem. > > David Kaufman wrote to me offlist: > > sudo su - > > modprobe unionfs > > mkdir fruits vegies healthy > > touch fruits/apple vegies/carrot > > echo "I am a fruit" > fruits/tomato > > echo "I am a vegetable" > vegies/tomato > > mount -t unionfs -o dirs=/root/fruits:/root/vegies \ > > none /root/healthy > > dir healthy # works! > > cat healthy/apple # doesn't crash > > cat healthy/tomato # should print: "I am a fruit" > > # (but crashes colinux instead) :-) > > I have replaced the "/root" with "/tmp" in the steps and have the same > result as David. > > BUG at .../devel-gcc412/linux-2.6.22.18-source/fs/unionfs/fanout.h:313" > > static inline void verify_locked(struct dentry *d) > { > BUG_ON(!d); > BUG_ON(!mutex_is_locked(&UNIONFS_D(d)->lock)); <=== failed > } > > Have changed the lines above into WARN + BUG to have the caller tree. > > static inline void verify_locked(struct dentry *d) > { > BUG_ON(!d); > > //BUG_ON(!mutex_is_locked(&UNIONFS_D(d)->lock)); > if (WARN_ON(!mutex_is_locked(&UNIONFS_D(d)->lock))) > BUG(); > } > > ------- Now, can see the callers: ----------------------- > Registering unionfs 2.3.2 (for 2.6.22.19) on .18 > WARNING: at > /home/hn/colinux/build/devel-gcc412/linux-2.6.22.18-source/fs/unionf > :315 verify_locked() > [<c0103b7a>] show_trace_log_lvl+0x1a/0x30 > [<c0103cb2>] show_trace+0x12/0x20 > [<c0104ae5>] dump_stack+0x15/0x20 > [<c884255c>] unionfs_file_revalidate+0x63c/0xfc0 [unionfs] > [<c884545e>] unionfs_readpage+0x3e/0x1d0 [unionfs] > [<c0144d23>] __do_page_cache_readahead+0x1e3/0x2b0 > [<c0144e52>] blockable_page_cache_readahead+0x62/0xc0 > [<c01450a9>] page_cache_readahead+0x149/0x1f0 > [<c013ed70>] do_generic_mapping_read+0x4f0/0x5a0 > [<c0140c92>] generic_file_aio_read+0x122/0x1c0 > [<c015de1f>] do_sync_read+0xcf/0x110 > [<c015e705>] vfs_read+0xb5/0x140 > [<c015eaed>] sys_read+0x3d/0x70 > [<c01028f2>] syscall_call+0x7/0xb > ======================= > colinux: Linux VM terminated > colinux: BUG at > .../devel-gcc412/linux-2.6.22.18-source/fs/unionfs/fanout.h:316 > console: Monitor1492: Detached > =============================================================== > > I can not see any coLinux related things there. Perhaps some should > fillout a bugreport on unionfs? > > My changed code you can see from versions message "on .18" > http://www.henrynestler.com/colinux/testing/devel-0.8.0/20080403-unionfs/bug-fanout.h-313/ > > Marwan, what patchfile you have used? What version of unionfs? > > -- > Henry N. > Hi Henry, I used the following files/versions: http://downloads.sourceforge.net/colinux/coLinux-0.7.2-src.tar.gz http://download.filesystems.org/unionfs/unionfs-2.x/unionfs-2.2.4_for_2.6.22.18.diff.gz http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.22.tar.bz2 I used coLinux 0.7.2 source, it used the 2.6.22 kernel by default, the closest patch to that was unionfs-2.2.4_for_2.6.22.18.diff. Now I did run a diff between Linux 2.6.22.18 and 2.6.22, and I confirmed that none of the files patched by unionfs had changed significantly. I tried the example mentioned above with the fruits and vegies and it all worked with no kernel crash, and it produced the expected results. The vmlinux and vmlinux-modules.tar.gz that I'm using with built in support for unionfs can be downloaded here: http://marwan.tv/vmlinux http://marwan.tv/vmlinux-modules.tar.gz Good luck, hope that solves the problem. Marwan |