From: Al Viro <viro@zeniv.linux.org.uk>
To: Salman Qazi <sqazi@google.com>
Cc: Eric Biederman <ebiederm@xmission.com>,
Eric Dumazet <edumazet@google.com>,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] fs, ipc: Use an asynchronous version of kern_unmount in IPC
Date: Thu, 7 Feb 2019 04:14:55 +0000 [thread overview]
Message-ID: <20190207041455.GY2217@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20190206195354.40576-1-sqazi@google.com>
On Wed, Feb 06, 2019 at 11:53:54AM -0800, Salman Qazi wrote:
> This patch solves the issue by removing synchronize_rcu from mq_put_mnt.
> This is done by implementing an asynchronous version of kern_unmount.
>
> Since mntput() sleeps, it needs to be deferred to a work queue.
>
> Additionally, the callers of mq_put_mnt appear to be safe having
> it behave asynchronously. In particular, put_ipc_ns calls
> mq_clear_sbinfo which renders the inode inaccessible for the purposes of
> mqueue_create by making s_fs_info NULL. This appears
> to be the thing that prevents access while free_ipc_ns is taking place.
> So, the unmount should be able to proceed lazily.
Ugh... I really doubt that it's correct. The caller is
mq_put_mnt(ns);
free_ipc_ns(ns);
and we have
static void mqueue_evict_inode(struct inode *inode)
{
...
ipc_ns = get_ns_from_inode(inode);
with
static struct ipc_namespace *get_ns_from_inode(struct inode *inode)
{
struct ipc_namespace *ns;
spin_lock(&mq_lock);
ns = __get_ns_from_inode(inode);
spin_unlock(&mq_lock);
return ns;
}
and
static inline struct ipc_namespace *__get_ns_from_inode(struct inode *inode)
{
return get_ipc_ns(inode->i_sb->s_fs_info);
}
with ->s_fs_info being the ipc_namespace we are freeing after mq_put_ns()
Are you saying that get_ipc_ns() after free_ipc_ns() is safe? Because
->evict_inode() *IS* called on umount. What happens to your patch if
there was a regular file left on that filesystem?
Smells like a memory corruptor...
next prev parent reply other threads:[~2019-02-07 4:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-06 19:53 [PATCH] fs, ipc: Use an asynchronous version of kern_unmount in IPC Salman Qazi
2019-02-06 20:13 ` Eric Dumazet
2019-02-07 4:14 ` Al Viro [this message]
2019-02-07 18:43 ` Salman Qazi
2019-02-13 21:07 ` Salman Qazi
2019-03-04 19:48 ` [PATCH RESENT] " Salman Qazi
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=20190207041455.GY2217@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=ebiederm@xmission.com \
--cc=edumazet@google.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=sqazi@google.com \
/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;
as well as URLs for NNTP newsgroup(s).