From: Nadia Derbey <Nadia.Derbey-6ktuUTfB/bM@public.gmane.org>
To: kathys <kathys-8fk3Idey6ehBDgjK7y7TUQ@public.gmane.org>
Cc: Kathy Staples
<kathys-QcUrd9fbWu1x7SfHBjqd8AC/G2K4zDHf@public.gmane.org>,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: Re: [RFC PATCH 5/5] use next syscall data to predefine the file descriptor value
Date: Thu, 10 Jul 2008 08:12:25 +0200 [thread overview]
Message-ID: <4875A849.1030206@bull.net> (raw)
In-Reply-To: <487445E4.6060107-8fk3Idey6ehBDgjK7y7TUQ@public.gmane.org>
kathys wrote:
> Hi Nadia,
>
> I am trying with great difficulty to incorporate these patches into the
> existing lxc-tree on 2.6.26-rc8-mm1-lxc1, they are conflicting with a
> number of other patches from checkpoint/.
Kathy,
Is it the same problem as the one we have solved by private e-mail?
Regards,
Nadia
> Serge has asked me to include
> them in the next lxc release so I need to know how to make them fit.
>
> I will put out 2.6.26-rc8-mm1-lxc1 without your patches because its
> taking me too long, I will endeavor to include them in the
> 2.6.26-rc8-mm1-lxc2, so if you could have a look at them against the
> next release of lxc which I hope to get out by tomorrow (Thursday)
> afternoon.
>
> Thanks,
>
> Kathy
>
> Serge E. Hallyn wrote:
>
>> Quoting Nadia.Derbey-6ktuUTfB/bM@public.gmane.org (Nadia.Derbey-6ktuUTfB/bM@public.gmane.org):
>>
>>
>>> [PATCH 05/05]
>>>
>>> This patch uses the value written into the next_syscall_data proc file
>>> as a target file descriptor for the next file to be opened.
>>>
>>> This makes it easy to restart a process with the same fds as the ones
>>> it was
>>> using during the checkpoint phase, instead of 1. opening the file, 2.
>>> dup2'ing
>>> the open file descriptor.
>>>
>>> The following syscalls are impacted if next_syscall_data is set:
>>> . open()
>>> . openat()
>>>
>>
>>
>> Oh, neat, I somehow missed the fact that you had this in your previous
>> posting :)
>>
>>
>>
>>> Signed-off-by: Nadia Derbey <Nadia.Derbey-6ktuUTfB/bM@public.gmane.org>
>>>
>>
>>
>> It'd be nice if the get_predefined_fd_flags() could share a helper
>> with get_unused_fd_flags() (in particular because the "/* snaity check */
>> at the end is between a '#if 1' which sounds like it may one day be
>> removed), but I'm not sure offhand the best way to do that. So for now
>>
>> Acked-by: Serge Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
>>
>> Thanks, Nadia.
>>
>> Kathy, I'd love to see a -lxc release with this patchset so we can test
>> it with cryo.
>>
>> Suka, the open with specified id here might help your simplify your pipe
>> c/r patches for cryo?
>>
>> -serge
>>
>>
>>
>>> ---
>>> fs/open.c | 62
>>> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
>>> 1 file changed, 61 insertions(+), 1 deletion(-)
>>>
>>> Index: linux-2.6.26-rc8-mm1/fs/open.c
>>> ===================================================================
>>> --- linux-2.6.26-rc8-mm1.orig/fs/open.c 2008-07-08
>>> 12:12:34.000000000 +0200
>>> +++ linux-2.6.26-rc8-mm1/fs/open.c 2008-07-08 13:23:03.000000000
>>> +0200
>>> @@ -974,6 +974,59 @@ struct file *dentry_open(struct dentry *
>>> EXPORT_SYMBOL(dentry_open);
>>>
>>> /*
>>> + * Marks a given file descriptor entry as busy (should not be busy
>>> when this
>>> + * routine is called.
>>> + *
>>> + * files->next_fd is not updated: this lets the potentially created
>>> hole be
>>> + * filled up on next calls to get_unused_fd_flags.
>>> + *
>>> + * Returns the specified fd if successful, -errno else.
>>> + */
>>> +static int get_predefined_fd_flags(int fd, int flags)
>>> +{
>>> + struct files_struct *files = current->files;
>>> + int error;
>>> + struct fdtable *fdt;
>>> +
>>> + error = -EINVAL;
>>> + if (fd < 0)
>>> + goto out;
>>> +
>>> + error = -EMFILE;
>>> + if (fd >= current->signal->rlim[RLIMIT_NOFILE].rlim_cur)
>>> + goto out;
>>> +
>>> + spin_lock(&files->file_lock);
>>> + fdt = files_fdtable(files);
>>> +
>>> + error = expand_files(files, fd);
>>> + if (error < 0)
>>> + goto out_unlock;
>>> +
>>> + error = -EBUSY;
>>> + if (FD_ISSET(fd, fdt->open_fds))
>>> + goto out_unlock;
>>> +
>>> + FD_SET(fd, fdt->open_fds);
>>> + if (flags & O_CLOEXEC)
>>> + FD_SET(fd, fdt->close_on_exec);
>>> + else
>>> + FD_CLR(fd, fdt->close_on_exec);
>>> +
>>> + /* Sanity check */
>>> + if (fdt->fd[fd] != NULL) {
>>> + printk(KERN_WARNING "get_unused_fd: slot %d not NULL!\n", fd);
>>> + fdt->fd[fd] = NULL;
>>> + }
>>> +
>>> + error = fd;
>>> +out_unlock:
>>> + spin_unlock(&files->file_lock);
>>> +out:
>>> + return error;
>>> +}
>>> +
>>> +/*
>>> * Find an empty file descriptor entry, and mark it busy.
>>> */
>>> int get_unused_fd_flags(int flags)
>>> @@ -1088,7 +1141,14 @@ long do_sys_open(int dfd, const char __u
>>> int fd = PTR_ERR(tmp);
>>>
>>> if (!IS_ERR(tmp)) {
>>> - fd = get_unused_fd_flags(flags);
>>> + if (unlikely(next_data_set(current))) {
>>> + int next_fd = get_next_data(current);
>>> +
>>> + fd = get_predefined_fd_flags(next_fd, flags);
>>> + reset_next_syscall_data(current);
>>> + } else
>>> + fd = get_unused_fd_flags(flags);
>>> +
>>> if (fd >= 0) {
>>> struct file *f = do_filp_open(dfd, tmp, flags, mode);
>>> if (IS_ERR(f)) {
>>>
>>> --
>>>
>>
>>
>>
>
>
>
>
--
===============================================================
Name.......... Nadia DERBEY
Organization.. BULL/DT/OSwR&D/Linux
---------------------------------------------------------------
Email......... mailto:Nadia.Derbey-6ktuUTfB/bM@public.gmane.org
Address....... BULL, B.P. 208, 38432 Echirolles Cedex, France
Tel........... (33) 76 29 77 62 [Internal Bull: (229) 77 62]
Telex,Fax..... 980648 F - (33) 76 29 76 00
Internal Bull. Mail: FREC-B1208
===============================================================
next prev parent reply other threads:[~2008-07-10 6:12 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-08 11:24 [RFC PATCH 0/5] Resend -v2 - Use procfs to change a syscall behavior Nadia.Derbey-6ktuUTfB/bM
2008-07-08 11:24 ` [RFC PATCH 1/5] adds the procfs facilities Nadia.Derbey-6ktuUTfB/bM
[not found] ` <20080708112457.994105000-6ktuUTfB/bM@public.gmane.org>
2008-07-08 19:32 ` Serge E. Hallyn
2008-07-08 11:24 ` [RFC PATCH 2/5] use next syscall data to predefine ipc objects ids Nadia.Derbey-6ktuUTfB/bM
[not found] ` <20080708112458.416998000-6ktuUTfB/bM@public.gmane.org>
2008-07-08 19:38 ` Serge E. Hallyn
2008-07-08 11:24 ` [RFC PATCH 3/5] use next syscall data to predefine process ids Nadia.Derbey-6ktuUTfB/bM
[not found] ` <20080708112458.946320000-6ktuUTfB/bM@public.gmane.org>
2008-07-08 19:49 ` Serge E. Hallyn
2008-07-10 0:27 ` Eric W. Biederman
[not found] ` <m1hcayfusi.fsf-B27657KtZYmhTnVgQlOflh2eb7JE58TQ@public.gmane.org>
2008-07-10 8:32 ` Nadia Derbey
[not found] ` <4875C932.2020503-6ktuUTfB/bM@public.gmane.org>
2008-07-10 9:36 ` Eric W. Biederman
2008-07-08 11:24 ` [RFC PATCH 4/5] use next syscall data to change the behavior of IPC_SET Nadia.Derbey-6ktuUTfB/bM
[not found] ` <20080708112459.231249000-6ktuUTfB/bM@public.gmane.org>
2008-07-08 19:56 ` Serge E. Hallyn
2008-07-08 11:24 ` [RFC PATCH 5/5] use next syscall data to predefine the file descriptor value Nadia.Derbey-6ktuUTfB/bM
[not found] ` <20080708112459.632357000-6ktuUTfB/bM@public.gmane.org>
2008-07-08 20:14 ` Serge E. Hallyn
[not found] ` <20080708201452.GE22904-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-07-09 5:00 ` kathys
[not found] ` <487445E4.6060107-8fk3Idey6ehBDgjK7y7TUQ@public.gmane.org>
2008-07-10 6:12 ` Nadia Derbey [this message]
[not found] ` <4875A849.1030206-6ktuUTfB/bM@public.gmane.org>
2008-07-14 4:58 ` kathys
2008-07-10 0:32 ` Eric W. Biederman
[not found] ` <m1tzeyefz9.fsf-B27657KtZYmhTnVgQlOflh2eb7JE58TQ@public.gmane.org>
2008-07-10 6:25 ` Nadia Derbey
[not found] ` <20080708112422.164370000-6ktuUTfB/bM@public.gmane.org>
2008-07-09 22:10 ` [Devel] [RFC PATCH 0/5] Resend -v2 - Use procfs to change a syscall behavior Alexey Dobriyan
[not found] ` <20080709221028.GA4926-QDJVlCTZ4KWTKS93B3g+7KFoa47nwP16@public.gmane.org>
2008-07-10 0:43 ` Eric W. Biederman
[not found] ` <m1tzeyd0x3.fsf-B27657KtZYmhTnVgQlOflh2eb7JE58TQ@public.gmane.org>
2008-07-10 1:39 ` Alexey Dobriyan
[not found] ` <20080710013915.GB8327-QDJVlCTZ4KWTKS93B3g+7KFoa47nwP16@public.gmane.org>
2008-07-10 2:14 ` Eric W. Biederman
2008-07-15 18:18 ` Eric W. Biederman
2008-07-17 22:42 ` Oren Laadan
[not found] ` <487FCAF0.70607-eQaUEPhvms7ENvBUuze7eA@public.gmane.org>
2008-07-18 1:09 ` Matt Helsley
[not found] ` <1216343365.4844.308.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-07-18 2:49 ` Eric W. Biederman
2008-07-18 2:40 ` Eric W. Biederman
2008-07-10 16:01 ` Dave Hansen
2008-07-10 0:36 ` Eric W. Biederman
[not found] ` <m1lk0aefs1.fsf-B27657KtZYmhTnVgQlOflh2eb7JE58TQ@public.gmane.org>
2008-07-10 9:54 ` Nadia Derbey
-- strict thread matches above, loose matches on Subject: below --
2008-07-03 14:40 [RFC PATCH 0/5] Resend " Nadia.Derbey-6ktuUTfB/bM
2008-07-03 14:40 ` [RFC PATCH 5/5] use next syscall data to predefine the file descriptor value Nadia.Derbey-6ktuUTfB/bM
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=4875A849.1030206@bull.net \
--to=nadia.derbey-6ktuutfb/bm@public.gmane.org \
--cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=kathys-8fk3Idey6ehBDgjK7y7TUQ@public.gmane.org \
--cc=kathys-QcUrd9fbWu1x7SfHBjqd8AC/G2K4zDHf@public.gmane.org \
/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