From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.219.42 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796332857; b=du8od8ZVr2Afdqu6XOq84evgFJ9nD0YIYPxcz/62SCqgfFuY0lM5x+SFwXbjllkmYW9f z8AhAoF/ESuaZo4qoNzDGoxAADjAqpxK5tVkh+ZNf2QYhd/nqOvq7Q3EO3/lxEh9cOq1S V/wKd5QZX93XNGoi5EkkqkJTxGw3HotUz5GlOTxgwF18Lz5E/bJXahMOt2rtqdI7r/Fdu fqzUUi4JnCKMgMR2xsj5qJZukDCUCJkJQ6KariCF/G6dqaxT25WMwAVBAwU+1RHcB4dOX WumsJPzKcjLcpKyDK/2ZNVE06evNro7G7ptVPWe2oj581M6uhWSdyF1TrsLvS8syPBQ== 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=HlHp/9/Eyg1LhwAeiqfqo2yKMT6RN/0HjPK9xSv0mdpdcsSgXPYd0Mmfoiu6pzAzKG1S SG3k7pEMr/s+sHTVsHOsfEVi6nhKc2WIvUHbw4Rm4SR96Nk0GDeLq+kP3eIyUPgNUVHJp DXI9y5ZYiPP/KYJKLsAmFOd63bShnFan3wq/H00Pi0xdJFpoD2DgslLqaAtlmpHwKs1TP l1X0LPw/vehJHQ25DDk6nA2QwUvGrtAiYKnZNZAijLk7CoiiQOgx6q/qtDyagk+1nB6AI 7vcx8GHHCj1Y0Bo9DKyVL9YHJRAByLW7pokPrBgO5YiiM/BksGP0Ncwec4Px+iRMEMQ== 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="b/i3Dm8r"; arc=none smtp.remote-ip=209.85.219.42 Received: from mail-qv1-f42.google.com (mail-qv1-f42.google.com [209.85.219.42]) (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 C6BB8606A334 for ; Thu, 3 Dec 2026 21:20:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C6BB8606A334 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=b/i3Dm8r Received: by mail-qv1-f42.google.com with SMTP id 6a1803df08f44-92110499585so3037886d6.0 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=lists.linux.dev; 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=b/i3Dm8rhmozFMlXQ5cFNcH7D4yJ/RlRl/TqmVfIZLkCwJ+gCs8DBuo0u6LtnGBZ+p CtZQ1yGQakDyUJJhsH8ut6g/IvVaGCEwkPoezvdni9C7MtulpCvUuolQydM6+sjdq3VT SpvKIYVm8e17KA+zRM8LhDBf4yo5xboccK6femB+tiYWZWuPJm/vfnnCO06zE8OIS5Y3 1M0abgm01EnMpc47NEQ4xXmv5+w+T+10cd6xSSJm1BL60LXt14jccJg7zLtHk4wnTd36 sLlBMPZ2/u2jbTeiRxWrrxNjv+P7JROTqMPVsfTub8xXmGSBnf32DBNCgdfBLW/BSzJ5 Eajw== 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=vseaiMLCTH4u2PLl8UFT42AmKJvtjQ/BBiG+qaXLg7UkBSNdcPnLv/44HZlAEPf2jD VyCe8AJ3dMOLpbZ+DMQwkLfpcZMI8dus6kMRgbGiKahn040YKVYWwhawymc0Zpad+e9z Ok1WSXodd8J+iD/dabHg0qU0F2NoohdCQXjzFpWG29O5dJQuPHIC5wjCwG6ZX7llgs// agkM4AOuAIhfdblVFd3AV42U0rN0In+jG209qRHCX52Cwg87d+ySfD4a1duUPDIHt5Wg kCelnj+pMZxVES2p0JPuGKbp17z36PeHaNqyqtPOG7o3P1r9q8Zqp9t1CKfKk2dEExc2 1THA== X-Forwarded-Encrypted: i=1; AL+hErFJW45SEfjC9stu//jWEEy57syDEdOQslUS8qf7ccsXns37Tya7VJlDLT8Yr/+s2MQQktDKsw==@lists.linux.dev X-Gm-Message-State: APuU4Z9LlVBW0/kF5xbKs+T9m6JDG4i1QU9UssOx+gIL3A9NFe1I7mCO RGYRM8g/Ux0e9qN2grUO/L2Bq9d/o2GLSqjfzGMYQFr6NtJnhg2AKldn X-Gm-Gg: AZFdTZcmgwaVMTgF4oHYA0x7jNmjQnWan7TPY5WGlPKGRE13zzBJ8TWzwCwtVToxlEB xHIdIpr/vIyTbU9kcq/pxokIN/GpMhIauXOuzr7Nljmd3QFdP0Hq3eCmwbOF97oFHmQDeUcXLhF k6Ahlfu9qms0d6kdAGKNT9BIsFCtHkWPstaweksWCdhO2mIpOipY4kbYJ8U/P8KHKGs4OOjAvDZ xSR6jGXZz4meCIJ90MJe91CFEpD2cvmJaS80e8EnUseuTHv8LVyvtcgj3Tc6diGhEupwFjktDT/ tj8DjjhVSS/8QPp7rxXJWKJTbi9Y4CL7PHi/xDv0eXAm2uMlKBgGNXVXmerIB31lJNTmGAhk3d3 xNzOWPBoTQW7EvKChtQfjqut7PZjr6raeMdU78mTZHOABomkTbaj1QKYV2fw9DX3G0utulYdWhm 1beCwdYRwxnGhTjB19EIuXSgmZmMtE2LnKJ1+5gBHuwisQdbW5FGb5pVwaNb9Ue7Py9bGBGyfiJ BTR32N6gRdkGAMQvyjiLVPIR5xXOMXG0VWLDxBtwGln7PkkF943lxoXadKpPiciO+QnryUZ14sZ XjO38pfjOZHBxAMHN41iWeWxsw6KEN+/2xuVQFwivirLk44Pha1h9ly+r46EMg0aVCbHEH1yaMO IsgchDQLug64Qwy7tTKe0kk68/abyyACnGd1jjeJT65FRJO+kl9nVm9E= 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: ntfs3@lists.linux.dev 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)