From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.219.46 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796332857; b=pApkA6SKKvxrn8w6YaxTODXZW5p1XK33V0LQwDF/EpHt2KTBr3vy8qUJTQDh1Jng5tKF zZp1hbzynMT265pnvBZooumY2NUk0eXc7YB5k3CoK+y6oSaIjrw8jgrIB1UvTJIcGTj2q 9TF0r782FceankxGw8f0VfJWedpOQQDSjRICh2C/dHdJne7qOZOYfiOY/h224OkrTXc8w kEJzHxjnbGLMahE55XgE6CMnP00633PC+ZBi/iWd7o/QOwEPtf2zZg5vibVOG0/IDv6Y0 93sho2pkWo88K/9AXiELGP3fFKU1L6DSeE27gItrqBDNHfB6c32VZ7K0S8qtmaeaUUg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796332857; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-Id:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=98cFHDttXySM8av0xO4vY7TTIU+ZXN9GGMOoDmrffLU=; b=5moMi4Sp89VFU+TRT3cb3OzcVwnbB+cMat5iAWFvd7NSkqxDHcI3SaKABoD4Nq1bCSgY jmUkg/HmoMO4d4lOOOezbZXmcFh6BaOent9dZ/Q223c/CxtrZOjz7kxl1D0k+bzmDcegN JTUdPJMnC76vVkaWPABLE3QJX+eDaAkBiS1Icol8aGYGKrXNaGtBkQ9uaePF6GPI/3maq wrMhvr/+ei9lgiMxmLHLdszDAPrtvYZ9MUrys9TgDykbq5xAapi1ypdMemkdXAjMFDIOu mI5wgwGvC2L9D53rTw5qVgRK3aX7N7MlMEhGbYCseF27zr6cJbo1iRR2oGKSVXcIeRQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=BbQtnC1c; arc=none smtp.remote-ip=209.85.219.46 Received: from mail-qv1-f46.google.com (mail-qv1-f46.google.com [209.85.219.46]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD20A606A330 for ; Thu, 3 Dec 2026 21:20:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BD20A606A330 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=BbQtnC1c Received: by mail-qv1-f46.google.com with SMTP id 6a1803df08f44-92123971d1bso2725956d6.1 for ; Thu, 03 Dec 2026 13:20:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796332856; x=1796937656; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=98cFHDttXySM8av0xO4vY7TTIU+ZXN9GGMOoDmrffLU=; b=BbQtnC1cZhX1hI/kWkwpzJTnMOuxls8nX6zf08N9+WDSpcesohA9uWqySVA1hgDYxF jETzQCth+yG1Ew+sRFcdtjll9UyjrQfNVDITbwtp+8W40q2DkZcNjwESrjqc5ZlqEqbX Qap5psRRHwqGDCzmM0gDHJiTbuxAe+mMpZtFrM3QI7sZaVw1yYMFTQ7HLpndLsP7SU1j H52NmUYk1R/LFOTezww1PcCGeoBoGJeOtWhUWgytCyEtn38pzlXfqshpBPdgwFJjnHLr Mtjr1yjbF4ODrcaZs3FZMT5NjJp/bRCa+8QUyFLRCb4Yw41akvqL4M6ijNXnl6Hbtc7A fNLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796332856; x=1796937656; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=98cFHDttXySM8av0xO4vY7TTIU+ZXN9GGMOoDmrffLU=; b=be+rDVLMQLMsh9hGq2bL7g/HE/44Ts0qDZJJldjPEHaf1b0rEW+j0Ym5Cuvah4Qos4 u2Cfc15FPNASxIl55/9UousRfixYX6F+IF4DUBGYP5sd9nKrCY5C2DiJyz/OMdWsBXJy Uio5KQcbmuVuliL3GHmFBxt3xnatYe5sasGyAwvR+vmPdKX2JOCKViVbVhBvkLni6DBn 79Sp+yWiQ2eyh18sPC5t7xbseIeCG5P4lQeLEjA142J83juHrkiO0zN2rmj+lcZtN0bv f0MQU6vTczFNRfiqzIahohpaCJp0hxSxLkpRzXGQ9ufkwqo/1PD8N5IBkaTjwiet6xpt 4HYQ== X-Forwarded-Encrypted: i=1; AL+hErH3joLiIOo4/apooP2Ei3SfaHzOlhcp8E2ZNoT/FDTGTFgKPM7nE/rxKqWu/vCwKYJoJV06uGqCEWs2I1c=@vger.kernel.org X-Gm-Message-State: APuU4Z+B4UqS0Se+12hguBeGaUfv6IXr08hG/e15ZWe1zUmQtIJfMJ+P Huc4/gppPVKiyRlvfDKsBZSE8v3HsWV7jPpXw5Lpd8tPf+twM60jzQQM X-Gm-Gg: AZFdTZfPe26ofp7KuTWed5dW8dGADr6GivZulQv5fe8zr0CFgXL8X6hpqs6MVhY6gJV /h5VWQ6NnYJRqEOwW6yngL0MSKycf8pm3uFS88kjrdUqb6bdWsRNVJKXSci05z1Ga/QeZj2Kv1U iLaESyuj1qZfIVcthgUd0nGwPi0qv1rug17+kuhL7RGeU7qKVeBwTIUHO7OF9qjarMxoIJJI1Kc x4AfTxiQztXsrqgr5CBa3wDw2SBjCfjFMoVfNYS5H+ilmFo2uIPe85m6T8JbmHSWA1yFo2C/oI/ eX+KHDE5bRjawbNZBmsfAao3tbgodGspH3lSx3dnEFP/EsKL37kVMrE57C8reSnFD9s7oj6a5Zf bpI7W6CLJ89pyXRufS+V+b8O+F2frMq7n+cfU8PwrSZIDcBCtIojd2iUG1VL+6s7z74ntgKEWWM coj8aWRhQ9Ig/i8rkK2iBwYUDHv0j9bF1KbC4wXSIGxyyiswefPtaj7ktmNzVJ8tPOHzrKznxau sdhzd/ia/BnaZ6Z27W1rczXrXO0bLerc20oJyNjPPt51I1OzC87Ed+jqX7A7S/1O506WAMuv91P tmXVpWphTSvs/E/MPTwhrXbUTMakzaDNxLcwNpW6BvVH05XnYIXIvb99EknFEW49Smp//TVjdiX LKG3yVTgRn6uYYwYv9Y/NwRK2GkpQyTRPWX1hAM2tlHtGe24V3G0lQSk= X-Received: by 2002:a05:6214:f05:b0:921:b8cb:b6b with SMTP id 6a1803df08f44-921b8cb0cf7mr228965306d6.51.1796332855756; Thu, 03 Dec 2026 13:20:55 -0800 (PST) Received: from FKXX2DL94F.bytedance.net ([71.18.96.12]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-921e05628bfsm4542286d6.13.2026.12.03.13.20.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 03 Dec 2026 13:20:55 -0800 (PST) From: Yifan Feng To: Konstantin Komarov Cc: Christian Brauner , ntfs3@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Yifan Feng Subject: [PATCH] fs/ntfs3: keep the current mount options on remount Date: Thu, 3 Dec 2026 13:20:49 -0800 Message-Id: <20261203212049.31360-1-evanfengff@gmail.com> X-Mailer: git-send-email 2.39.3 (Apple Git-146) X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ntfs_init_fs_context() fills every new context with the default options, and ntfs_fs_reconfigure() installs them as they are. So a remount that does not repeat uid=, gid=, umask= and the other options resets them, and files that the masks protected become readable by everyone: # mount -t ntfs3 -o umask=077 /dev/vda /mnt # findmnt -no OPTIONS /mnt rw,relatime,uid=0,gid=0,dmask=0077,fmask=0077,iocharset=utf8,prealloc,ads # mount -o remount,noatime /dev/vda /mnt # findmnt -no OPTIONS /mnt rw,noatime,uid=0,gid=0,iocharset=utf8,prealloc,ads With an iocharset other than the default, the same remount fails with EINVAL. mount(8) hides both when it is given the mount point only, because it then passes the current options again. The emergency remount (sysrq u) passes no options: it resets them as well, and with such an iocharset it triggers the "forced remount of a ntfs3 fs returned -22" warning in reconfigure_super(). For a remount, start from the options in use. The iocharset cannot be changed by a remount, so take over its name in ntfs_fs_reconfigure() when the remount does not give one. Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block") Signed-off-by: Yifan Feng --- Tested in QEMU (KASAN, lockdep) with mount(2), mount(8) from util-linux 2.38.1, fspick()/fsconfig() and sysrq u, and with 900 remounts during path lookups. Options without a "no" form (discard, nocase, ...) now stay set over a remount. Found and written with the help of an AI coding assistant. fs/ntfs3/super.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index 29aabdc8a801..2203703ebf1c 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -483,6 +483,11 @@ static int ntfs_fs_reconfigure(struct fs_context *fc) return -EINVAL; } + if (!new_opts->nls_name && sbi->options->nls_name) { + new_opts->nls_name = kstrdup(sbi->options->nls_name, GFP_KERNEL); + if (!new_opts->nls_name) + return -ENOMEM; + } new_opts->nls = ntfs_load_nls(new_opts->nls_name); if (IS_ERR(new_opts->nls)) { new_opts->nls = NULL; @@ -1957,8 +1962,14 @@ static int ntfs_init_fs_context(struct fs_context *fc) fc->sb_flags |= SB_POSIXACL; #endif - if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE) + if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE) { + rcu_read_lock(); + *opts = *READ_ONCE(ntfs_sb(fc->root->d_sb)->options); + rcu_read_unlock(); + opts->nls_name = NULL; + opts->nls = NULL; goto ok; + } sbi = kzalloc_obj(struct ntfs_sb_info, GFP_NOFS); if (!sbi) base-commit: d06ce6f1eb5eeffd4ebcfde345dc34a98131d106 -- 2.39.3 (Apple Git-146)