Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Checkpoint and Restore of file locks in userspa...

CEE-SECR
October 20, 2017

Checkpoint and Restore of file locks in userspace in Linux Pavel Begunkov, SPbAU RAS, CEE-SECR 2017

I will talk about checkpoint and restore(c/r) in Linux in userspace and give an overview of live-migration and c/r tools, and CRIU in particular. I will present a mechanism for c/r of two types of file locks and tell about work with Linux API, kernel code and concomitant problems.

The work will be of interest to administrators, specialists in this field and people keen on developing software at the edge of userspace and kernel.

CEE-SECR

October 20, 2017
Tweet

More Decks by CEE-SECR

Other Decks in Technology

Transcript

  1. Software Engineering Conference Russia October 2017, St. Petersburg CRIU: Checkpoint

    and Restore & file locks • Pavel Begunkov (Silence) SpbAU RAS 1
  2. 2 • Failure tolerance ◦ Network ◦ Hardware ◦ Programmer

    • Scalability • Flexibility • etc.
  3. Checkpoint & Restore image restore 3 Host 1 App 1

    App 2 App 3 Host 2 App 1 App 2 App 3 checkpoint
  4. 6 • Code instrumentation • LD_PRELOAD • Kernel modification •

    Kernel module • Userspace solution • etc. How to do c/r?
  5. 8 - checkpoint/restart feature work. “A note on this: this

    is a project by various mad Russians to perform c/r mainly from userspace, with various oddball helper code added into the kernel where the need is demonstrated.” Torvalds committed on Jan 13, 2012 (commit 0994695)
  6. 9 • Procfs • System calls • Code injection Userspace

    c/r Hardware state (e.g. CPU registers) Memory Kernel (files, threads, etc)
  7. Types 1. BSD locks 2. POSIX locks 3. OFD locks

    4. File lease File locks 10 Key features 1. Read-Write synchronisation 2. Advisory & Mandatory*
  8. File locks 11 Checkpoint 1. Read locks from procfs 2.

    Match each lock with physical file* 3. Match each lock with open file description* 4. Fixup the data 5. Save to image Restore 1. Read image 2. Open file 3. Set lock (fcntl, flock, etc) 4. [break lease]
  9. File locks 13 Checkpoint 1. Read locks from procfs 2.

    Match each lock with physical file* 3. Match each lock with open file description* 4. Fixup the data 5. Save to image Restore 1. Read image 2. Open file 3. Set lock (fcntl, flock, etc) 4. [break lease]