Hello Dmitry,

Dmitry Nezhevenko:
> For added/modified files it should be enough to just move and overwrite
> all files from 'rw' to 'ro'. But I also want to correctly process
> removed files as well as symlinks.=20
> 
> Any ideas?

Here is a rather rude but simple way.
- flush all the pseudo-links
- find the all whiteouts on rw, except '.wh..wh.*'
  (if you don't know what the whiteout is, refer to the aufs manual or
  unionfs manual)
- remove the whiteouted or opaqued entries on ro
- remove the whiteouts on rw
- 'mount -o remount /tmp/aufs/total'
- these direct access to rw/ro, eg. bypassing aufs, will not be detected
  by aufs until you execute the last remount.
- if a file is in use, aufs may not detect/refresh the info about the
  file even if you execute the last remount.

If you don't want to be rude, try another but slower way.
- enable CONFIG_INOTIFY and CONFIG_AUFS_HINOTIFY
- flush all the pseudo-links
- 'mount -o remount,udba=inotify /tmp/aufs/total' just before the work
  (about udba= option, refer to the aufs manual)
- remove the whiteouted or opaqued entries on ro
- remove the whiteouts on rw
- 'mount -o remount,udba=reval /tmp/aufs/total' just after the work
- these direct access to rw/ro, eg. bypassing aufs, will be detected by
  aufs in time even the file is in use.

In both cases, the access to /tmp/aufs/total will not block. It means
that a new whiteout or pseudo-link may be created while you are
working.


Junjiro R. Okajima




-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

Reply via email to