[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87fvsby03u.fsf@tw-ebiederman.twitter.com>
Date: Tue, 08 Oct 2013 13:32:53 -0700
From: ebiederm@...ssion.com (Eric W. Biederman)
To: Miklos Szeredi <miklos@...redi.hu>
Cc: "Serge E. Hallyn" <serge@...lyn.com>,
Al Viro <viro@...iv.linux.org.uk>,
Linux-Fsdevel <linux-fsdevel@...r.kernel.org>,
Kernel Mailing List <linux-kernel@...r.kernel.org>,
Andy Lutomirski <luto@...capital.net>,
Rob Landley <rob@...dley.net>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [RFC][PATCH 2/3] vfs: Add a function to lazily unmount all mounts from any dentry.
Miklos Szeredi <miklos@...redi.hu> writes:
> On Fri, Oct 04, 2013 at 03:43:18PM -0700, Eric W. Biederman wrote:
>>
>> +void detach_mounts(struct dentry *dentry)
>> +{
>> + struct mount *mnt, *next;
>> + struct mountpoint *mp;
>> +
>> + namespace_lock();
>> + if (!d_mountpoint(dentry)) {
>> + namespace_unlock();
>> + return;
>> + }
>> + mp = new_mountpoint(dentry);
>> + if (IS_ERR(mp)) {
>> + return;
>> + }
>> + br_write_lock(&vfsmount_lock);
>> + list_for_each_entry_safe(mnt, next, &mp->m_list, mnt_mp_list) {
>
> I don't think list_for_each_entry_safe is actually safe enough here. Because
> propageted umounts will likely remove other mounts from the same mountpoint as
> well. Doing it with "while (!list_empty(&mp->m_list))" should be better, and
> AFAICS it will always make progress.
Thanks I will take a look. But on the surface that logic sounds
correct.
Eric
--
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