Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp103834imm; Tue, 3 Jul 2018 14:54:30 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL2F48BTUGdp9mT6BEJhR/PaV19E1zWwEiftO0Kk3SD1PPiH31S/2liNqHZdQFIYMp1oU6+ X-Received: by 2002:a17:902:28ea:: with SMTP id f97-v6mr30763804plb.55.1530654870186; Tue, 03 Jul 2018 14:54:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530654870; cv=none; d=google.com; s=arc-20160816; b=AN7H2QcwTeScfXT3GcIAjVYmzWbzfSawwGAun5S5c06Co8Z7Ad56LPeHK1h8FgEzAG V7OSVCjkegPVPu+9EpNXUJ9Mb1LEi4rPgDhepH1kGazq2WcTQ0xzqtPafht8YE8obVQY RLNOuicD/6N8yE1T5mwHY2EDhlkKIplnzA1X+vO5sl8hTbgP6TFqVbq2OVtIDYK/eMFa S6861ISlW2YQMme27JajRd9j0NPIgs6VgKrKy0Z7b4+oX9wh031/V0IMLv7R38Kb/eGT 3lhXmMeEUn+nSahSfjQke70MwEANlPptUiS7QwgwaVouM7dEcicLoW0RXvdBYHMvUEvs Xs4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:content-transfer-encoding :content-id:mime-version:subject:cc:to:references:in-reply-to:from :organization:arc-authentication-results; bh=fZ1v62hinUuvbauYCBPQdGW3qP0P0e8lHr17l/ACZL4=; b=GRXdj/ZW2HbytM91da/k+NoXaraaDTWiysIW5QUEd6j38AyA6VIMrhFt05Iv8L9gul d5APRTetudlqQkhuqteBk3OIFiEah6PwTueb6BiJvz9YR3hTuuii9j5F5rZzMxldpmhk ESkpo34X9ruRRQARLoRm3d7H0jHid6B9RqXo7hD7pYKGy6bJT8IOLa03z9yVi5AfXfHa i6Q/XqdX3Q/PKP5hc88w/8DUf8kbd8preJcAK7Cj0Zs+GgdgKQDBUAU9d1gtOjtTGGRP 1CuTr/tHmaU5BmXJHXqtoLmxvUJcHHIrOCFcxfrBLciH480hyaHan+3CoCYmKzcDL1h6 wxEw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 16-v6si2038588pfy.169.2018.07.03.14.54.15; Tue, 03 Jul 2018 14:54:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753419AbeGCVx0 convert rfc822-to-8bit (ORCPT + 99 others); Tue, 3 Jul 2018 17:53:26 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:51308 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752949AbeGCVxY (ORCPT ); Tue, 3 Jul 2018 17:53:24 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 19EAB4021CC1; Tue, 3 Jul 2018 21:53:24 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-123-203.rdu2.redhat.com [10.10.123.203]) by smtp.corp.redhat.com (Postfix) with ESMTP id 46A2E111C482; Tue, 3 Jul 2018 21:53:23 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20180703183325.GA210265@gmail.com> References: <20180703183325.GA210265@gmail.com> <152720672288.9073.9868393448836301272.stgit@warthog.procyon.org.uk> <152720678933.9073.11201500538963619904.stgit@warthog.procyon.org.uk> To: Eric Biggers , viro@zeniv.linux.org.uk Cc: dhowells@redhat.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-afs@lists.infradead.org Subject: Re: [PATCH 10/32] VFS: Implement a filesystem superblock creation/configuration context [ver #8] MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <14123.1530654802.1@warthog.procyon.org.uk> Content-Transfer-Encoding: 8BIT Date: Tue, 03 Jul 2018 22:53:22 +0100 Message-ID: <14124.1530654802@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 03 Jul 2018 21:53:24 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Tue, 03 Jul 2018 21:53:24 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dhowells@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Eric Biggers wrote: > ->s_umount is released once here and again in destroy_unused_super(). Good catch, thanks. The interface has changed over the lifetime of the patches. How about the attached patch? David --- commit b3899e214a6a0e0551f6dc707b28d61b11e718a5 Author: David Howells Date: Tue Jul 3 22:35:28 2018 +0100 vfs: Locking fix for sget_fc() In sget_fc(), don't drop the s_umount lock before calling destroy_unused_super() as that will drop the lock. Fixes: 8a2e54b8af88 ("vfs: Implement a filesystem superblock creation/configuration context") Reported-by: Eric Biggers Signed-off-by: David Howells diff --git a/fs/super.c b/fs/super.c index 43400f5fa33a..b014cd48a451 100644 --- a/fs/super.c +++ b/fs/super.c @@ -516,19 +516,14 @@ struct super_block *sget_fc(struct fs_context *fc, continue; if (fc->user_ns != old->s_user_ns) { spin_unlock(&sb_lock); - if (s) { - up_write(&s->s_umount); + if (s) destroy_unused_super(s); - } return ERR_PTR(-EBUSY); } if (!grab_super(old)) goto retry; - if (s) { - up_write(&s->s_umount); + if (s) destroy_unused_super(s); - s = NULL; - } return old; } } @@ -545,7 +540,6 @@ struct super_block *sget_fc(struct fs_context *fc, if (err) { s->s_fs_info = NULL; spin_unlock(&sb_lock); - up_write(&s->s_umount); destroy_unused_super(s); return ERR_PTR(err); }