Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1424270ybg; Wed, 29 Jul 2020 13:59:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRNrCTjsY0Gt33utUoPfB8u8Fdmj86QPJOXFQDecRxOCiApjPdfMnV2rHfPH4Yb8XWpoZl X-Received: by 2002:a05:6402:1d93:: with SMTP id dk19mr177622edb.382.1596056373069; Wed, 29 Jul 2020 13:59:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596056373; cv=none; d=google.com; s=arc-20160816; b=y0kGcZyjifxusLOiF/ReyKlGoA4hv5jVpZf9VbnKugAfK/VgC6AVaYheRMiCvqrtUp kDNWY0yj0hiEyZ3SEKYQUh6UIuh3Pgc1302NC7wHxPEEKPDrMd/qg83Q4b6XYtj25NVn 7ekcirBx7XgJqmwg6OQEYqXGRGHQjFjR36iOMn+EdAGVTY/zNr3xaEd85YFLDs4zstvs YYV8F1YOybXuCKEqf1piU9C7vaxSx+9gCsAB43iQ4N9mjOo1eFIO9IEPQ7veMz2gdgst nHapITgrntwfjLeR2lpTFq6Fn7yHJQm35KNIj7x6UBg94nTpCMUDZMaeU5eZSLmJYNHo q8aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:message-id:date :content-transfer-encoding:content-id:mime-version:subject:cc :references:in-reply-to:from:organization:dkim-signature; bh=vLUygYYzd++JIlYknve101yWy4mcR2ip0YkY0hzcOSk=; b=Ikrl9tniULz4WIfTjYt5++TmjORlfpWW3l6kgaQ82Gjln3flP5e+dvIJCG2a5K7oNk PYZTCth4ina4a4nWNteLEmmrBAv/YRhQw6UtzDbR+iuJu6AyKcFHrLFbZcxvD4/fKhen oWrZ59JCe9VARoDix8Ez/QzGBPPlVDPUVbyDAQb1pyh1ZvqMUavayJlWh/ztsuqgMgf3 k9lvnkpVtr2MF3NoFyxZ0t2hcqE3I0YA5xfQds7wLH4WRfCf71jWb8ijSKYk6EFikP3A J/yP5c/e82dFnIKx8KMtdt79p+vzMn40GIAs6I8BTlM49nerA4gZz8MWFF6JRSaA8IG+ my3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@redhat.com header.s=mimecast20190719 header.b="gHtP/1IA"; 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=fail (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 j21si1977714edh.20.2020.07.29.13.59.11; Wed, 29 Jul 2020 13:59:33 -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=fail header.i=@redhat.com header.s=mimecast20190719 header.b="gHtP/1IA"; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726947AbgG2U6v (ORCPT + 99 others); Wed, 29 Jul 2020 16:58:51 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:36855 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726496AbgG2U6v (ORCPT ); Wed, 29 Jul 2020 16:58:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596056329; h=from:from:reply-to:subject:subject:date:date:message-id:message-id:to: cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vLUygYYzd++JIlYknve101yWy4mcR2ip0YkY0hzcOSk=; b=gHtP/1IA1hEEk41GDr3RfEQUyKVQ2kONfyT7DV9tMeWVeTda6jjTvfByvgDq85XBzQT+cm Cw66Q4+p0LR8qAlHB+qkJmMfL2mCJN4I2gcVETBfGqzQvsXJHQxt9ifSIutm+ssFw57gK7 qBuor5vVCjU4kCq7RwU1O7uEi7ujcgs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-456-Q_tBaD1HMNSuLNq5odNeeA-1; Wed, 29 Jul 2020 16:58:47 -0400 X-MC-Unique: Q_tBaD1HMNSuLNq5odNeeA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 827E918C63C0; Wed, 29 Jul 2020 20:58:46 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-112-32.rdu2.redhat.com [10.10.112.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id E7C8A19C71; Wed, 29 Jul 2020 20:58:41 +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: <4007797.1596055016@warthog.procyon.org.uk> References: <4007797.1596055016@warthog.procyon.org.uk> <0b154b9b-728f-7d57-d4c5-ec25fc9dfdf3@toxicpanda.com> Cc: dhowells@redhat.com, Josef Bacik , Linus Torvalds , Al Viro , Eric Sandeen , Christoph Hellwig , Linux Kernel Mailing List , Linux FS Devel , David Sterba Subject: Re: Inverted mount options completely broken (iversion,relatime) MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4056339.1596056321.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Wed, 29 Jul 2020 21:58:41 +0100 Message-ID: <4056340.1596056321@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org David Howells wrote: > > So my question is, what do we do here? > = > Hmmm... As the code stands, MS_RDONLY, MS_SYNCHRONOUS, MS_MANDLOCK, > MS_I_VERSION and MS_LAZYTIME should all be masked off before the new fla= gs are > set if called from mount(2) rather than fsconfig(2). > = > do_remount() gives MS_RMT_MASK to fs_context_for_reconfigure() to load i= nto > fc->sb_flags_mask, which should achieve the desired effect in > reconfigure_super() on this line: > = > WRITE_ONCE(sb->s_flags, ((sb->s_flags & ~fc->sb_flags_mask) | > (fc->sb_flags & fc->sb_flags_mask))); So applying the attached patch and then doing: mount -t tmpfs none /mnt mount -o remount,iversion /mnt mount -o remount,noiversion /mnt mount -o remount,norelatime /mnt mount -o remount,relatime /mnt prints: sb=3D70010000 set=3D800000 mask=3D2800051 sb=3D70810000 set=3D0 mask=3D2800051 sb=3D70010000 set=3D0 mask=3D2800051 sb=3D70010000 set=3D0 mask=3D2800051 MS_RELATIME isn't included in MS_RMT_MASK, so remount shouldn't be able to change it. David --- diff --git a/fs/super.c b/fs/super.c index 904459b35119..540cb37c11e7 100644 --- a/fs/super.c +++ b/fs/super.c @@ -964,6 +964,7 @@ int reconfigure_super(struct fs_context *fc) } } = + printk("sb=3D%lx set=3D%x mask=3D%x\n", sb->s_flags, fc->sb_flags, fc->s= b_flags_mask); WRITE_ONCE(sb->s_flags, ((sb->s_flags & ~fc->sb_flags_mask) | (fc->sb_flags & fc->sb_flags_mask))); /* Needs to be ordered wrt mnt_is_readonly() */