From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
To: Oren Laadan <orenl@cs.columbia.edu>
Cc: serue@us.ibm.com, Matt Helsley <matthltc@us.ibm.com>,
matthew@wil.cx, <linux-fsdevel@vger.kernel.org>,
Containers <containers@lists.linux-foundation.org>
Subject: [PATCH 3/9][cr][v2]: Checkpoint file-owner information
Date: Tue, 18 May 2010 20:07:26 -0700 [thread overview]
Message-ID: <1274238452-15382-4-git-send-email-sukadev@linux.vnet.ibm.com> (raw)
In-Reply-To: <1274238452-15382-1-git-send-email-sukadev@linux.vnet.ibm.com>
Checkpoint the file->f_owner information for an open file. This
information will be used to restore the file-owner information
when the application is restarted from the checkpoint.
The file->f_owner information is "private" to each 'struct file' i.e.
fown_struct is not an external object shared with other file structures.
So the information can directly be added to the 'ckpt_hdr_file' object.
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
---
fs/checkpoint.c | 27 +++++++++++----------------
include/linux/checkpoint_hdr.h | 5 +++++
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/fs/checkpoint.c b/fs/checkpoint.c
index e036a7a..0fa4ce8 100644
--- a/fs/checkpoint.c
+++ b/fs/checkpoint.c
@@ -168,12 +168,19 @@ int checkpoint_file_common(struct ckpt_ctx *ctx, struct file *file,
struct ckpt_hdr_file *h)
{
struct cred *f_cred = (struct cred *) file->f_cred;
+ struct pid *pid = file->f_owner.pid;
h->f_flags = file->f_flags;
h->f_mode = file->f_mode;
h->f_pos = file->f_pos;
h->f_version = file->f_version;
+ h->f_owner_pid = pid_nr_ns(pid, ns_of_pid(pid));
+ h->f_owner_pid_type = file->f_owner.pid_type;
+ h->f_owner_uid = file->f_owner.uid;
+ h->f_owner_euid = file->f_owner.euid;
+ h->f_owner_signum = file->f_owner.signum;
+
h->f_credref = checkpoint_obj(ctx, f_cred, CKPT_OBJ_CRED);
if (h->f_credref < 0)
return h->f_credref;
@@ -184,10 +191,10 @@ int checkpoint_file_common(struct ckpt_ctx *ctx, struct file *file,
return h->f_secref;
}
- ckpt_debug("file %s credref %d secref %d\n",
- file->f_dentry->d_name.name, h->f_credref, h->f_secref);
-
- /* FIX: need also file->f_owner, etc */
+ ckpt_debug("file %s credref %d secref %d, fowner-pid %d, type %d, "
+ "fowner-signum %d\n", file->f_dentry->d_name.name,
+ h->f_credref, h->f_secref, h->f_owner_pid,
+ h->f_owner_pid_type, h->f_owner_signum);
return 0;
}
@@ -267,7 +274,6 @@ static int checkpoint_file_desc(struct ckpt_ctx *ctx,
struct fdtable *fdt;
int objref, ret;
int coe = 0; /* avoid gcc warning */
- pid_t pid;
h = ckpt_hdr_get_type(ctx, sizeof(*h), CKPT_HDR_FILE_DESC);
if (!h)
@@ -302,17 +308,6 @@ static int checkpoint_file_desc(struct ckpt_ctx *ctx,
}
/*
- * TODO: Implement c/r of fowner and f_sigio. Should be
- * trivial, but for now we just refuse its checkpoint
- */
- pid = f_getown(file);
- if (pid) {
- ret = -EBUSY;
- ckpt_err(ctx, ret, "%(T)fd %d has an owner (%d)\n", fd);
- goto out;
- }
-
- /*
* if seen first time, this will add 'file' to the objhash, keep
* a reference to it, dump its state while at it.
*/
diff --git a/include/linux/checkpoint_hdr.h b/include/linux/checkpoint_hdr.h
index 790214f..44e2a0d 100644
--- a/include/linux/checkpoint_hdr.h
+++ b/include/linux/checkpoint_hdr.h
@@ -570,6 +570,11 @@ struct ckpt_hdr_file {
__u64 f_pos;
__u64 f_version;
__s32 f_secref;
+ __s32 f_owner_pid;
+ __u32 f_owner_pid_type;
+ __u32 f_owner_uid;
+ __u32 f_owner_euid;
+ __s32 f_owner_signum;
} __attribute__((aligned(8)));
struct ckpt_hdr_file_generic {
--
1.6.0.4
next prev parent reply other threads:[~2010-05-19 3:01 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-19 3:07 [PATCH 0/9][cr][v2]: C/R file owner and posix file locks Sukadev Bhattiprolu
2010-05-19 3:07 ` [PATCH 1/9][cr][v2]: Add uid, euid params to f_modown() Sukadev Bhattiprolu
2010-05-19 3:07 ` [PATCH 2/9][cr][v2]: Add uid, euid params to __f_setown() Sukadev Bhattiprolu
2010-05-19 3:07 ` Sukadev Bhattiprolu [this message]
2010-05-19 3:07 ` [PATCH 4/9][cr][v2]: Restore file_owner info Sukadev Bhattiprolu
2010-06-15 4:05 ` Oren Laadan
2010-07-28 19:25 ` Sukadev Bhattiprolu
2010-07-28 22:20 ` Matt Helsley
2010-07-29 19:00 ` Serge E. Hallyn
2010-05-19 3:07 ` [PATCH 5/9][cr][v2]: Move file_lock macros into linux/fs.h Sukadev Bhattiprolu
2010-05-19 3:07 ` [PATCH 6/9][cr][v2]: Checkpoint file-locks Sukadev Bhattiprolu
2010-06-15 4:13 ` Oren Laadan
2010-07-28 19:26 ` Sukadev Bhattiprolu
[not found] ` <20100728192649.GB14570-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2010-07-28 19:42 ` Oren Laadan
2010-07-28 21:29 ` Sukadev Bhattiprolu
2010-07-28 23:39 ` Oren Laadan
2010-05-19 3:07 ` [PATCH 7/9][cr][v2]: Define flock_set() Sukadev Bhattiprolu
2010-05-19 3:07 ` [PATCH 8/9][cr][v2]: Define flock64_set() Sukadev Bhattiprolu
2010-05-19 3:07 ` [PATCH 9/9][cr][v2]: Restore file-locks Sukadev Bhattiprolu
2010-05-26 7:48 ` steve
2010-05-26 23:57 ` Sukadev Bhattiprolu
2010-06-15 4:22 ` 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=1274238452-15382-4-git-send-email-sukadev@linux.vnet.ibm.com \
--to=sukadev@linux.vnet.ibm.com \
--cc=containers@lists.linux-foundation.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=matthew@wil.cx \
--cc=matthltc@us.ibm.com \
--cc=orenl@cs.columbia.edu \
--cc=serue@us.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 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).