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>,
Steven Whitehouse <swhiteho@redhat.com>,
linux-fsdevel@vger.kernel.org,
Containers <containers@lists.linux-foundation.org>
Subject: Re: [PATCH 11/17][cr][v4]: Add ->fl_type_prev field.
Date: Thu, 16 Sep 2010 20:06:46 -0400 [thread overview]
Message-ID: <4C92B116.7060601@cs.columbia.edu> (raw)
In-Reply-To: <1281987801-1293-12-git-send-email-sukadev@linux.vnet.ibm.com>
On 08/16/2010 03:43 PM, Sukadev Bhattiprolu wrote:
> In preparation for checkpoint/restart of file leases, add ->fl_type_prev
> field to 'struct file_lock'. This field is needed to correctly restore
> file leases in case of recursive checkpoint/restart of an in-progress
> lease.
Nit: since it isn't obvious why fl_type_prev field exists,
maybe add this comment also inside fs.h (so that future
readers won't need to look it up in the git history) ?
Oren.
>
> This ->fl_type_prev is only initialized in this patch. It will actually
> be used when restoring file leases after a checkpoint.
>
> Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
> ---
> fs/locks.c | 10 ++++++++++
> include/linux/fs.h | 1 +
> 2 files changed, 11 insertions(+), 0 deletions(-)
>
> diff --git a/fs/locks.c b/fs/locks.c
> index 0bd5af7..9a00876 100644
> --- a/fs/locks.c
> +++ b/fs/locks.c
> @@ -184,6 +184,7 @@ void locks_init_lock(struct file_lock *fl)
> fl->fl_file = NULL;
> fl->fl_flags = 0;
> fl->fl_type = 0;
> + fl->fl_type_prev = 0;
> fl->fl_start = fl->fl_end = 0;
> fl->fl_break_time = 0UL;
> fl->fl_ops = NULL;
> @@ -227,6 +228,7 @@ void __locks_copy_lock(struct file_lock *new, const struct file_lock *fl)
> new->fl_file = NULL;
> new->fl_flags = fl->fl_flags;
> new->fl_type = fl->fl_type;
> + new->fl_type_prev = fl->fl_type_prev;
> new->fl_start = fl->fl_start;
> new->fl_end = fl->fl_end;
> new->fl_break_time = 0UL;
> @@ -293,6 +295,13 @@ static int assign_type(struct file_lock *fl, int type)
> case F_WRLCK:
> case F_UNLCK:
> fl->fl_type = type;
> + /*
> + * Clear ->fl_type_prev since this is a new lease type.
> + * break_lease() will use this cleared state to know
> + * if it must save the lease-type in case of checkpoint/
> + * restart.
> + */
> + fl->fl_type_prev = 0;
> break;
> default:
> return -EINVAL;
> @@ -1222,6 +1231,7 @@ int __break_lease(struct inode *inode, unsigned int mode)
>
> for (fl = flock; fl && IS_LEASE(fl); fl = fl->fl_next) {
> if (fl->fl_type != future) {
> + fl->fl_type_prev = fl->fl_type;
> fl->fl_type = future;
> fl->fl_break_time = break_time;
> /* lease must have lmops break callback */
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 49d4eeb..299cc09 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -1066,6 +1066,7 @@ struct file_lock {
> fl_owner_t fl_owner;
> unsigned char fl_flags;
> unsigned char fl_type;
> + unsigned char fl_type_prev;
> unsigned int fl_pid;
> struct pid *fl_nspid;
> wait_queue_head_t fl_wait;
next prev parent reply other threads:[~2010-09-17 0:07 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-16 19:43 [PATCH 00/17][cr][v4]: C/R file owner, locks, leases Sukadev Bhattiprolu
2010-08-16 19:43 ` [PATCH 01/17][cr][v4]: Add uid, euid params to f_modown() Sukadev Bhattiprolu
2010-08-16 19:43 ` [PATCH 02/17][cr][v4]: Add uid, euid params to __f_setown() Sukadev Bhattiprolu
2010-08-16 19:43 ` [PATCH 03/17][cr][v4]: Checkpoint file-owner information Sukadev Bhattiprolu
[not found] ` <1281987801-1293-4-git-send-email-sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2010-09-16 23:34 ` Oren Laadan
2010-08-16 19:43 ` [PATCH 04/17][cr][v4]: Restore file_owner info Sukadev Bhattiprolu
2010-09-16 23:45 ` Oren Laadan
2010-08-16 19:43 ` [PATCH 05/17][cr][v4]: Move file_lock macros into linux/fs.h Sukadev Bhattiprolu
2010-08-16 19:43 ` [PATCH 06/17][cr][v4]: Checkpoint file-locks Sukadev Bhattiprolu
2010-09-17 0:03 ` Oren Laadan
2010-08-16 19:43 ` [PATCH 07/17][cr][v4]: Define flock_set() Sukadev Bhattiprolu
2010-08-16 19:43 ` [PATCH 08/17][cr][v4]: Define flock64_set() Sukadev Bhattiprolu
2010-08-16 19:43 ` [PATCH 09/17][cr][v4]: Restore file-locks Sukadev Bhattiprolu
2010-08-16 19:43 ` [PATCH 10/17][cr][v4]: Initialize ->fl_break_time to 0 Sukadev Bhattiprolu
2010-08-16 19:43 ` [PATCH 11/17][cr][v4]: Add ->fl_type_prev field Sukadev Bhattiprolu
2010-09-17 0:06 ` Oren Laadan [this message]
2010-08-16 19:43 ` [PATCH 12/17][cr][v4]: Add ->fl_break_notified field Sukadev Bhattiprolu
2010-09-17 0:07 ` Oren Laadan
2010-08-16 19:43 ` [PATCH 13/17][cr][v4]: Add jiffies_begin field to ckpt_ctx Sukadev Bhattiprolu
2010-08-16 19:43 ` [PATCH 14/17][cr][v4]: Checkpoint file-leases Sukadev Bhattiprolu
2010-08-16 19:43 ` [PATCH 15/17][cr][v4]: Define do_setlease() Sukadev Bhattiprolu
2010-08-16 19:43 ` [PATCH 16/17][cr][v4]: Restore file-leases Sukadev Bhattiprolu
2010-08-16 19:43 ` [PATCH 17/17][cr][v4]: Document design of C/R of file-locks and leases Sukadev Bhattiprolu
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=4C92B116.7060601@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 \
--cc=swhiteho@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).