[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0808210122510.4445@takamine.ncl.cs.columbia.edu>
Date: Thu, 21 Aug 2008 01:26:33 -0400 (EDT)
From: Oren Laadan <orenl@...columbia.edu>
To: dave@...ux.vnet.ibm.com
cc: containers@...ts.linux-foundation.org, jeremy@...p.org,
linux-kernel@...r.kernel.org, arnd@...db.de
Subject: Re: [RFC v2][PATCH 9/9] File descriprtors (restore)
>
> Restore open file descriptors: for each FD read 'struct cr_hdr_fd_ent'
> and lookup tag in the hash table; if not found (first occurence), read
> in 'struct cr_hdr_fd_data', create a new FD and register in the hash.
> Otherwise attach the file pointer from the hash as an FD.
>
> This patch only handles basic FDs - regular files, directories and also
> symbolic links.
>
> Signed-off-by: Oren Laadan <orenl@...columbia.edu>
> ---
> checkpoint/Makefile | 2 +-
> checkpoint/checkpoint.c | 3 +
> checkpoint/ckpt.h | 6 +-
> checkpoint/restart.c | 3 +
> checkpoint/rstr_file.c | 202 +++++++++++++++++++++++++++++++++++++++++++++++
> 5 files changed, 213 insertions(+), 3 deletions(-)
> create mode 100644 checkpoint/rstr_file.c
>
To restore the open files, cr_read_files() first closes all the
existing FDs of the current process. This breaks the assumption
underlying the use of fget_light/fput_light in sys_restart(), so
use fget/fput instead.
diff --git a/checkpoint/sys.c b/checkpoint/sys.c
index 7b2670a..ec1609b 100644
--- a/checkpoint/sys.c
+++ b/checkpoint/sys.c
@@ -210,10 +210,9 @@ asmlinkage long sys_restart(int crid, int fd, unsigned long flags)
{
struct cr_ctx *ctx;
struct file *file;
- int fput_needed;
int ret;
- file = fget_light(fd, &fput_needed);
+ file = fget(fd);
if (!file)
return -EBADF;
@@ -223,14 +222,14 @@ asmlinkage long sys_restart(int crid, int fd, unsigned long flags)
ctx = cr_ctx_alloc(crid, file, flags | CR_CTX_RSTR);
if (!ctx) {
- fput_light(file, fput_needed);
+ fput(file);
return -ENOMEM;
}
ret = do_restart(ctx);
cr_ctx_free(ctx);
- fput_light(file, fput_needed);
+ fput(file);
return ret;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists