All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oren Laadan <orenl@cs.columbia.edu>
To: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Serge Hallyn <serge@hallyn.com>,
	Matt Helsley <matthltc@us.ibm.com>, Dan Smith <danms@us.ibm.com>,
	John Stultz <johnstul@us.ibm.com>,
	Matthew Wilcox <matthew@wil.cx>,
	Jamie Lokier <jamie@shareable.org>,
	linux-fsdevel@vger.kernel.org,
	Containers <containers@lists.linux-foundation.org>
Subject: Re: [PATCH 06/16][cr][v3]: Checkpoint file-locks
Date: Wed, 04 Aug 2010 19:26:18 -0400	[thread overview]
Message-ID: <4C59F71A.2010002@cs.columbia.edu> (raw)
In-Reply-To: <1280877097-12377-7-git-send-email-sukadev@linux.vnet.ibm.com>



On 08/03/2010 07:11 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[v3]:
> 	[Oren Laadan] Add a missing (loff_t) type cast and use a macro
> 		to set the marker/dummy file lock
>
> 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@linux.vnet.ibm.com>
> ---
>   fs/checkpoint.c                |  100 ++++++++++++++++++++++++++++++++++-----
>   include/linux/checkpoint_hdr.h |   18 +++++++
>   2 files changed, 105 insertions(+), 13 deletions(-)
>
> diff --git a/fs/checkpoint.c b/fs/checkpoint.c
> index b5486c1..57b6944 100644
> --- a/fs/checkpoint.c
> +++ b/fs/checkpoint.c
> @@ -26,8 +26,19 @@
>   #include<linux/checkpoint.h>
>   #include<linux/eventpoll.h>
>   #include<linux/eventfd.h>
> +#include<linux/smp_lock.h>
>   #include<net/sock.h>
>
> +/*
> + * TODO: This code uses the BKL for consistency with other uses of
> + * 	 'for_each_lock()'. But since the BKL may be replaced with another
> + * 	 lock in the future, use lock_flocks() macros instead. lock_flocks()
> + * 	 are currently used in BKL-fix sand boxes and when those changes
> + * 	 are merged, the following macros can be removed
> + */
> +#define lock_flocks()		lock_kernel()
> +#define unlock_flocks()	unlock_kernel()
> +
>   /**************************************************************************
>    * Checkpoint
>    */
> @@ -256,8 +267,78 @@ static int checkpoint_file(struct ckpt_ctx *ctx, void *ptr)
>   	return ret;
>   }

I prefer the approach of writing-all-at-once over the current
one-at-a-time-and-mark-the-end. See my previous comment:
(https://lists.linux-foundation.org/pipermail/containers/2010-July/025057.html)

---
   Having looked at the code again - how about the following:
   get rid of this "last entry" altogether; instead, during
   checkpoint, first count the locks, then write a header with
   the number of locks, following by that many records of the
   locks themselves.

   This is what we do for other resource lists/chains as well.
   Also makes it a bit easier to parse since you always know
   what to expect once you see the header.
---

(Yes, I'm aware that if the list is long you may need to send
multiple chunks and for that "remember" where you were in the
list...)

[...]

Oren.

  parent reply	other threads:[~2010-08-04 23:26 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-03 23:11 [PATCH 00/16][cr][v3]: C/R file owner, locks, leases Sukadev Bhattiprolu
2010-08-03 23:11 ` [PATCH 01/16][cr][v3]: Add uid, euid params to f_modown() Sukadev Bhattiprolu
2010-08-03 23:11 ` [PATCH 02/16][cr][v3]: Add uid, euid params to __f_setown() Sukadev Bhattiprolu
2010-08-03 23:11 ` [PATCH 03/16][cr][v3]: Checkpoint file-owner information Sukadev Bhattiprolu
2010-08-03 23:11 ` [PATCH 04/16][cr][v3]: Restore file_owner info Sukadev Bhattiprolu
2010-08-04 23:01   ` Oren Laadan
     [not found]   ` <1280877097-12377-5-git-send-email-sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2010-08-04 23:01     ` Oren Laadan
2010-08-03 23:11 ` [PATCH 05/16][cr][v3]: Move file_lock macros into linux/fs.h Sukadev Bhattiprolu
2010-08-03 23:11 ` [PATCH 06/16][cr][v3]: Checkpoint file-locks Sukadev Bhattiprolu
     [not found]   ` <1280877097-12377-7-git-send-email-sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2010-08-04 23:26     ` Oren Laadan
2010-08-04 23:26   ` Oren Laadan [this message]
2010-08-03 23:11 ` [PATCH 07/16][cr][v3]: Define flock_set() Sukadev Bhattiprolu
2010-08-03 23:11 ` [PATCH 08/16][cr][v3]: Define flock64_set() Sukadev Bhattiprolu
2010-08-03 23:11 ` [PATCH 09/16][cr][v3]: Restore file-locks Sukadev Bhattiprolu
     [not found] ` <1280877097-12377-1-git-send-email-sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2010-08-03 23:11   ` [PATCH 01/16][cr][v3]: Add uid, euid params to f_modown() Sukadev Bhattiprolu
2010-08-03 23:11   ` [PATCH 02/16][cr][v3]: Add uid, euid params to __f_setown() Sukadev Bhattiprolu
2010-08-03 23:11   ` [PATCH 03/16][cr][v3]: Checkpoint file-owner information Sukadev Bhattiprolu
2010-08-03 23:11   ` [PATCH 04/16][cr][v3]: Restore file_owner info Sukadev Bhattiprolu
2010-08-03 23:11   ` [PATCH 05/16][cr][v3]: Move file_lock macros into linux/fs.h Sukadev Bhattiprolu
2010-08-03 23:11   ` [PATCH 06/16][cr][v3]: Checkpoint file-locks Sukadev Bhattiprolu
2010-08-03 23:11   ` [PATCH 07/16][cr][v3]: Define flock_set() Sukadev Bhattiprolu
2010-08-03 23:11   ` [PATCH 08/16][cr][v3]: Define flock64_set() Sukadev Bhattiprolu
2010-08-03 23:11   ` [PATCH 09/16][cr][v3]: Restore file-locks Sukadev Bhattiprolu
2010-08-03 23:11   ` [PATCH 10/16][cr][v3]: Initialize ->fl_break_time to 0 Sukadev Bhattiprolu
2010-08-03 23:11   ` [PATCH 11/16][cr][v3]: Add ->fl_type_prev field Sukadev Bhattiprolu
2010-08-03 23:11   ` [PATCH 12/16][cr][v3]: Add ->fl_break_notified field Sukadev Bhattiprolu
2010-08-03 23:11   ` [PATCH 13/16][cr][v3]: Add jiffies_begin field to ckpt_ctx Sukadev Bhattiprolu
2010-08-03 23:11   ` [PATCH 14/16][cr][v3]: Checkpoint file-leases Sukadev Bhattiprolu
2010-08-03 23:11   ` [PATCH 15/16][cr][v3]: Define do_setlease() Sukadev Bhattiprolu
2010-08-03 23:11   ` [PATCH 16/16][cr][v3]: Restore file-leases Sukadev Bhattiprolu
2010-08-04 10:45   ` [PATCH 00/16][cr][v3]: C/R file owner, locks, leases Steven Whitehouse
2010-08-03 23:11 ` [PATCH 10/16][cr][v3]: Initialize ->fl_break_time to 0 Sukadev Bhattiprolu
2010-08-03 23:11 ` [PATCH 11/16][cr][v3]: Add ->fl_type_prev field Sukadev Bhattiprolu
2010-08-03 23:11 ` [PATCH 12/16][cr][v3]: Add ->fl_break_notified field Sukadev Bhattiprolu
2010-08-03 23:11 ` [PATCH 13/16][cr][v3]: Add jiffies_begin field to ckpt_ctx Sukadev Bhattiprolu
2010-08-03 23:11 ` [PATCH 14/16][cr][v3]: Checkpoint file-leases Sukadev Bhattiprolu
2010-08-03 23:11 ` [PATCH 15/16][cr][v3]: Define do_setlease() Sukadev Bhattiprolu
2010-08-03 23:11 ` [PATCH 16/16][cr][v3]: Restore file-leases Sukadev Bhattiprolu
2010-08-04 23:35   ` Oren Laadan
     [not found]   ` <1280877097-12377-17-git-send-email-sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2010-08-04 23:35     ` Oren Laadan
2010-08-04 10:45 ` [PATCH 00/16][cr][v3]: C/R file owner, locks, leases Steven Whitehouse
2010-08-04 17:26   ` Matt Helsley
2010-08-04 18:03     ` Oren Laadan
     [not found]     ` <20100804172649.GM2927-52DBMbEzqgQ/wnmkkaCWp/UQ3DHhIser@public.gmane.org>
2010-08-04 18:03       ` Oren Laadan
2010-08-04 17:26   ` Matt Helsley
2010-08-04 19:01   ` Sukadev Bhattiprolu
2010-08-04 19:01   ` Sukadev Bhattiprolu
2010-08-04 19:16     ` Oren Laadan
     [not found]     ` <20100804190112.GA11571-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-08-04 19:16       ` Oren Laadan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C59F71A.2010002@cs.columbia.edu \
    --to=orenl@cs.columbia.edu \
    --cc=containers@lists.linux-foundation.org \
    --cc=danms@us.ibm.com \
    --cc=jamie@shareable.org \
    --cc=johnstul@us.ibm.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=matthltc@us.ibm.com \
    --cc=serge@hallyn.com \
    --cc=sukadev@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.