On Apr 27, 2007, at 18:07:46, Nigel Cunningham wrote:Actually, it's a lot simpler than that. We can just combine the device-mapper snapshot with a VM+kernel snapshot system call and be almost done: sys_snapshot(dev_t snapblockdev, int __user *snapshotfd); When sys_snapshot is run, the kernel does: 1) Sequentially freeze mounted filesystems using blockdev freezing. If it's an fs that doesn't support freezing then either fail or force- remount-ro that fs and downgrade all its filedescriptors to RO. Doesn't need extra locking since process which try to do IO either succeed before the freeze call returns for that blockdev or sleep on the unfreeze of that blockdev. Filesystems are synchronized and made clean. 2) Iterate over the userspace process list, freezing each process and remapping all of its pages copy-on-write. Any device-specific pages need to have state saved by that device. 3) All processes (except kernel threads) are now frozen. 4) Kernel should save internal state corresponding to current userspace state. The kernel also swaps out excess pages to free up enough RAM and prepares the snapshot file-descriptor with copies of kernel memory and the original (pre-COW) mapped userspace pages. 5) Kernel substitutes filesystems for either a device-mapper snapshot with snapblockdev as backing storage or union with tmpfs and remounts the underlying filesystems as read-only. 6) Kernel unfreezes all userspace processes and returns the snapshot FD to userspace (where it can be read from). Then userspace can do whatever it wants. Any changes to filesystems mounted at the time of snapshot will be discarded at shutdown. Freshly mounted filesystems won't have the union or COW thing done, and so you can write your snapshot to a compressed encrypted file on a USB key if you want to, you just have to unmount it before the snapshot() syscall and remount it right afterwards. Cheers, Kyle Moffett -
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| Tejun Heo | [PATCH 2/5] sysfs: simplify sysfs_rename_dir() |
| Andi Kleen | [PATCH x86] [0/16] Various i386/x86-64 changes |
| Dave Hansen | Re: [RFC/PATCH] Documentation of kernel messages |
git: | |
| Gerrit Renker | [PATCH 15/37] dccp: Set per-connection CCIDs via socket options |
| David Miller | [GIT]: Networking |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Thomas Gleixner | Re: [BUG] New Kernel Bugs |
