From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oren Laadan Subject: Re: [RFC v14-rc2][PATCH 16/29] A new file type (CR_FD_OBJREF) for a file descriptor already setup Date: Fri, 03 Apr 2009 12:25:09 -0400 Message-ID: <49D63865.1030807@cs.columbia.edu> References: <1238477349-11029-1-git-send-email-orenl@cs.columbia.edu> <1238477349-11029-17-git-send-email-orenl@cs.columbia.edu> <87y6uhyc3j.fsf@caffeine.danplanet.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <87y6uhyc3j.fsf-FLMGYpZoEPULwtHQx/6qkW3U47Q5hpJU@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Dan Smith Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, Dave Hansen List-Id: containers.vger.kernel.org Dan Smith wrote: > OL> @@ -86,46 +132,44 @@ static int cr_read_file(struct cr_ctx *ctx, int objref) > OL> goto out; > > OL> ret = -EINVAL; > OL> + if (hh->fd_objref < 0) > OL> + goto out; > > As far as I can tell, hh->fd_objref never gets set anywhere. On my > system, this causes restart to always fail because there is garbage in > that field, thus triggering the above check. If I remove this, > restart completes successfully. The following grep tells me that > maybe this check isn't valid: > > % grep fd_objref checkpoint/*.c include/linux/checkpoint*.h > checkpoint/rstr_file.c: file = cr_obj_get_by_ref(ctx, hh->fd_objref, CR_OBJ_FILE); > checkpoint/rstr_file.c: file = cr_obj_add_file(ctx, fds[1-which], hh->fd_objref); > checkpoint/rstr_file.c:static int cr_read_fd_objref(struct cr_ctx *ctx, struct cr_hdr_file *hh) > checkpoint/rstr_file.c: file = cr_obj_get_by_ref(ctx, hh->fd_objref, CR_OBJ_FILE); > checkpoint/rstr_file.c: if (hh->fd_objref < 0) > checkpoint/rstr_file.c: fd = cr_read_fd_objref(ctx, hh); > include/linux/checkpoint_hdr.h: __s32 fd_objref; hh->fd_objref is set, for pipes, in fs/pipe.c (outcome of the move to f_ops). So the problem is that the field isn't explicitly zeroed otherwise. I'll fix that for the next round. Meanwhile, you can add: hh->fd_objref = 0; in cr_write_file() before the call to file->f_ops->checkpoint(). Thanks, Oren. > > I haven't looked into the surrounding bits yet, so maybe I'm missing > something, but this seems to be causing a spurious failure on s390 at > least. > > I'm doing this on a clone of your repository's ckpt-v14-rc2 branch. > Perhaps that repo is missing a patch? >