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=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS 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 39004C169C4 for ; Mon, 11 Feb 2019 17:58:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0DEE821B69 for ; Mon, 11 Feb 2019 17:58:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729873AbfBKR6M convert rfc822-to-8bit (ORCPT ); Mon, 11 Feb 2019 12:58:12 -0500 Received: from mx2.suse.de ([195.135.220.15]:45560 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726104AbfBKR6M (ORCPT ); Mon, 11 Feb 2019 12:58:12 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 02941AB4D for ; Mon, 11 Feb 2019 17:58:11 +0000 (UTC) From: aaptel@suse.com (=?utf-8?Q?Aur=C3=A9lien?= Aptel) To: linux-fsdevel@vger.kernel.org Subject: Duplicate network filesystems Date: Mon, 11 Feb 2019 18:58:09 +0100 Message-ID: <87sgwujjgu.fsf@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Hi, In fs/namespace.c do_add_mount() we do this check: /* Refuse the same filesystem on the same mount point */ err = -EBUSY; if (path->mnt->mnt_sb == newmnt->mnt.mnt_sb && path->mnt->mnt_root == path->dentry) goto unlock; So that mount fails with EBUSY. But for networked filesystems (at least cifs and nfs) you can do this: mount //foo /mnt -o A mount //foo /mnt -o B # different options Since the SB are different it works, fine. But mounting a 3rd time with options A succeeds, where from a user POV I would have expected to fail. So to recap: mount //foo /mnt -o A mount //foo /mnt -o A # EBUSY => expected behaviour mount //foo /mnt -o A mount //foo /mnt -o B # ok => expected behaviour mount //foo /mnt -o A mount //foo /mnt -o B mount //foo /mnt -o A # ok => what? Shouldn't we check the stack of filesystems mounted at the path instead of just the last one? Cheers, -- Aurélien Aptel / SUSE Labs Samba Team GPG: 1839 CB5F 9F5B FB9B AA97 8C99 03C8 A49B 521B D5D3 SUSE Linux GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)