Re: [PATCH 27/38] union-mount: In-kernel file copyup routines

From: Valerie Aurora
Date: Thu Aug 05 2010 - 15:54:41 EST


On Wed, Aug 04, 2010 at 05:26:28PM +0200, Miklos Szeredi wrote:
> On Tue, 15 Jun 2010, Valerie Aurora wrote:
> > When a file on the read-only layer of a union mount is altered, it
> > must be copied up to the topmost read-write layer. This patch creates
> > union_copyup() and its supporting routines.
> >
> > Thanks to Valdis Kletnieks for a bug fix.
>
> What happens if there's a crash in the middle of the copyup?
>
> Possible solution is using rename to atomically "replace" the
> underlying file. That however introduces namespace issues: where to
> put the temporary file which then needs to be deleted on "fsck.union"?

This kind of problem is what makes union mounts so much fun to work
on!! </sarcasm>

So far this version of union mounts has kept the namespace clean, so
I'd like to keep it that way. One of my ideas is to mark the new file
as "copy-in-progress" and if we encounter such a file, we restart the
copyup again. But how to mark it? A new inode flag?

This applies in some form to directory copyup too. However, we
already have a flag we use to indicate that it's copied up - the
opaque flag. I moved that to be set after the directory entries are
copied up. If it crashes in the middle, it can be safely restarted
the next time we call readdir() on that directory.

I added a comment to the commit message describing the problem, so
it's at least documented.

-VAL
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/