Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp116638imm; Tue, 3 Jul 2018 15:08:40 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfplnfXNDqDN8DOtcO4mW2YOeTY+n739LPuDl3oW3Z5OalqzuWearyJTxprBld01G7zDgJy X-Received: by 2002:a65:64c8:: with SMTP id t8-v6mr18502759pgv.110.1530655720290; Tue, 03 Jul 2018 15:08:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530655720; cv=none; d=google.com; s=arc-20160816; b=vJ2/OdLSQaaQMhIjud7sFEjmvA5qndZLlDjioy69SjmO2I0vuMbdXXT705JKWQx91a KEIkTcFDOrxDrBvAc7GpLgQtjOBdJUPm0si08TzTVUxB+NUXfTz3abR0Hrnt7aPi62K5 Dg9gHHX1n9ASTYaHZXhoDUrI3/XcjdgKaNs8V3S46X25RFavC8xzJJLUToK8tG+tYIL0 Gykixjf+6DEV7ZCSK4TrTts7O/pwrikuobLb/1NekWwXMT60eMgaqIBGY5lmbPDKir9b 3nbEC7lmFmuRgYoSxuvZfhpwHnGusvuYjb4e5BCh/qPADarr7t1w+/q63odzksKTcEQR QaVw== 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=49rCfH8bQNfMwwwrGZu81E1rN+e2aLJNNJTCmRIEuCA=; b=QLMhD2cFE6qw3etYsQdE/uCql1m2yAKFnFy4jkghANuNXDY3eyVNuVwsE+4VYQIGTR DyvzuLMfA779dZmKYr6jDw6Ci7TkeHrC0dhO20/SSVZNibUK9xYmgz+L9IOQJ0CR4whO sIhpktJC/3JANn+XaVjSWL2B7FTiOK2v3EtjMBxKCfRLhLwxs2pI5y0bes/BDATnVssi Bj1zP4o7WZi2RLdFqfmcYX/84NpLSNFatPEZc95ONCa6RNkXKmmlM430cuZ0zXw9yZig r/9mNZe+b4YvVESEloJj3iDWtQOmSVysk1CELmHwj9lnj0MmzSzKgW1cgfzdrZMWSR1E Xh/A== 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 z4-v6si1791815pge.173.2018.07.03.15.08.25; Tue, 03 Jul 2018 15:08:40 -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 S933106AbeGCWGw convert rfc822-to-8bit (ORCPT + 99 others); Tue, 3 Jul 2018 18:06:52 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35542 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932361AbeGCWGv (ORCPT ); Tue, 3 Jul 2018 18:06:51 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7DCF9DFDE; Tue, 3 Jul 2018 22:06:50 +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 C5959FF5B; Tue, 3 Jul 2018 22:06:49 +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: <20180703215825.GX30522@ZenIV.linux.org.uk> References: <20180703215825.GX30522@ZenIV.linux.org.uk> <20180703183325.GA210265@gmail.com> <152720672288.9073.9868393448836301272.stgit@warthog.procyon.org.uk> <152720678933.9073.11201500538963619904.stgit@warthog.procyon.org.uk> <14124.1530654802@warthog.procyon.org.uk> To: Al Viro Cc: dhowells@redhat.com, Eric Biggers , 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: <19906.1530655609.1@warthog.procyon.org.uk> Content-Transfer-Encoding: 8BIT Date: Tue, 03 Jul 2018 23:06:49 +0100 Message-ID: <19907.1530655609@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 03 Jul 2018 22:06:50 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 03 Jul 2018 22:06:50 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.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 Al Viro wrote: > IOW, all of those should be unconditional. Fair point. How about the attached, then? David --- commit 1aa76514c426150af429d111cec256e81729fa6f 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..dccd397751b1 100644 --- a/fs/super.c +++ b/fs/super.c @@ -516,19 +516,12 @@ 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); - destroy_unused_super(s); - } + destroy_unused_super(s); return ERR_PTR(-EBUSY); } if (!grab_super(old)) goto retry; - if (s) { - up_write(&s->s_umount); - destroy_unused_super(s); - s = NULL; - } + destroy_unused_super(s); return old; } } @@ -545,7 +538,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); }