From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pekka Enberg Subject: Re: [PATCH 04/23] vfs: Introduce infrastructure for revoking a file Date: Tue, 2 Jun 2009 10:08:14 +0300 Message-ID: <84144f020906020008w54b1c628hc6e41dcddd208f5f@mail.gmail.com> References: <1243893048-17031-4-git-send-email-ebiederm@xmission.com> <84144f020906012216n715a04d0ha492abc12175816@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Al Viro , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Hugh Dickins , Tejun Heo , Alexey Dobriyan , Linus Torvalds , Alan Cox , Greg Kroah-Hartman , Nick Piggin , Andrew Morton , Christoph Hellwig , "Eric W. Biederman" To: "Eric W. Biederman" Return-path: Received: from mail-bw0-f222.google.com ([209.85.218.222]:50832 "EHLO mail-bw0-f222.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752831AbZFBHIO convert rfc822-to-8bit (ORCPT ); Tue, 2 Jun 2009 03:08:14 -0400 In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Hi Eric, On Tue, Jun 2, 2009 at 9:51 AM, Eric W. Biederman wrote: > Pekka Enberg writes: > >> Hi Eric, >> >> On Tue, Jun 2, 2009 at 12:50 AM, Eric W. Biederman >> wrote: >>> +#ifdef CONFIG_FILE_HOTPLUG >>> + >>> +static bool file_in_use(struct file *file) >>> +{ >>> + =A0 =A0 =A0 struct task_struct *leader, *task; >>> + =A0 =A0 =A0 bool in_use =3D false; >>> + =A0 =A0 =A0 int i; >>> + >>> + =A0 =A0 =A0 rcu_read_lock(); >>> + =A0 =A0 =A0 do_each_thread(leader, task) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 for (i =3D 0; i < MAX_FILE_HOTPLUG_LO= CK_DEPTH; i++) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (task->file_hotplu= g_lock[i] =3D=3D file) { >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 in_us= e =3D true; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto = found; >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >>> + =A0 =A0 =A0 } while_each_thread(leader, task); >>> +found: >>> + =A0 =A0 =A0 rcu_read_unlock(); >>> + =A0 =A0 =A0 return in_use; >>> +} >> >> This seems rather heavy-weight. If we're going to use this >> infrastructure for forced unmount, I think this will be a problem. > >> Can't we two this in two stages: (1) mark a bit that forces >> file_hotplug_read_trylock to always fail and (2) block until the las= t >> remaining in-kernel file_hotplug_read_unlock() has executed? > > Yes there is room for more optimization in the slow path. > I haven't noticed being a problem yet so I figured I would start > with stupid and simple. Yup, just wanted to point it out. On Tue, Jun 2, 2009 at 9:51 AM, Eric W. Biederman wrote: > I can easily see two passes. =A0The first setting the flag an calling > f_op->dead. =A0The second some kind of consolidate walk through the t= ask > list, allowing checking on multiple files at once. > > I'm not ready to consider anything that will add cost to the fast > path in the file descriptors though. Makes sense. Pekka -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html