Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp501367ybk; Fri, 15 May 2020 06:22:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztwAkMXTvvh9L3vgqmJYqcKNXUBlbORYJaU8lrjxR7homWUtB8KsF+Y/sv+s3oJwo25Doz X-Received: by 2002:a17:906:7da:: with SMTP id m26mr2925057ejc.342.1589548923743; Fri, 15 May 2020 06:22:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589548923; cv=none; d=google.com; s=arc-20160816; b=k298uJO7ivnmTWpwPpRWLdORfPTXYCj9l3Juitn9Al3zgBYiHORBt/QUFliP/4D5NY 4Y4Xy/HTCA8ErypGozCQ+1Nuwe6eFqt3C0UEWk6g94W0ty6m1Fs4hMLrRwhlinSXtujM T6XU1z1UaMCbv4EaRTcdcZePW+BJLXmudz71mvWUykGBZyhcc/pJiOdpefBabFMMIejK ZueWUiiBiByXtG1O+SscNdldYfU7eBNne3FLP9ZVKhLWpEq4vqKrSebI8huJzT9UolVF W9Uu0YLdC3k25Zg/1w/x/MvsNZ2grn2mCZBc3R5oRrZYqHCbSgKTgMGwJmzUnm9+sH0O w0sA== 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; bh=VVfnMaxbDJwdN3t1pb7+qmfm61G7CFVxjrzZ7nK0lKs=; b=qjTwlVHERJ1fQcIgt4bxSQ1HnUMViaRdJ8E+V3yve5qqRIxXy4TV8qqpg5cNQ21+kL wdeS3wwcKnM3Yo6cuzQnmiPzYVHIro4WCLk+kLerS7QH2R2OTTPa+3iBUcrP59Etpg4m nV2r8ZLfyPNwQ+aI15Dj86f5HBNJqdQZRpGP+deDI6DhfLlTbgSH8i6hIpmlGZ2mlfx0 dblhJmc7/KVFvXPVh4rZkgTwdiojJE5q9NseMioOBqoPq7ax3+aCIYGc9jo+cc1i1y2t RUzSVFUvn/kSiDAB0QUQbUcpcdh9JtKmeXb3yQsFQnR7WSQprhJxSemBsWrpfcKZYCld LH+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iEZQ1MA6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u25si1208450ejr.1.2020.05.15.06.21.40; Fri, 15 May 2020 06:22:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iEZQ1MA6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728117AbgEONTT (ORCPT + 99 others); Fri, 15 May 2020 09:19:19 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:29896 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726283AbgEONTO (ORCPT ); Fri, 15 May 2020 09:19:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589548753; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VVfnMaxbDJwdN3t1pb7+qmfm61G7CFVxjrzZ7nK0lKs=; b=iEZQ1MA6zRRxiv/TBD4Pvm9wJ9cFasGQEftC/kxnKq3nAT9Jbi81XQ8ldCor0FR+dUCzgZ ZXgwwYH5uRXqYZWV6ty0N8kgFB2tlmCuun4z4egxKkOy4V2Xs2RkSn6uAPiE2OGrRlsFjr 0jS6yWvtFjqhOSDzyXHyt/oXYYaOad4= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-370-GggsbnMGMgCTgZBiNb796A-1; Fri, 15 May 2020 09:19:11 -0400 X-MC-Unique: GggsbnMGMgCTgZBiNb796A-1 Received: by mail-qv1-f70.google.com with SMTP id w6so2575237qvj.4 for ; Fri, 15 May 2020 06:19:11 -0700 (PDT) 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=VVfnMaxbDJwdN3t1pb7+qmfm61G7CFVxjrzZ7nK0lKs=; b=WMYy3A/sNKJqKKVT5PRzJzMK0M/hCsx8afxvxZqgb3CzZ4RdOQbGt5eoPGpbKl6h9I ucyxP6Q3VgMBZqdKk5irHEEwbBRFCjXv29gFoEHeqakfPUg9jlGyFO3OxUQePwYjFHIS ZyAE0e38CSrprn0Vlq+pdjlaSq/c4g+uQXrpgBVmMMTCmlBeGr5Zv21qAtmdJ0xdpTsq 26rrWtia86QuRKbWpqMFLElpEdBlUAkHudphKMQnTQ30+gn55r0/mJE0ZrJ9ZQgvzXRB wuD/Fd75Hb+aTkWIG+lnm/FNs9eRpD4BgAAcWIP7XdgQLE0ghztLYlQ+pD37hjECl7pR T/Ug== X-Gm-Message-State: AOAM531IS19ACx7ERn0mddvV6wduROrao70VZ0h7hUUinb8+YNSwPDoQ NFIerTIClJuF0ebjk7a1vjFm9MJJ3Q7vy+sp/sk/Tszpl/P9MGkrSIeYWNHSvD315I91sCSMIzq 1/MABpam92d1kdMgUFJGLcOuIGG0zlM8UYGomC0KO X-Received: by 2002:a37:2783:: with SMTP id n125mr2067398qkn.335.1589548751341; Fri, 15 May 2020 06:19:11 -0700 (PDT) X-Received: by 2002:a37:2783:: with SMTP id n125mr2067373qkn.335.1589548751140; Fri, 15 May 2020 06:19:11 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Miklos Szeredi Date: Fri, 15 May 2020 15:18:59 +0200 Message-ID: Subject: Re: Setting mount propagation type in new mount API To: "Michael Kerrisk (man-pages)" Cc: David Howells , lkml , "linux-fsdevel@vger.kernel.org" , Petr Vorel , linux-man 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 Fri, May 15, 2020 at 3:04 PM Miklos Szeredi wrote: > > On Fri, May 15, 2020 at 1:40 PM Michael Kerrisk (man-pages) > wrote: > > > > Hello David, Miklos, > > > > I've been looking at the new mount API (fsopen(), fsconfig(), > > fsmount(), move_mount(), etc.) and among the details that remain > > mysterious to me is this: how does one set the propagation type > > (private/shared/slave/unbindable) of a new mount and change the > > propagation type of an existing mount? > > Existing mount can be chaged with mount(NULL, path, NULL, MS_$(propflag), NULL). > > To do that with a detached mount created by fsmount(2) the > "/proc/self/fd/$fd" trick can be used. > > The plan was to introduce a mount_setattr(2) syscall, but that hasn't > happened yet... I'm not sure we should be adding propagation flags to > fsmount(2), since that is a less generic mechanism than > mount_setattr(2) or just plain mount(2) as shown above. Also note that only setting MS_SHARED makes sense on a new mount returned by fsmount(2) because - MS_PRIVATE is a no op, due to mount already being private - same for MS_SLAVE, since it's only different from MS_PRIVATE on mounts receiving propagation, which a new mount by definition isn't - MS_UNBINDABLE just prevents move_mount(2) from working so that's not really useful, though at least it does something A more interesting issue is whether we'd want to control the propagation of the target when moving into a shared tree. I.e. should there be a MOVE_MOUNT_DONTPROPAGATE flag for move_mount(20 that prevents the new mount from being propagated... Thanks, Miklos