From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 420D9C282C2 for ; Thu, 7 Feb 2019 04:15:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 127C6218D3 for ; Thu, 7 Feb 2019 04:15:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726642AbfBGEO7 (ORCPT ); Wed, 6 Feb 2019 23:14:59 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:58898 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726393AbfBGEO7 (ORCPT ); Wed, 6 Feb 2019 23:14:59 -0500 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.91 #2 (Red Hat Linux)) id 1grb5T-0003pi-T4; Thu, 07 Feb 2019 04:14:55 +0000 Date: Thu, 7 Feb 2019 04:14:55 +0000 From: Al Viro To: Salman Qazi Cc: Eric Biederman , Eric Dumazet , linux-fsdevel@vger.kernel.org Subject: Re: [PATCH] fs, ipc: Use an asynchronous version of kern_unmount in IPC Message-ID: <20190207041455.GY2217@ZenIV.linux.org.uk> References: <20190206195354.40576-1-sqazi@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190206195354.40576-1-sqazi@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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...