01 October 2013

On OverlayFS and distilling patches (or: how to get OverlayFS)

So, I was looking at unionfs alternatives and I wanted to try overlayfs.
You'd think a project almost begging to be merged into mainline Linux would be interested in getting some traction amongst the "regular" Linux crowd and actually provide some patches making it relatively easy to try out the code until the time finally comes they're part of mainline, right?
Well, apparently you'd be wrong assuming that: getting a clean OverlayFS patch requires distilling a diff from a patched Linux source tree on git and that is left as an exercise to the user... or simply use Ubuntu's or SuSE's kernels (no...fucking...way) as those are already patched it seems.
Anyways, this is how to do it:

Branch overlayfs.v18 is intended to work with Linux 3.10.x:
https://git.kernel.org/cgit/linux/kernel/git/mszeredi/vfs.git/tree/Makefile?h=overlayfs.v18
Git clone the overlayfs.v18 branch:
git clone git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs.git -b overlayfs.v18 overlayfs.v18
From the git log I got they merged Linux 3.10-rc7 so that's the branch we're going to diff to. Adding a new remote repo to the overlayfs.v18 local repo and fetching the v3.10-rc7 branch from it (git fetching won't actually change the local code!):
cd overlayfs.v18
git remote add v3.10-rc7 git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
git fetch v3.10-rc7
Now all we have to do is the actual git diff:
git diff v3.10-rc7/master...HEAD > ../overlayfs-v18.patch
So let's try to patch our Linux 3.10.12 tree :
root@bob:/usr/src/linux# patch -p1 --dry-run < ../overlayfs-v18.patch 
patching file Documentation/filesystems/Locking
patching file Documentation/filesystems/overlayfs.txt
patching file Documentation/filesystems/vfs.txt
patching file MAINTAINERS
patching file fs/Kconfig
patching file fs/Makefile
patching file fs/ecryptfs/main.c
patching file fs/internal.h
patching file fs/namei.c
patching file fs/namespace.c
patching file fs/open.c
patching file fs/overlayfs/Kconfig
patching file fs/overlayfs/Makefile
patching file fs/overlayfs/copy_up.c
patching file fs/overlayfs/dir.c
patching file fs/overlayfs/inode.c
patching file fs/overlayfs/overlayfs.h
patching file fs/overlayfs/readdir.c
patching file fs/overlayfs/super.c
patching file fs/splice.c
Hunk #1 succeeded at 1313 (offset 1 line).
patching file include/linux/fs.h
patching file include/linux/mount.h
root@bob:/usr/src/linux#

Lookin' good, w00t!

No comments:

Post a Comment