Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp162749imm; Thu, 12 Jul 2018 16:25:12 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfIzyBbSdDeyPRHWFHdflTcPPPZPyLsB07tZQx280HhimcL4GWIUJPzjMqKRBbObeSO1j28 X-Received: by 2002:a65:5286:: with SMTP id y6-v6mr3825812pgp.65.1531437912738; Thu, 12 Jul 2018 16:25:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531437912; cv=none; d=google.com; s=arc-20160816; b=be9dTEEyP7OtzmxT07nNlg+UGPovphkEzNdVrKApa7c1vvPwKJN5LFN5lzPqy/GHCQ gCx5JX1cOXZINFGRgN3ZIpO6aNNxdA/jXcmYCjRcMR/wRLaJobu+472OSQ+79zMuTWMk BZjsfzAeMIemePGLdxPe8BAG3s5GW1xT3HwsD+7yZirKpUC6BK94C2ITMH2XjAdOzBJ4 bsDalKRVlESPrbsr1Wn6r76DcCtdwa6yyUtBcxUJF5FBLNosrb/7U5di7n9ahvf8koVN NXYYHftuNLQ0EmdsA7gTsxFhP6aXtoE+zJBzXIuuGf3n/9oh1CEXMdaq1bOj9dBRwiuA +rBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=Z8d+iehrqfZzo2nQIYOX74FvGIE0UjJxmdIcbXuudgs=; b=kWEhZaO4gkRB03uMF8jHrRhvg0KhPoOh2K/iUrVcZHm9mBM2RYe6LSv2ICEFJvUfiX zXg6zuVqsN7b+/GvR39+565oiHtJ6pXmGFun3auQ5swhTIbsCsDCBF/iRZoB62vbhgfA kReBeMJjtBbBK4IC+7I93gyr2ULfG8MjuBpXMnTrhkyBIGY76jVj/aAkpr2LtyknhhZd Y3NcgvrJbFAmymHnRgJfAgigPkRMjBvSh16Ts2tayHWkZPtm+MYI5OFK7RqzjzE30yyS EZR0gbKOcR7sV9vb3bFGJtPMF9meT7Li9bOWlsQ6x2uR1SdxqdvRmhGyKwbRir887xqL xvOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=lgP33wwS; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d1-v6si23878148pfk.166.2018.07.12.16.24.57; Thu, 12 Jul 2018 16:25:12 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=lgP33wwS; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387613AbeGLXgK (ORCPT + 99 others); Thu, 12 Jul 2018 19:36:10 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:45862 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733111AbeGLXgK (ORCPT ); Thu, 12 Jul 2018 19:36:10 -0400 Received: by mail-oi0-f65.google.com with SMTP id q11-v6so33399826oic.12 for ; Thu, 12 Jul 2018 16:24:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Z8d+iehrqfZzo2nQIYOX74FvGIE0UjJxmdIcbXuudgs=; b=lgP33wwShhyZNqUjhYDsIQ7v8oq4ITPpaf8dgIYVGn08RA8KlD3uaFViQcoouZiaQn oQZT7E4dZRhyTOx+zsARuzLgHbV6n4Y6GGvVNBKIEu7BLhxv/OyoGrQ2kC58F9Ucz2Zr 5sbTzT+IKtsd6WQd99o0HiyzSIoWCG+P84m5Ox1be+zU93/9Czzk5qBfCIIRSjyZdQg/ A7fJmW41+jIaaIIPAjueeIClBtEA2WgMnRCRH02ISgX2dr3E9kDRxiEXnw1pbwD7XQpu Z5QRdrvPZuE6XLIRnH8qzaGXYzaxfkl/CGBTrwBjgGJVo9nUxjFPlAOT/xXBh+MRte0t jx7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Z8d+iehrqfZzo2nQIYOX74FvGIE0UjJxmdIcbXuudgs=; b=TKdRbdiHFh/J+ncCRejGoCOCN7UEhrEr+ffSnmJ2ByEE/5rxpTE7TQTR9qLBQRPqGz UZrHNH+h4fqd36RAFFNulWRMVFTtyBsr3XZNxDcmr2H8PLEj+kzootR77XIA5G3py1WI aISqQCTFGqx0pDlFKhwHBm5KhI4TsgKG7tOdLTE338lRjWibyzRlg/IdyXezme1uJgmU vK51Bp9pwUXpguPO5L1wVHCKPNaOogdUf3rP0+H60yl/AVEOsFy/m74xSX9YasXpYtwv 4CFH5TidIiVDkg3YTaEr84rtzXebWhQyXYdR2ZUNAobE/r1fDWYWDo9IRwMwuRCVGLWd 4MQA== X-Gm-Message-State: AOUpUlFmvQ9qbBwI438H9GpHnfqC3iSJioe3hdxvw9kuhTEJCDtHY4Az txd5J8oxH2Tjr08a7KT2ezgy17pp3Af0Dvy6DaMxRw== X-Received: by 2002:aca:856:: with SMTP id 83-v6mr4303277oii.333.1531437861900; Thu, 12 Jul 2018 16:24:21 -0700 (PDT) MIME-Version: 1.0 References: <153126248868.14533.9751473662727327569.stgit@warthog.procyon.org.uk> <153126264966.14533.3388004240803696769.stgit@warthog.procyon.org.uk> <686E805C-81F3-43D0-A096-50C644C57EE3@amacapital.net> <22370.1531293761@warthog.procyon.org.uk> <7002.1531407244@warthog.procyon.org.uk> <16699.1531426991@warthog.procyon.org.uk> <18233.1531430797@warthog.procyon.org.uk> <20180712223223.GA28610@thunk.org> <22105.1531436081@warthog.procyon.org.uk> In-Reply-To: <22105.1531436081@warthog.procyon.org.uk> From: Jann Horn Date: Thu, 12 Jul 2018 16:23:54 -0700 Message-ID: Subject: Re: [PATCH 24/32] vfs: syscall: Add fsopen() to prepare for superblock creation [ver #9] To: David Howells Cc: "Theodore Y. Ts'o" , Linus Torvalds , Andy Lutomirski , Al Viro , Linux API , linux-fsdevel@vger.kernel.org, kernel list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 12, 2018 at 3:54 PM David Howells wrote: > > Theodore Y. Ts'o wrote: > > > So maybe the answer is that you open /dev/sda1 and /dev/sda2 and then > > pass the file descriptors to the fsopen object? We can require that > > the fd's be opened with O_RDWR and O_EXCL, which has the benefit where > > if you have multiple block devices, you know *which* block device had > > a problem with being grabbed for an exclusive open. > > Would that mean then that doing: > > mount /dev/sda3 /a > mount /dev/sda3 /b > > would then fail on the second command because /dev/sda3 is already open > exclusively? Not exactly. mount_bdev() uses FMODE_EXCL, which locks out parallel usage *with a different filesystem type*. This is the effect: # strace -e trace=mount mount -t vfat /dev/loop0 mount mount("/dev/loop0", "/home/jannh/tmp/x/mount", "vfat", MS_MGC_VAL, NULL) = 0 +++ exited with 0 +++ # strace -e trace=mount mount -t ext4 /dev/loop0 mount mount("/dev/loop0", "/home/jannh/tmp/x/mount", "ext4", MS_MGC_VAL, NULL) = -1 EBUSY (Device or resource busy) mount: /home/jannh/tmp/x/mount: /dev/loop0 already mounted on /home/jannh/tmp/x/mount. +++ exited with 32 +++ I don't really understand why it's not more strict though...