[OracleOSS] [TitleIndex] [WordIndex]

OCFS2/DesignDocs/freeze thaw

OCFS2 freeze/thaw support

Tiger Yang <tiger.yang@oracle.com>

April 10, 2007

Goals

Support freeze/thaw OCFS2 file system for backup purpose.

User interaction

freeze.ocfs2 is the tools to freeze/thaw ocfs2 file system.

#freeze.ocfs2
usage: freeze.ocfs2 [-f] [-u] mountpoint
        -f freeze filesystem
        -u unfreeze filesystem

freeze.ocfs2 invoke ioctl( OCFS2_IOC_FREEZE / OCFS2_IOC_THAW) send requests about freeze/thaw file system on one node.

Implementation

ocfs2_iocal will handle freeze/thaw file system requests.
freeze_bdev will set super_blcok->s_frozen with SB_FREEZE_WRITE/TRANS.
ocfs2_ioctl
{
        case OCFS2_IOC_FREEZE:
                ocfs2_freeze_fs();
        case OCFS2_IOC_THAW:
                ocfs2_thaw_fs();
}

ocfs2_freeze_fs()
{
        ocfs2_freeze_lock(EX);
        freeze_bdev();
}

ocfs2_thaw_fs()
{
        ocfs2_freeze_unlock(EX);
        thaw_bdev();
}

static struct ocfs2_lock_res_ops ocfs2_freeze_lops = {
        .check_downconvert = ocfs2_check_freeze_downconvert,
        .flags          = 0,
};

ocfs2_freeze_convert_worker()
{
        ocfs2_queue_freeze_worker();
}

ocfs2_freeze_worker()
{
        freeze_bdev(osb->sb->s_bdev);
        ocfs2_freeze_lock(osb, 0);
        thaw_bdev(osb->sb->s_bdev, osb->sb);
        ocfs2_freeze_unlock(osb, 0);
}

Testing

Test case 1

One process freeze the ocfs2, another process try to create a file on frozen ocfs2 on one node.

testcase 1

Patches

OCFS2 Patch

tools Patch

Todo

We must keeping the fd (mountpoint) open after we frozen ocfs2 and close it until thaw ocfs2. Otherwise we could not open the mount point in thaw if some write operation hanging.


2012-11-08 13:01