[Devel] Re: [PATCH 6/9][cr][v2]: Checkpoint file-locks

Oren Laadan orenl at cs.columbia.edu
Mon Jun 14 21:13:27 PDT 2010



On 05/18/2010 11:07 PM, Sukadev Bhattiprolu wrote:
> While checkpointing each file-descriptor, find all the locks on the
> file and save information about the lock in the checkpoint-image.
> A follow-on patch will use this informaiton to restore the file-locks.
> 
> Changelog[v2]:
> 	[Matt Helsley]: Use fixed sizes (__s64) instead of 'loff_t' in
> 		'struct ckpt_hdr_file_lock'.
> 	[Matt Helsley, Serge Hallyn]: Highlight new use of BKL (using
> 		lock_flocks() macros as suggested by Serge).
> 	[Matt Helsley]: Reorg code a bit to simplify error handling.
> 	[Matt Helsley]: Reorg code to initialize marker-lock (Pass a
> 		NULL lock to checkpoint_one_lock() to indicate marker).
> 
> Signed-off-by: Sukadev Bhattiprolu <sukadev at linux.vnet.ibm.com>

[...]

>  
> +static int checkpoint_one_file_lock(struct ckpt_ctx *ctx, struct file *file,
> +		struct file_lock *lock)
> +{
> +	int rc;
> +	struct ckpt_hdr_file_lock *h;
> +
> +	h = ckpt_hdr_get_type(ctx, sizeof(*h), CKPT_HDR_FILE_LOCK);
> +	if (!h)
> +		return -ENOMEM;
> +
> +	if (lock) {
> +		h->fl_start = lock->fl_start;
> +		h->fl_end = lock->fl_end;
> +		h->fl_type = lock->fl_type;
> +		h->fl_flags = lock->fl_flags;
> +	} else {
> +		/* Checkpoint a dummy lock as a marker */
> +		h->fl_start = -1;

Maybe designate some constant for this ?  e.g. CKPT_FLOCK_NONE ?
In any case, you need a (loff_t) -1  (like in the restore code).

[...]

Oren.
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list