From patchwork Sun Aug 29 09:56:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kari Argillander X-Patchwork-Id: 12463833 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 3CEF7C432BE for ; Sun, 29 Aug 2021 09:56:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 12D7E60C41 for ; Sun, 29 Aug 2021 09:56:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235098AbhH2J5d (ORCPT ); Sun, 29 Aug 2021 05:57:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229990AbhH2J52 (ORCPT ); Sun, 29 Aug 2021 05:57:28 -0400 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93C72C061575; Sun, 29 Aug 2021 02:56:36 -0700 (PDT) Received: by mail-lj1-x231.google.com with SMTP id w4so20051502ljh.13; Sun, 29 Aug 2021 02:56:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=06IJ8wv8VYpmrLf54oJDv7/8FotCGMOf/f2pOdPg7sg=; b=bZmgDWQIcYClPh9dxk+5kt1yNkQ8p0mgD1TAtGtU0g7eDn8UKdZ+IKuoGmI8BiZYHD mrW6M5ZEInqAytHA0c6uKFU6c6shXXvDOaeuxNdHsfxBPHiYKLx+rfhFKi7sZvWxtEs1 d00A+utqmIlhzltXws86uhNTUEIcgiNQDS8YCFMtD2zV0ggNClMP+0pwhv5BjJY5ShFn OO0mGy41AvM7CMzgKECI6LW7bd7QuRc28CQ6ERowJHO/kJm9RjFX/jbYD5EDRRbI4UxC GIVCGVsmZvPPznqpTLJDRmY1Rjm8OnMqrUO26nNw1rkYU+KSUQYtutSHbjouXngvcUcY bBTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=06IJ8wv8VYpmrLf54oJDv7/8FotCGMOf/f2pOdPg7sg=; b=EfrqrBS12xuo1lIwvUVI5vE6gk/wW6W4yljJYpuLh8L1a4YtS/ofYKf0q6bowIYJMu S61cVczGMMVJTsEZvtnSk7lMBF+VhmkH1v+zHil2XRHJbrjVb/2p9RLVmkBuriNEU/xQ YfPc2xbvN6RR0TBjn4HRTxs5Rqtj1jEQpl6fajUS9BpmWpaYN6dss15E6YykC2X1WTyv cJrb5RJrSz46FiUHO+ooWYr5ISxkFtQGihzVkCdUEcjmzcT1en5QlPcpLqzYvTfiU/0+ 7vALxUY2j+Tf13f5UDHjq6HxD4+ZSiS2h9zSVX7AoFH9rkY9DVYpVbah4mXZN8BICnx3 miDQ== X-Gm-Message-State: AOAM533B6lT7CY6N9hbbedcgQsowuFlN93iLNoMONQ7GYrb0uSfZOk25 4WvsOh+1F1sCI8nNvIsd8/E= X-Google-Smtp-Source: ABdhPJybXuFCOlJmL+50BGFrqBEJAfgNz3geVl43CRaDiurUM3o/ebil5YGzAknhIdq/76WCd/AMXQ== X-Received: by 2002:a2e:858e:: with SMTP id b14mr15701090lji.508.1630230994928; Sun, 29 Aug 2021 02:56:34 -0700 (PDT) Received: from localhost.localdomain (37-33-245-172.bb.dnainternet.fi. [37.33.245.172]) by smtp.gmail.com with ESMTPSA id d6sm1090521lfi.57.2021.08.29.02.56.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Aug 2021 02:56:34 -0700 (PDT) From: Kari Argillander To: Konstantin Komarov , ntfs3@lists.linux.dev Cc: Kari Argillander , Christoph Hellwig , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, =?utf-8?q?Pali_Roh=C3=A1r?= , Matthew Wilcox , Christian Brauner Subject: [PATCH v3 1/9] fs/ntfs3: Remove unnecesarry mount option noatime Date: Sun, 29 Aug 2021 12:56:06 +0300 Message-Id: <20210829095614.50021-2-kari.argillander@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210829095614.50021-1-kari.argillander@gmail.com> References: <20210829095614.50021-1-kari.argillander@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Remove unnecesarry mount option noatime because this will be handled by VFS. Our option parser will never get opt like this. Acked-by: Christian Brauner Reviewed-by: Christoph Hellwig Signed-off-by: Kari Argillander --- Documentation/filesystems/ntfs3.rst | 4 ---- fs/ntfs3/super.c | 7 ------- 2 files changed, 11 deletions(-) diff --git a/Documentation/filesystems/ntfs3.rst b/Documentation/filesystems/ntfs3.rst index ffe9ea0c1499..af7158de6fde 100644 --- a/Documentation/filesystems/ntfs3.rst +++ b/Documentation/filesystems/ntfs3.rst @@ -85,10 +85,6 @@ acl Support POSIX ACLs (Access Control Lists). Effective if supported by Kernel. Not to be confused with NTFS ACLs. The option specified as acl enables support for POSIX ACLs. -noatime All files and directories will not update their last access - time attribute if a partition is mounted with this parameter. - This option can speed up file system operation. - =============================================================================== ToDo list diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index 17ee715ab539..267f123b0109 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -216,7 +216,6 @@ enum Opt { Opt_nohidden, Opt_showmeta, Opt_acl, - Opt_noatime, Opt_nls, Opt_prealloc, Opt_no_acs_rules, @@ -235,7 +234,6 @@ static const match_table_t ntfs_tokens = { { Opt_sparse, "sparse" }, { Opt_nohidden, "nohidden" }, { Opt_acl, "acl" }, - { Opt_noatime, "noatime" }, { Opt_showmeta, "showmeta" }, { Opt_nls, "nls=%s" }, { Opt_prealloc, "prealloc" }, @@ -326,9 +324,6 @@ static noinline int ntfs_parse_options(struct super_block *sb, char *options, ntfs_err(sb, "support for ACL not compiled in!"); return -EINVAL; #endif - case Opt_noatime: - sb->s_flags |= SB_NOATIME; - break; case Opt_showmeta: opts->showmeta = 1; break; @@ -575,8 +570,6 @@ static int ntfs_show_options(struct seq_file *m, struct dentry *root) seq_puts(m, ",prealloc"); if (sb->s_flags & SB_POSIXACL) seq_puts(m, ",acl"); - if (sb->s_flags & SB_NOATIME) - seq_puts(m, ",noatime"); return 0; } From patchwork Sun Aug 29 09:56:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kari Argillander X-Patchwork-Id: 12463835 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 B2F57C4320E for ; Sun, 29 Aug 2021 09:56:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8F09A60E94 for ; Sun, 29 Aug 2021 09:56:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235106AbhH2J5e (ORCPT ); Sun, 29 Aug 2021 05:57:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235082AbhH2J5b (ORCPT ); Sun, 29 Aug 2021 05:57:31 -0400 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 987F6C061575; Sun, 29 Aug 2021 02:56:39 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id m4so20067526ljq.8; Sun, 29 Aug 2021 02:56:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=w5JhVyRqtdJpuGBlvHxS0x0qfaPttBBsFZAiPeZDkRE=; b=qzYp3rH7/Jm8TDxr6yuA+GxjZA0ElQbz+XiSyKTodB3ODMiqYP6Z1EQ5n9KB2NIwTw 2SvuQ+RKW2jsUtPbsUtkyHU0F9IavDD2WE6BKHNy41tM6LxZcN5Ff6VVaM6EdfKdUEqQ SPE2ql5GgbpuGftmpq2DpuZWToI8bxY65K0LDETKTkgbRgOl9agQJpyH6Dvkj5rhIXQu yDP7ycj8oV9G65tXPhwIzU5P8AqWGWhhWzYM/rVW8ECRD9PNt7XAF+cFYS5nX+W9hDFR 9Q3OkArdxcj55YnD5JiYMD23jkuVL66GW1qazxsMyWMmOLig/yu52046SJZ1r2xyHdRW aWAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=w5JhVyRqtdJpuGBlvHxS0x0qfaPttBBsFZAiPeZDkRE=; b=hPtzx0/uHJYCd2T36mkHqjqCdBltYh+Y6pdYRl2zx8j3i2h7bsjo2Y2yB4BZaRZJ/H 8DqxIGNdPSwpJgXwBPZVtkre46w4VZxU9xd14zsbRKF83c12PM3rBjYmy8w2lUlDoLoF CMTusGbu73yDhlE7zwT/ZMgGraYTpT1uevxZWFw6ON69yteI/QcC8Xb5/nLothU0PLCx 5fT9jRIQdm3lk7YdFbcjE9t09Y08q1RE7p47XdK+Ifs4AaZ9N8iVi6r5kLb+vJwyH0Ea 1k3jY9/uNw0t/LZKuJUaVicR12yG4o/l/++LJ5xTk0sTs5BVDpY4fpIeusQ0694u3oeZ BgyQ== X-Gm-Message-State: AOAM531oT72dY0UWdeDa/XfdBGfOGiFPnVifsTsBsF+gCVEKxhuPZXcD 8L0GaCit4ObErQJFpnbHmIc= X-Google-Smtp-Source: ABdhPJzvp+0/k+8fJsE1oNkghP54+v3DnfTEMaNOWwPx7Ct3+qO6Agd5rJZIQr2pxzu+SOwtXi9dwQ== X-Received: by 2002:a2e:1514:: with SMTP id s20mr16140249ljd.34.1630230998034; Sun, 29 Aug 2021 02:56:38 -0700 (PDT) Received: from localhost.localdomain (37-33-245-172.bb.dnainternet.fi. [37.33.245.172]) by smtp.gmail.com with ESMTPSA id d6sm1090521lfi.57.2021.08.29.02.56.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Aug 2021 02:56:37 -0700 (PDT) From: Kari Argillander To: Konstantin Komarov , ntfs3@lists.linux.dev Cc: Kari Argillander , Christoph Hellwig , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, =?utf-8?q?Pali_Roh=C3=A1r?= , Matthew Wilcox , Christian Brauner Subject: [PATCH v3 2/9] fs/ntfs3: Remove unnecesarry remount flag handling Date: Sun, 29 Aug 2021 12:56:07 +0300 Message-Id: <20210829095614.50021-3-kari.argillander@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210829095614.50021-1-kari.argillander@gmail.com> References: <20210829095614.50021-1-kari.argillander@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Remove unnecesarry remount flag handling. This does not do anything for this driver. We have already set SB_NODIRATIME when we fill super. Also noatime should be set from mount option. Now for some reson we try to set it when remounting. Lazytime part looks like it is copied from f2fs and there is own mount parameter for it. That is why they use it. We do not set lazytime anywhere in our code. So basically this just blocks lazytime when remounting. Acked-by: Christian Brauner Reviewed-by: Christoph Hellwig Signed-off-by: Kari Argillander --- fs/ntfs3/super.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index 267f123b0109..c590872070e1 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -407,8 +407,6 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *data) clear_mount_options(&old_opts); - *flags = (*flags & ~SB_LAZYTIME) | (sb->s_flags & SB_LAZYTIME) | - SB_NODIRATIME | SB_NOATIME; ntfs_info(sb, "re-mounted. Opts: %s", orig_data); err = 0; goto out; From patchwork Sun Aug 29 09:56:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kari Argillander X-Patchwork-Id: 12463837 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 48870C432BE for ; Sun, 29 Aug 2021 09:56:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2D2CE601FF for ; Sun, 29 Aug 2021 09:56:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235127AbhH2J5l (ORCPT ); Sun, 29 Aug 2021 05:57:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235120AbhH2J5j (ORCPT ); Sun, 29 Aug 2021 05:57:39 -0400 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F069C061575; Sun, 29 Aug 2021 02:56:47 -0700 (PDT) Received: by mail-lj1-x234.google.com with SMTP id q21so20080300ljj.6; Sun, 29 Aug 2021 02:56:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yGJsVJCtygRnwAdMzY3g4q7mtw/NpAyS2tWSm+JvFXE=; b=ZKCQw3e1tx2c8lqwTzvpO4L1S19M2yqb+pj5tupaQy1BdU6no4P09sAH4oIpM1gm1C fRurWtWyTzAGay/clu/wRjYnLGxdAfK6os/EUeB/HqCrRdWD1r+dBGsd0NJP8VsGk78Z VbrwbI36SpK2UwP3vYNEPswT6QgZGm9o6Iz0UHCm+P4KjkXEfjYt1A0mqqmIx7uVnvhG lM80wP+NOYXLa7kZEvqK0GQlulUGFjKAkrVWbAKh2h7axU+Mq62ALE3nbU58C7sdaavs Xad3Pz6JpAby6ubS1marcvZNiKGMzz2bV/fWuwunzJ0786Wy5qpW8wfZ7v90L/0HLyTz fjzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yGJsVJCtygRnwAdMzY3g4q7mtw/NpAyS2tWSm+JvFXE=; b=ChwOkKZbU3BNrD83lAf0/oQ9h6zUpijQGmb0JvUPB+lCGka/57L1P0WCcYWDLbT4/B RjrBQd/h6DLM1xGXZ3OSsIX+Es43rm5961PQHw2fjMFdO5gvXS2m7FXsl+/oC8lw1ger Z9+h+ur052AyHCqiXfP8MBf9LzPmx1s/CioV/gHOMVnSUAehBIeKcP+em6YntCPx2JUK tpi2DlzbUlFsl86co5RwW6B9v9pq78/87ycqmhzIFKiIIE/GWrPZzknH9hGixpFUZe/D EeT79PMLnSLO4hmjRnVtS0ZJJu1a6rVGc/H0UOSzd8hAyKwbF1/vHrpbFQyGftkc0AQ5 f84Q== X-Gm-Message-State: AOAM530mNfITfCqdRNS681dpD+ttEC+/zZIfN3SuX4Sdgj5+w684f6iX triCD8NfTweixlELQv44T+s= X-Google-Smtp-Source: ABdhPJyxBstZpMp/ULOi8WX/itF9vtZYwDzJvRGIhaHHsY+fKsZEsxDtiQAOYJ6LI6YoFq2etmJBdA== X-Received: by 2002:a2e:9e1a:: with SMTP id e26mr16082111ljk.265.1630231005720; Sun, 29 Aug 2021 02:56:45 -0700 (PDT) Received: from localhost.localdomain (37-33-245-172.bb.dnainternet.fi. [37.33.245.172]) by smtp.gmail.com with ESMTPSA id d6sm1090521lfi.57.2021.08.29.02.56.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Aug 2021 02:56:45 -0700 (PDT) From: Kari Argillander To: Konstantin Komarov , ntfs3@lists.linux.dev Cc: Kari Argillander , Christoph Hellwig , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, =?utf-8?q?Pali_Roh=C3=A1r?= , Matthew Wilcox , Christian Brauner Subject: [PATCH v3 3/9] fs/ntfs3: Convert mount options to pointer in sbi Date: Sun, 29 Aug 2021 12:56:08 +0300 Message-Id: <20210829095614.50021-4-kari.argillander@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210829095614.50021-1-kari.argillander@gmail.com> References: <20210829095614.50021-1-kari.argillander@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Use pointer to mount options. We want to do this because we will use new mount api which will benefit that we have spi and mount options in different allocations. When we remount we do not have to make whole new spi it is enough that we will allocate just mount options. Please note that we can do example remount lot cleaner but things will change in next patch so this should be just functional. Signed-off-by: Kari Argillander --- fs/ntfs3/attrib.c | 2 +- fs/ntfs3/dir.c | 8 ++++---- fs/ntfs3/file.c | 4 ++-- fs/ntfs3/inode.c | 12 ++++++------ fs/ntfs3/ntfs_fs.h | 2 +- fs/ntfs3/super.c | 31 +++++++++++++++++++------------ fs/ntfs3/xattr.c | 2 +- 7 files changed, 34 insertions(+), 27 deletions(-) diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c index 4eae9886e27d..7eb366a1b7c7 100644 --- a/fs/ntfs3/attrib.c +++ b/fs/ntfs3/attrib.c @@ -538,7 +538,7 @@ int attr_set_size(struct ntfs_inode *ni, enum ATTR_TYPE type, } else if (pre_alloc == -1) { pre_alloc = 0; if (type == ATTR_DATA && !name_len && - sbi->options.prealloc) { + sbi->options->prealloc) { CLST new_alen2 = bytes_to_cluster( sbi, get_pre_allocated(new_size)); pre_alloc = new_alen2 - new_alen; diff --git a/fs/ntfs3/dir.c b/fs/ntfs3/dir.c index d36d7fbc2b1d..e41e5a259be7 100644 --- a/fs/ntfs3/dir.c +++ b/fs/ntfs3/dir.c @@ -25,7 +25,7 @@ int ntfs_utf16_to_nls(struct ntfs_sb_info *sbi, const struct le_str *uni, int ret, uni_len, warn; const __le16 *ip; u8 *op; - struct nls_table *nls = sbi->options.nls; + struct nls_table *nls = sbi->options->nls; static_assert(sizeof(wchar_t) == sizeof(__le16)); @@ -183,7 +183,7 @@ int ntfs_nls_to_utf16(struct ntfs_sb_info *sbi, const u8 *name, u32 name_len, { int ret, slen; const u8 *end; - struct nls_table *nls = sbi->options.nls; + struct nls_table *nls = sbi->options->nls; u16 *uname = uni->name; static_assert(sizeof(wchar_t) == sizeof(u16)); @@ -296,10 +296,10 @@ static inline int ntfs_filldir(struct ntfs_sb_info *sbi, struct ntfs_inode *ni, return 0; /* Skip meta files ( unless option to show metafiles is set ) */ - if (!sbi->options.showmeta && ntfs_is_meta_file(sbi, ino)) + if (!sbi->options->showmeta && ntfs_is_meta_file(sbi, ino)) return 0; - if (sbi->options.nohidden && (fname->dup.fa & FILE_ATTRIBUTE_HIDDEN)) + if (sbi->options->nohidden && (fname->dup.fa & FILE_ATTRIBUTE_HIDDEN)) return 0; name_len = ntfs_utf16_to_nls(sbi, (struct le_str *)&fname->name_len, diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c index a959f6197c99..c79e4aff7a19 100644 --- a/fs/ntfs3/file.c +++ b/fs/ntfs3/file.c @@ -743,7 +743,7 @@ int ntfs3_setattr(struct user_namespace *mnt_userns, struct dentry *dentry, umode_t mode = inode->i_mode; int err; - if (sbi->options.no_acs_rules) { + if (sbi->options->no_acs_rules) { /* "no access rules" - force any changes of time etc. */ attr->ia_valid |= ATTR_FORCE; /* and disable for editing some attributes */ @@ -1189,7 +1189,7 @@ static int ntfs_file_release(struct inode *inode, struct file *file) int err = 0; /* if we are the last writer on the inode, drop the block reservation */ - if (sbi->options.prealloc && ((file->f_mode & FMODE_WRITE) && + if (sbi->options->prealloc && ((file->f_mode & FMODE_WRITE) && atomic_read(&inode->i_writecount) == 1)) { ni_lock(ni); down_write(&ni->file.run_lock); diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index 520471f35e29..b28dd111e6cf 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -51,8 +51,8 @@ static struct inode *ntfs_read_mft(struct inode *inode, inode->i_op = NULL; /* Setup 'uid' and 'gid' */ - inode->i_uid = sbi->options.fs_uid; - inode->i_gid = sbi->options.fs_gid; + inode->i_uid = sbi->options->fs_uid; + inode->i_gid = sbi->options->fs_gid; err = mi_init(&ni->mi, sbi, ino); if (err) @@ -231,7 +231,7 @@ static struct inode *ntfs_read_mft(struct inode *inode, t32 = le16_to_cpu(attr->nres.run_off); } - mode = S_IFREG | (0777 & sbi->options.fs_fmask_inv); + mode = S_IFREG | (0777 & sbi->options->fs_fmask_inv); if (!attr->non_res) { ni->ni_flags |= NI_FLAG_RESIDENT; @@ -274,7 +274,7 @@ static struct inode *ntfs_read_mft(struct inode *inode, goto out; mode = sb->s_root - ? (S_IFDIR | (0777 & sbi->options.fs_dmask_inv)) + ? (S_IFDIR | (0777 & sbi->options->fs_dmask_inv)) : (S_IFDIR | 0777); goto next_attr; @@ -439,7 +439,7 @@ static struct inode *ntfs_read_mft(struct inode *inode, goto out; } - if ((sbi->options.sys_immutable && + if ((sbi->options->sys_immutable && (std5->fa & FILE_ATTRIBUTE_SYSTEM)) && !S_ISFIFO(mode) && !S_ISSOCK(mode) && !S_ISLNK(mode)) { inode->i_flags |= S_IMMUTABLE; @@ -1228,7 +1228,7 @@ struct inode *ntfs_create_inode(struct user_namespace *mnt_userns, * } */ } else if (S_ISREG(mode)) { - if (sbi->options.sparse) { + if (sbi->options->sparse) { /* sparsed regular file, cause option 'sparse' */ fa = FILE_ATTRIBUTE_SPARSE_FILE | FILE_ATTRIBUTE_ARCHIVE; diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h index e3a667e9838f..43b177280f39 100644 --- a/fs/ntfs3/ntfs_fs.h +++ b/fs/ntfs3/ntfs_fs.h @@ -279,7 +279,7 @@ struct ntfs_sb_info { #endif } compress; - struct ntfs_mount_options options; + struct ntfs_mount_options *options; struct ratelimit_state msg_ratelimit; }; diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index c590872070e1..e9dfe274b558 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -379,11 +379,11 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *data) return -ENOMEM; /* Store original options */ - memcpy(&old_opts, &sbi->options, sizeof(old_opts)); - clear_mount_options(&sbi->options); - memset(&sbi->options, 0, sizeof(sbi->options)); + memcpy(&old_opts, sbi->options, sizeof(old_opts)); + clear_mount_options(sbi->options); + memset(sbi->options, 0, sizeof(old_opts)); - err = ntfs_parse_options(sb, data, 0, &sbi->options); + err = ntfs_parse_options(sb, data, 0, sbi->options); if (err) goto restore_opts; @@ -399,7 +399,7 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *data) sync_filesystem(sb); if (ro_rw && (sbi->volume.flags & VOLUME_FLAG_DIRTY) && - !sbi->options.force) { + !sbi->options->force) { ntfs_warn(sb, "volume is dirty and \"force\" flag is not set!"); err = -EINVAL; goto restore_opts; @@ -412,8 +412,8 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *data) goto out; restore_opts: - clear_mount_options(&sbi->options); - memcpy(&sbi->options, &old_opts, sizeof(old_opts)); + clear_mount_options(sbi->options); + memcpy(sbi->options, &old_opts, sizeof(old_opts)); out: kfree(orig_data); @@ -494,7 +494,8 @@ static noinline void put_ntfs(struct ntfs_sb_info *sbi) xpress_free_decompressor(sbi->compress.xpress); lzx_free_decompressor(sbi->compress.lzx); #endif - clear_mount_options(&sbi->options); + clear_mount_options(sbi->options); + kfree(sbi->options); kfree(sbi); } @@ -533,7 +534,7 @@ static int ntfs_show_options(struct seq_file *m, struct dentry *root) { struct super_block *sb = root->d_sb; struct ntfs_sb_info *sbi = sb->s_fs_info; - struct ntfs_mount_options *opts = &sbi->options; + struct ntfs_mount_options *opts = sbi->options; struct user_namespace *user_ns = seq_user_ns(m); if (opts->uid) @@ -910,6 +911,12 @@ static int ntfs_fill_super(struct super_block *sb, void *data, int silent) if (!sbi) return -ENOMEM; + sbi->options = kzalloc(sizeof(struct ntfs_mount_options), GFP_NOFS); + if (!sbi->options) { + kfree(sbi); + return -ENOMEM; + } + sb->s_fs_info = sbi; sbi->sb = sb; sb->s_flags |= SB_NODIRATIME; @@ -922,7 +929,7 @@ static int ntfs_fill_super(struct super_block *sb, void *data, int silent) ratelimit_state_init(&sbi->msg_ratelimit, DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST); - err = ntfs_parse_options(sb, data, silent, &sbi->options); + err = ntfs_parse_options(sb, data, silent, sbi->options); if (err) goto out; @@ -1054,7 +1061,7 @@ static int ntfs_fill_super(struct super_block *sb, void *data, int silent) goto out; } } else if (sbi->volume.flags & VOLUME_FLAG_DIRTY) { - if (!is_ro && !sbi->options.force) { + if (!is_ro && !sbi->options->force) { ntfs_warn( sb, "volume is dirty and \"force\" flag is not set!"); @@ -1376,7 +1383,7 @@ int ntfs_discard(struct ntfs_sb_info *sbi, CLST lcn, CLST len) if (sbi->flags & NTFS_FLAGS_NODISCARD) return -EOPNOTSUPP; - if (!sbi->options.discard) + if (!sbi->options->discard) return -EOPNOTSUPP; lbo = (u64)lcn << sbi->cluster_bits; diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c index d3d5b9d331d1..a17d48735b99 100644 --- a/fs/ntfs3/xattr.c +++ b/fs/ntfs3/xattr.c @@ -774,7 +774,7 @@ int ntfs_acl_chmod(struct user_namespace *mnt_userns, struct inode *inode) int ntfs_permission(struct user_namespace *mnt_userns, struct inode *inode, int mask) { - if (ntfs_sb(inode->i_sb)->options.no_acs_rules) { + if (ntfs_sb(inode->i_sb)->options->no_acs_rules) { /* "no access rules" mode - allow all changes */ return 0; } From patchwork Sun Aug 29 09:56:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kari Argillander X-Patchwork-Id: 12463839 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 C52F5C43214 for ; Sun, 29 Aug 2021 09:56:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B0E2B60F45 for ; Sun, 29 Aug 2021 09:56:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235139AbhH2J5n (ORCPT ); Sun, 29 Aug 2021 05:57:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235120AbhH2J5m (ORCPT ); Sun, 29 Aug 2021 05:57:42 -0400 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44259C061575; Sun, 29 Aug 2021 02:56:50 -0700 (PDT) Received: by mail-lj1-x22c.google.com with SMTP id s12so20216815ljg.0; Sun, 29 Aug 2021 02:56:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vdHTY/IMUrMCAKQbEKX6eMWE1VQbU+5gBAU9bs7v5xo=; b=F2C3LgJz5fo5L3+hkO/WCCXVR2u2mUG3QXVnSsjNB23e6+PLTzabb2JGMye22HKEsX KmokhEJozm4gjXIdNzPHNJLFcMWclakVH1cNTM5BXdxlaE/6gVBkyffcrUtZp1gTqBaO 3FBUJnYH7yxl4GLZpR5eSWupUk/8dz8D6yhE+rFDjELuOnvfEo7XmgKXPHIIZnnecqRu qJSxTtueh8lYym6XH7Da9z1d5z10Ji18x1RwXsVDvINAMtzrLFkA9SIZlBt8LxkxivPA L55ofL2sPtxIhXwMBKf5teIRlllUrfxGNeIgX13N9Q+CMQgFmsHZ21yJXua9+dtplLSv hTiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vdHTY/IMUrMCAKQbEKX6eMWE1VQbU+5gBAU9bs7v5xo=; b=MC8dQAiJnrBoPgw0Oyz8Gy8pvr9yiiZvCygTu/7hbiEY1Q5IthmSe9tmJnRl8YjUyS GRVIp9/CB1tY5pv865w4abbv5TlAxgQVunjJ9Hnow4a93VEb1wHbVl2JpcNOm9Rz4f75 WFqWiDNTBMxYHUQHgBEHrY3fYwGouny0N/90ji6SpstXfoCxSttZTg3ojLLBCyNfoAz6 Z7cklOTxbw2Nyw095JaFxqvCz8Pq98hOGr+V6xUpigXODAARqgFwTjfnmA1gheoP7JLi WeqbQ5rihAHMhdikxHusnnd9uZv8dTaRWbK2/H2lXIgGhO7JNnofasnvL86il2hQd2tk 7erg== X-Gm-Message-State: AOAM532sHqY0n9FVvLiu/wIeti8Vfvh+0oe9ff+VxHVZMedKhLeuS5mC Xm+ZfIR1pZVUiZPGaWaYC8s= X-Google-Smtp-Source: ABdhPJyIft6JvND9JDRhwRugF6nxmvLSVt0rGR27PTpUrNWPZDYrT1R0vV2uaIBX/Y8ldEdbYs8k2w== X-Received: by 2002:a2e:3914:: with SMTP id g20mr15652340lja.88.1630231008525; Sun, 29 Aug 2021 02:56:48 -0700 (PDT) Received: from localhost.localdomain (37-33-245-172.bb.dnainternet.fi. [37.33.245.172]) by smtp.gmail.com with ESMTPSA id d6sm1090521lfi.57.2021.08.29.02.56.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Aug 2021 02:56:48 -0700 (PDT) From: Kari Argillander To: Konstantin Komarov , ntfs3@lists.linux.dev Cc: Kari Argillander , Christoph Hellwig , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, =?utf-8?q?Pali_Roh=C3=A1r?= , Matthew Wilcox , Christian Brauner Subject: [PATCH v3 4/9] fs/ntfs3: Use new api for mounting Date: Sun, 29 Aug 2021 12:56:09 +0300 Message-Id: <20210829095614.50021-5-kari.argillander@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210829095614.50021-1-kari.argillander@gmail.com> References: <20210829095614.50021-1-kari.argillander@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org We have now new mount api as described in Documentation/filesystems. We should use it as it gives us some benefits which are desribed here lore.kernel.org/linux-fsdevel/159646178122.1784947.11705396571718464082.stgit@warthog.procyon.org.uk/ Nls loading is changed a to load with string. This did make code also little cleaner. Also try to use fsparam_flag_no as much as possible. This is just nice little touch and is not mandatory but it should not make any harm. It is just convenient that we can use example acl/noacl mount options. Signed-off-by: Kari Argillander --- fs/ntfs3/ntfs_fs.h | 1 + fs/ntfs3/super.c | 426 ++++++++++++++++++++++++--------------------- 2 files changed, 225 insertions(+), 202 deletions(-) diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h index 43b177280f39..45d6f4f91222 100644 --- a/fs/ntfs3/ntfs_fs.h +++ b/fs/ntfs3/ntfs_fs.h @@ -52,6 +52,7 @@ // clang-format on struct ntfs_mount_options { + char *nls_name; struct nls_table *nls; kuid_t fs_uid; diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index e9dfe274b558..99102a146cf5 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -28,11 +28,12 @@ #include #include #include +#include +#include #include #include #include #include -#include #include #include @@ -198,9 +199,11 @@ void *ntfs_put_shared(void *ptr) return ret; } -static inline void clear_mount_options(struct ntfs_mount_options *options) +static inline void put_mount_options(struct ntfs_mount_options *options) { + kfree(options->nls_name); unload_nls(options->nls); + kfree(options); } enum Opt { @@ -222,202 +225,171 @@ enum Opt { Opt_err, }; -static const match_table_t ntfs_tokens = { - { Opt_uid, "uid=%u" }, - { Opt_gid, "gid=%u" }, - { Opt_umask, "umask=%o" }, - { Opt_dmask, "dmask=%o" }, - { Opt_fmask, "fmask=%o" }, - { Opt_immutable, "sys_immutable" }, - { Opt_discard, "discard" }, - { Opt_force, "force" }, - { Opt_sparse, "sparse" }, - { Opt_nohidden, "nohidden" }, - { Opt_acl, "acl" }, - { Opt_showmeta, "showmeta" }, - { Opt_nls, "nls=%s" }, - { Opt_prealloc, "prealloc" }, - { Opt_no_acs_rules, "no_acs_rules" }, - { Opt_err, NULL }, +static const struct fs_parameter_spec ntfs_fs_parameters[] = { + fsparam_u32("uid", Opt_uid), + fsparam_u32("gid", Opt_gid), + fsparam_u32oct("umask", Opt_umask), + fsparam_u32oct("dmask", Opt_dmask), + fsparam_u32oct("fmask", Opt_fmask), + fsparam_flag_no("sys_immutable", Opt_immutable), + fsparam_flag_no("discard", Opt_discard), + fsparam_flag_no("force", Opt_force), + fsparam_flag_no("sparse", Opt_sparse), + fsparam_flag("nohidden", Opt_nohidden), + fsparam_flag_no("acl", Opt_acl), + fsparam_flag_no("showmeta", Opt_showmeta), + fsparam_string("nls", Opt_nls), + fsparam_flag_no("prealloc", Opt_prealloc), + fsparam_flag("no_acs_rules", Opt_no_acs_rules), + {} }; -static noinline int ntfs_parse_options(struct super_block *sb, char *options, - int silent, - struct ntfs_mount_options *opts) +/* + * Load nls table or if @nls is utf8 then return NULL. + */ +static struct nls_table *ntfs_load_nls(char *nls) { - char *p; - substring_t args[MAX_OPT_ARGS]; - int option; - char nls_name[30]; - struct nls_table *nls; + struct nls_table *ret; - opts->fs_uid = current_uid(); - opts->fs_gid = current_gid(); - opts->fs_fmask_inv = opts->fs_dmask_inv = ~current_umask(); - nls_name[0] = 0; + if (!nls) + nls = CONFIG_NLS_DEFAULT; - if (!options) - goto out; + if (strcmp(nls, "utf8") == 0) + return NULL; - while ((p = strsep(&options, ","))) { - int token; + if (strcmp(nls, CONFIG_NLS_DEFAULT) == 0) + return load_nls_default(); - if (!*p) - continue; + ret = load_nls(nls); + if (ret) + return ret; - token = match_token(p, ntfs_tokens, args); - switch (token) { - case Opt_immutable: - opts->sys_immutable = 1; - break; - case Opt_uid: - if (match_int(&args[0], &option)) - return -EINVAL; - opts->fs_uid = make_kuid(current_user_ns(), option); - if (!uid_valid(opts->fs_uid)) - return -EINVAL; - opts->uid = 1; - break; - case Opt_gid: - if (match_int(&args[0], &option)) - return -EINVAL; - opts->fs_gid = make_kgid(current_user_ns(), option); - if (!gid_valid(opts->fs_gid)) - return -EINVAL; - opts->gid = 1; - break; - case Opt_umask: - if (match_octal(&args[0], &option)) - return -EINVAL; - opts->fs_fmask_inv = opts->fs_dmask_inv = ~option; - opts->fmask = opts->dmask = 1; - break; - case Opt_dmask: - if (match_octal(&args[0], &option)) - return -EINVAL; - opts->fs_dmask_inv = ~option; - opts->dmask = 1; - break; - case Opt_fmask: - if (match_octal(&args[0], &option)) - return -EINVAL; - opts->fs_fmask_inv = ~option; - opts->fmask = 1; - break; - case Opt_discard: - opts->discard = 1; - break; - case Opt_force: - opts->force = 1; - break; - case Opt_sparse: - opts->sparse = 1; - break; - case Opt_nohidden: - opts->nohidden = 1; - break; - case Opt_acl: + return ERR_PTR(-EINVAL); +} + +static int ntfs_fs_parse_param(struct fs_context *fc, + struct fs_parameter *param) +{ + struct ntfs_mount_options *opts = fc->fs_private; + struct fs_parse_result result; + int opt; + + opt = fs_parse(fc, ntfs_fs_parameters, param, &result); + if (opt < 0) + return opt; + + switch (opt) { + case Opt_uid: + opts->fs_uid = make_kuid(current_user_ns(), result.uint_32); + if (!uid_valid(opts->fs_uid)) + return invalf(fc, "ntfs3: Invalid value for uid."); + opts->uid = 1; + break; + case Opt_gid: + opts->fs_gid = make_kgid(current_user_ns(), result.uint_32); + if (!gid_valid(opts->fs_gid)) + return invalf(fc, "ntfs3: Invalid value for gid."); + opts->gid = 1; + break; + case Opt_umask: + if (result.uint_32 & ~07777) + return invalf(fc, "ntfs3: Invalid value for umask."); + opts->fs_fmask_inv = ~result.uint_32; + opts->fs_dmask_inv = ~result.uint_32; + opts->fmask = 1; + opts->dmask = 1; + break; + case Opt_dmask: + if (result.uint_32 & ~07777) + return invalf(fc, "ntfs3: Invalid value for dmask."); + opts->fs_dmask_inv = ~result.uint_32; + opts->dmask = 1; + break; + case Opt_fmask: + if (result.uint_32 & ~07777) + return invalf(fc, "ntfs3: Invalid value for fmask."); + opts->fs_fmask_inv = ~result.uint_32; + opts->fmask = 1; + break; + case Opt_immutable: + opts->sys_immutable = result.negated ? 0 : 1; + break; + case Opt_discard: + opts->discard = result.negated ? 0 : 1; + break; + case Opt_force: + opts->force = result.negated ? 0 : 1; + break; + case Opt_sparse: + opts->sparse = result.negated ? 0 : 1; + break; + case Opt_nohidden: + opts->nohidden = 1; + break; + case Opt_acl: + if (!result.negated) #ifdef CONFIG_NTFS3_FS_POSIX_ACL - sb->s_flags |= SB_POSIXACL; - break; + fc->sb_flags |= SB_POSIXACL; #else - ntfs_err(sb, "support for ACL not compiled in!"); - return -EINVAL; + return invalf(fc, "ntfs3: Support for ACL not compiled in!"); #endif - case Opt_showmeta: - opts->showmeta = 1; - break; - case Opt_nls: - match_strlcpy(nls_name, &args[0], sizeof(nls_name)); - break; - case Opt_prealloc: - opts->prealloc = 1; - break; - case Opt_no_acs_rules: - opts->no_acs_rules = 1; - break; - default: - if (!silent) - ntfs_err( - sb, - "Unrecognized mount option \"%s\" or missing value", - p); - //return -EINVAL; - } - } - -out: - if (!strcmp(nls_name[0] ? nls_name : CONFIG_NLS_DEFAULT, "utf8")) { - /* For UTF-8 use utf16s_to_utf8s/utf8s_to_utf16s instead of nls */ - nls = NULL; - } else if (nls_name[0]) { - nls = load_nls(nls_name); - if (!nls) { - ntfs_err(sb, "failed to load \"%s\"", nls_name); - return -EINVAL; - } - } else { - nls = load_nls_default(); - if (!nls) { - ntfs_err(sb, "failed to load default nls"); - return -EINVAL; - } + else + fc->sb_flags &= ~SB_POSIXACL; + break; + case Opt_showmeta: + opts->showmeta = result.negated ? 0 : 1; + break; + case Opt_nls: + kfree(opts->nls_name); + opts->nls_name = param->string; + param->string = NULL; + break; + case Opt_prealloc: + opts->prealloc = result.negated ? 0 : 1; + break; + case Opt_no_acs_rules: + opts->no_acs_rules = 1; + break; + default: + /* Should not be here unless we forget add case. */ + return -EINVAL; } - opts->nls = nls; - return 0; } -static int ntfs_remount(struct super_block *sb, int *flags, char *data) +static int ntfs_fs_reconfigure(struct fs_context *fc) { - int err, ro_rw; + struct super_block *sb = fc->root->d_sb; struct ntfs_sb_info *sbi = sb->s_fs_info; - struct ntfs_mount_options old_opts; - char *orig_data = kstrdup(data, GFP_KERNEL); - - if (data && !orig_data) - return -ENOMEM; - - /* Store original options */ - memcpy(&old_opts, sbi->options, sizeof(old_opts)); - clear_mount_options(sbi->options); - memset(sbi->options, 0, sizeof(old_opts)); + struct ntfs_mount_options *new_opts = fc->fs_private; + int ro_rw; - err = ntfs_parse_options(sb, data, 0, sbi->options); - if (err) - goto restore_opts; - - ro_rw = sb_rdonly(sb) && !(*flags & SB_RDONLY); + ro_rw = sb_rdonly(sb) && !(fc->sb_flags & SB_RDONLY); if (ro_rw && (sbi->flags & NTFS_FLAGS_NEED_REPLAY)) { - ntfs_warn( - sb, - "Couldn't remount rw because journal is not replayed. Please umount/remount instead\n"); - err = -EINVAL; - goto restore_opts; + errorf(fc, "ntfs3: Couldn't remount rw because journal is not replayed. Please umount/remount instead\n"); + return -EINVAL; + } + + new_opts->nls = ntfs_load_nls(new_opts->nls_name); + if (IS_ERR(new_opts->nls)) { + new_opts->nls = NULL; + errorf(fc, "ntfs3: Cannot load nls %s", new_opts->nls_name); + return -EINVAL; } + if (new_opts->nls != sbi->options->nls) + return invalf(fc, "ntfs3: Cannot use different nls when remounting!"); sync_filesystem(sb); if (ro_rw && (sbi->volume.flags & VOLUME_FLAG_DIRTY) && - !sbi->options->force) { - ntfs_warn(sb, "volume is dirty and \"force\" flag is not set!"); - err = -EINVAL; - goto restore_opts; + !new_opts->force) { + errorf(fc, "ntfs3: Volume is dirty and \"force\" flag is not set!"); + return -EINVAL; } - clear_mount_options(&old_opts); - - ntfs_info(sb, "re-mounted. Opts: %s", orig_data); - err = 0; - goto out; - -restore_opts: - clear_mount_options(sbi->options); - memcpy(sbi->options, &old_opts, sizeof(old_opts)); + memcpy(sbi->options, new_opts, sizeof(*new_opts)); -out: - kfree(orig_data); - return err; + return 0; } static struct kmem_cache *ntfs_inode_cachep; @@ -494,9 +466,6 @@ static noinline void put_ntfs(struct ntfs_sb_info *sbi) xpress_free_decompressor(sbi->compress.xpress); lzx_free_decompressor(sbi->compress.lzx); #endif - clear_mount_options(sbi->options); - kfree(sbi->options); - kfree(sbi); } @@ -507,7 +476,9 @@ static void ntfs_put_super(struct super_block *sb) /*mark rw ntfs as clear, if possible*/ ntfs_set_state(sbi, NTFS_DIRTY_CLEAR); + put_mount_options(sbi->options); put_ntfs(sbi); + sb->s_fs_info = NULL; sync_blockdev(sb->s_bdev); } @@ -621,7 +592,6 @@ static const struct super_operations ntfs_sops = { .statfs = ntfs_statfs, .show_options = ntfs_show_options, .sync_fs = ntfs_sync_fs, - .remount_fs = ntfs_remount, .write_inode = ntfs3_write_inode, }; @@ -885,10 +855,10 @@ static int ntfs_init_from_boot(struct super_block *sb, u32 sector_size, } /* try to mount*/ -static int ntfs_fill_super(struct super_block *sb, void *data, int silent) +static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc) { int err; - struct ntfs_sb_info *sbi; + struct ntfs_sb_info *sbi = sb->s_fs_info; struct block_device *bdev = sb->s_bdev; struct inode *bd_inode = bdev->bd_inode; struct request_queue *rq = bdev_get_queue(bdev); @@ -907,17 +877,6 @@ static int ntfs_fill_super(struct super_block *sb, void *data, int silent) ref.high = 0; - sbi = kzalloc(sizeof(struct ntfs_sb_info), GFP_NOFS); - if (!sbi) - return -ENOMEM; - - sbi->options = kzalloc(sizeof(struct ntfs_mount_options), GFP_NOFS); - if (!sbi->options) { - kfree(sbi); - return -ENOMEM; - } - - sb->s_fs_info = sbi; sbi->sb = sb; sb->s_flags |= SB_NODIRATIME; sb->s_magic = 0x7366746e; // "ntfs" @@ -929,9 +888,12 @@ static int ntfs_fill_super(struct super_block *sb, void *data, int silent) ratelimit_state_init(&sbi->msg_ratelimit, DEFAULT_RATELIMIT_INTERVAL, DEFAULT_RATELIMIT_BURST); - err = ntfs_parse_options(sb, data, silent, sbi->options); - if (err) - goto out; + sbi->options->nls = ntfs_load_nls(sbi->options->nls_name); + if (IS_ERR(sbi->options->nls)) { + sbi->options->nls = NULL; + errorf(fc, "Cannot load nls %s", sbi->options->nls_name); + return -EINVAL; + } if (!rq || !blk_queue_discard(rq) || !rq->limits.discard_granularity) { ; @@ -1324,6 +1286,9 @@ static int ntfs_fill_super(struct super_block *sb, void *data, int silent) goto out; } + fc->fs_private = NULL; + fc->s_fs_info = NULL; + return 0; out: @@ -1334,9 +1299,6 @@ static int ntfs_fill_super(struct super_block *sb, void *data, int silent) sb->s_root = NULL; } - put_ntfs(sbi); - - sb->s_fs_info = NULL; return err; } @@ -1408,19 +1370,79 @@ int ntfs_discard(struct ntfs_sb_info *sbi, CLST lcn, CLST len) return err; } -static struct dentry *ntfs_mount(struct file_system_type *fs_type, int flags, - const char *dev_name, void *data) +static int ntfs_fs_get_tree(struct fs_context *fc) +{ + return get_tree_bdev(fc, ntfs_fill_super); +} + +/* + * Note that this will be called after fill_super and reconfigure + * even when they pass. So they have to take pointers if they pass. + */ +static void ntfs_fs_free(struct fs_context *fc) { - return mount_bdev(fs_type, flags, dev_name, data, ntfs_fill_super); + struct ntfs_mount_options *opts = fc->fs_private; + struct ntfs_sb_info *sbi = fc->s_fs_info; + + if (sbi) + put_ntfs(sbi); + + if (opts) + put_mount_options(opts); +} + +static const struct fs_context_operations ntfs_context_ops = { + .parse_param = ntfs_fs_parse_param, + .get_tree = ntfs_fs_get_tree, + .reconfigure = ntfs_fs_reconfigure, + .free = ntfs_fs_free, +}; + +/* + * This will called when mount/remount. We will first initiliaze + * options so that if remount we can use just that. + */ +static int ntfs_init_fs_context(struct fs_context *fc) +{ + struct ntfs_mount_options *opts; + struct ntfs_sb_info *sbi; + + opts = kzalloc(sizeof(struct ntfs_mount_options), GFP_NOFS); + if (!opts) + return -ENOMEM; + + /* Default options. */ + opts->fs_uid = current_uid(); + opts->fs_gid = current_gid(); + opts->fs_fmask_inv = ~current_umask(); + opts->fs_dmask_inv = ~current_umask(); + + if (fc->purpose == FS_CONTEXT_FOR_RECONFIGURE) + goto ok; + + sbi = kzalloc(sizeof(struct ntfs_sb_info), GFP_NOFS); + if (!sbi) { + kfree(opts); + return -ENOMEM; + } + + sbi->options = opts; + fc->s_fs_info = sbi; +ok: + fc->fs_private = opts; + fc->ops = &ntfs_context_ops; + + return 0; } // clang-format off static struct file_system_type ntfs_fs_type = { - .owner = THIS_MODULE, - .name = "ntfs3", - .mount = ntfs_mount, - .kill_sb = kill_block_super, - .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP, + .owner = THIS_MODULE, + .name = "ntfs3", + .init_fs_context = ntfs_init_fs_context, + .parameters = ntfs_fs_parameters, + .kill_sb = kill_block_super, + .fs_flags = FS_REQUIRES_DEV | FS_ALLOW_IDMAP, }; // clang-format on From patchwork Sun Aug 29 09:56:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kari Argillander X-Patchwork-Id: 12463841 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 29A5CC4320A for ; Sun, 29 Aug 2021 09:56:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 110AF60F45 for ; Sun, 29 Aug 2021 09:56:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235159AbhH2J5r (ORCPT ); Sun, 29 Aug 2021 05:57:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235143AbhH2J5o (ORCPT ); Sun, 29 Aug 2021 05:57:44 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41EE8C061756; Sun, 29 Aug 2021 02:56:52 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id k5so24611461lfu.4; Sun, 29 Aug 2021 02:56:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=v3egmclPp6Wx1/0tawWJ+PILwmaso1iDcpgDHnZfUHs=; b=BDGEEtVed7NONusJZRJVpHxLj7oDNbgLuwQd6K6oa8GlLEkaC3/TZdxnd25z8eXsEQ bqXnF0mb9zNnMkL1TcmikekU70b0nLu2etltRVyh6j/O5d2qFB9epT2APsunY6fRlrSy FweebPe/eHMe8Or398yW4JX9RoSnzoZoRxq3L1B+5U5MbjtZDEYKdSG1v7Dqw/SX39rF L9ZSU05Jl6xWInM/nEmMNdysh7a8g8mMqxGIfVBi4uKpPOpPzoSts+WGgTgZRWi37FsF AKCukGuhBVmSFN8cVjn6jIihHRNVpr3SiYhJfbVTyVsHNkkxXvAxnA5L/BTboNxlR8wk ZX/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=v3egmclPp6Wx1/0tawWJ+PILwmaso1iDcpgDHnZfUHs=; b=rvddSqFgxf8iNdJidBIHwBb8OGXV3byeBbsgkWTEVnoCZUoTxYL6mTvMGuU7HMrc2H LeKMjRO3jTHyEOZAj7HtVcMCdpA2HG2OXAXkPoQkmV8D7zrK5Yr3C4J+Ywyaowlsc1Un wzch+2VOuIMyfyOtkGEelppjyKzBQN9X8HYf9Z9wnEvExlrL8cT3TFS0Zf/3S9/Gg1UZ QN0DRs+jkCcp6QKFSvS6mWE8wgRAM3hUs1EyUE+6wfcjSLCw0CAqUTchC0orO0/0M2D/ 3/DFXeTW6jWAb6z8AAdzJlgBklTSSqrk5RJTJ2cdc6MqGfKEujlzvzowkFNrTpy0hiNG LVnQ== X-Gm-Message-State: AOAM530VAx7u9x+xUyF2V5YMjqiUspq0yQEGKojlLp9G/5nC+6ku4jIE PaVJC9YICK3TGWjniJpLT1A= X-Google-Smtp-Source: ABdhPJz2qfjqW8rdnNGzA4UGKKEppM5B4O4oRkU43Z12Y+bss2f8O8bAZo0YQ0ZnJIHjMOr0xWQx1g== X-Received: by 2002:a05:6512:ac7:: with SMTP id n7mr5086161lfu.469.1630231010634; Sun, 29 Aug 2021 02:56:50 -0700 (PDT) Received: from localhost.localdomain (37-33-245-172.bb.dnainternet.fi. [37.33.245.172]) by smtp.gmail.com with ESMTPSA id d6sm1090521lfi.57.2021.08.29.02.56.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Aug 2021 02:56:50 -0700 (PDT) From: Kari Argillander To: Konstantin Komarov , ntfs3@lists.linux.dev Cc: Kari Argillander , Christoph Hellwig , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, =?utf-8?q?Pali_Roh=C3=A1r?= , Matthew Wilcox , Christian Brauner Subject: [PATCH v3 5/9] fs/ntfs3: Init spi more in init_fs_context than fill_super Date: Sun, 29 Aug 2021 12:56:10 +0300 Message-Id: <20210829095614.50021-6-kari.argillander@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210829095614.50021-1-kari.argillander@gmail.com> References: <20210829095614.50021-1-kari.argillander@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org init_fs_context() is meant to initialize s_fs_info (spi). Move spi initializing code there which we can initialize before fill_super(). Signed-off-by: Kari Argillander --- fs/ntfs3/super.c | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index 99102a146cf5..b2a3f947542b 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -870,7 +870,7 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc) const struct VOLUME_INFO *info; u32 idx, done, bytes; struct ATTR_DEF_ENTRY *t; - u16 *upcase = NULL; + u16 *upcase; u16 *shared; bool is_ro; struct MFT_REF ref; @@ -885,9 +885,6 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc) sb->s_time_gran = NTFS_TIME_GRAN; // 100 nsec sb->s_xattr = ntfs_xattr_handlers; - ratelimit_state_init(&sbi->msg_ratelimit, DEFAULT_RATELIMIT_INTERVAL, - DEFAULT_RATELIMIT_BURST); - sbi->options->nls = ntfs_load_nls(sbi->options->nls_name); if (IS_ERR(sbi->options->nls)) { sbi->options->nls = NULL; @@ -917,12 +914,6 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc) sb->s_maxbytes = 0xFFFFFFFFull << sbi->cluster_bits; #endif - mutex_init(&sbi->compress.mtx_lznt); -#ifdef CONFIG_NTFS3_LZX_XPRESS - mutex_init(&sbi->compress.mtx_xpress); - mutex_init(&sbi->compress.mtx_lzx); -#endif - /* * Load $Volume. This should be done before LogFile * 'cause 'sbi->volume.ni' is used 'ntfs_set_state' @@ -1207,11 +1198,7 @@ static int ntfs_fill_super(struct super_block *sb, struct fs_context *fc) goto out; } - sbi->upcase = upcase = kvmalloc(0x10000 * sizeof(short), GFP_KERNEL); - if (!upcase) { - err = -ENOMEM; - goto out; - } + upcase = sbi->upcase; for (idx = 0; idx < (0x10000 * sizeof(short) >> PAGE_SHIFT); idx++) { const __le16 *src; @@ -1421,10 +1408,21 @@ static int ntfs_init_fs_context(struct fs_context *fc) goto ok; sbi = kzalloc(sizeof(struct ntfs_sb_info), GFP_NOFS); - if (!sbi) { - kfree(opts); - return -ENOMEM; - } + if (!sbi) + goto free_opts; + + sbi->upcase = kvmalloc(0x10000 * sizeof(short), GFP_KERNEL); + if (!sbi->upcase) + goto free_sbi; + + ratelimit_state_init(&sbi->msg_ratelimit, DEFAULT_RATELIMIT_INTERVAL, + DEFAULT_RATELIMIT_BURST); + + mutex_init(&sbi->compress.mtx_lznt); +#ifdef CONFIG_NTFS3_LZX_XPRESS + mutex_init(&sbi->compress.mtx_xpress); + mutex_init(&sbi->compress.mtx_lzx); +#endif sbi->options = opts; fc->s_fs_info = sbi; @@ -1433,6 +1431,11 @@ static int ntfs_init_fs_context(struct fs_context *fc) fc->ops = &ntfs_context_ops; return 0; +free_opts: + kfree(opts); +free_sbi: + kfree(sbi); + return -ENOMEM; } // clang-format off From patchwork Sun Aug 29 09:56:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kari Argillander X-Patchwork-Id: 12463843 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 3E684C43214 for ; Sun, 29 Aug 2021 09:56:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 28D4060E76 for ; Sun, 29 Aug 2021 09:56:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235171AbhH2J5s (ORCPT ); Sun, 29 Aug 2021 05:57:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235161AbhH2J5q (ORCPT ); Sun, 29 Aug 2021 05:57:46 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49A7DC06175F; Sun, 29 Aug 2021 02:56:54 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id bq28so24556114lfb.7; Sun, 29 Aug 2021 02:56:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=C8shmGTwIVEplPrN8NQt30baMk6rR4iI2vVWk35WOzg=; b=kwM5zKbAKM118C6fwyVLCkuxwNqazJSWfgelC8iWcm5DOoOTCfwB4ALMe7jnTTqjCY pvfCx7bpEsKbdJAFQYr77IAgYMP0icCCm/R09q8qvoj4w/8fnm2/+sy9AoDdsOk7SUB4 mPfqgIUaZxFR7hRHs33D70oodAhk8EOcPW9CsAUi2xCn5MWXjf8El5KuGZcH6PT5kI5n sJgjQg+7jZY/DYKikxGHzec9rXLsYHDHx3UngE6K1d8/31JYTGX5wys4/4O0e8hX1Zrp 2OQBRBu8kYqFiGrZwTfXGzh10/PlYp3+3Sm/wsEhrYVXB0JDNZ1uK8Z5HjAf7O5Q1+ng ZEEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=C8shmGTwIVEplPrN8NQt30baMk6rR4iI2vVWk35WOzg=; b=JlPmOjnHHIBHuUDwwAXtUFHebuD/8J8n1di1InJQQ2Lx09uHIOM83lBx+7k2BHq7n6 tVeqCQN+rtmyQA2B9shY6aUYZ7OxH4kgb7IRZwqP4Y91rdW5YRmV0g2Lfmwi+4PdIGH8 2zJzdbeOF17Bs+h/Nrl6bnO0es+UjrjofS2nq8UsQIXYUkWOZsF7C28Q5pPESv39acrO YTxKyP6DePRTmpzRc+XtfZxs3pCKUoJNIU6gFxdzUv30Z3CFGLGZpmR5kD0++nrPqGWe 2UKKmwHU7dR1js1DCqzicDVkntJxoeAOsyCkAL8t5+EGOV7VMYlK+DcCvuODUtQ5j7+m Moiw== X-Gm-Message-State: AOAM532IrcFIULqiJGBZp2QVC/AxxmnU476GII3wqvMh2Fj8BQ3BcIq0 1QLXwQ801raAv5/+/ZFQG9HYNW4lVDQ5eQ== X-Google-Smtp-Source: ABdhPJxO1OWQY8ATYb0DXxWiYYRIbHkiVdjUF/hA38qAOzv8owmWNGv3D4LPDdKA2eUIEdA/9L0B5Q== X-Received: by 2002:a05:6512:1153:: with SMTP id m19mr6734923lfg.268.1630231012587; Sun, 29 Aug 2021 02:56:52 -0700 (PDT) Received: from localhost.localdomain (37-33-245-172.bb.dnainternet.fi. [37.33.245.172]) by smtp.gmail.com with ESMTPSA id d6sm1090521lfi.57.2021.08.29.02.56.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Aug 2021 02:56:52 -0700 (PDT) From: Kari Argillander To: Konstantin Komarov , ntfs3@lists.linux.dev Cc: Kari Argillander , Christoph Hellwig , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, =?utf-8?q?Pali_Roh=C3=A1r?= , Matthew Wilcox , Christian Brauner Subject: [PATCH v3 6/9] fs/ntfs3: Make mount option nohidden more universal Date: Sun, 29 Aug 2021 12:56:11 +0300 Message-Id: <20210829095614.50021-7-kari.argillander@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210829095614.50021-1-kari.argillander@gmail.com> References: <20210829095614.50021-1-kari.argillander@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org If we call Opt_nohidden with just keyword hidden, then we can use hidden/nohidden when mounting. We already use this method for almoust all other parameters so it is just logical that this will use same method. Acked-by: Christian Brauner Reviewed-by: Christoph Hellwig Signed-off-by: Kari Argillander --- fs/ntfs3/super.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index b2a3f947542b..52e0dc45e060 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -235,7 +235,7 @@ static const struct fs_parameter_spec ntfs_fs_parameters[] = { fsparam_flag_no("discard", Opt_discard), fsparam_flag_no("force", Opt_force), fsparam_flag_no("sparse", Opt_sparse), - fsparam_flag("nohidden", Opt_nohidden), + fsparam_flag_no("hidden", Opt_nohidden), fsparam_flag_no("acl", Opt_acl), fsparam_flag_no("showmeta", Opt_showmeta), fsparam_string("nls", Opt_nls), @@ -324,7 +324,7 @@ static int ntfs_fs_parse_param(struct fs_context *fc, opts->sparse = result.negated ? 0 : 1; break; case Opt_nohidden: - opts->nohidden = 1; + opts->nohidden = result.negated ? 1 : 0; break; case Opt_acl: if (!result.negated) From patchwork Sun Aug 29 09:56:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kari Argillander X-Patchwork-Id: 12463845 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 CEAFFC432BE for ; Sun, 29 Aug 2021 09:57:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AF9A3601FF for ; Sun, 29 Aug 2021 09:57:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235181AbhH2J5x (ORCPT ); Sun, 29 Aug 2021 05:57:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235175AbhH2J5s (ORCPT ); Sun, 29 Aug 2021 05:57:48 -0400 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [IPv6:2a00:1450:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27B06C061756; Sun, 29 Aug 2021 02:56:56 -0700 (PDT) Received: by mail-lj1-x234.google.com with SMTP id w4so20052300ljh.13; Sun, 29 Aug 2021 02:56:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OQd2rP5z5neQZUgk+5RzW3oFnwLepeMEfmyuxIVBcHw=; b=lwXV7aagUV2AlWNCICOKtqOGMZvaI4gN0UPgc7ujv/8pF2dmy9+CAX6EHRwZjSs1ak ZOkto5zpFZFo7QeJZTG1q16sMPmUNKmGdkdY7zouCYFn1LQKbmEfTrcLFhCRq9T24kUh t4KMUZzmlp9Z9b4Poos7KpJmI0dn1MhPGiYyoTaSLAnrKNSsdle5gadx04zSokEyABb+ k7oOJ6cvhjPaD3LfhWsga3Cw4ECTBsQYDHqcN/qK7vsSzXa4TfD4PITlewOC6MBDU4OO OZOlglo/kmWu6NOmvM9KLJEBo+CvBeXRvO+r1HNseYTzuxVmERiqo1ZNyuoj1byzJ+DL vwrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OQd2rP5z5neQZUgk+5RzW3oFnwLepeMEfmyuxIVBcHw=; b=ssL6R2t1o1BITXNWEF46PeTfiLX3TrNhBnFFd6XbLuYED8pV6U10yKHnC5IhCIQB5c rDwghKIaJrAPAGhPBBuKFwWeZywuo/k5nEhmLpecBecLNgHbWkpwyjDZjq++xQ+EXjUT E1Q3sfQ/36pKv0SxI5sxq2VAuOOMvDyOPYDJmDabjA3YjRTZf7rHl/3scYG+RdKv31sr VymtQjAKdiM7mj4H6ZqSfSDkYjO4WGE7SYic1X5Iu2qNWYY/HIpnKxJGfJ2AQU3moRVf jAeGO0kJCWY/FHADfs86t6+WO1d+ENy6YZMA3aQg5vp4Ldz0WVvYpgp2jBCujn1LLOwE Z3tQ== X-Gm-Message-State: AOAM531uN8E9FqNnuNLFmV3NB5pe5zKoNNKGueG5C+e1MVxraqOfCGVj ORluy+/ruYpvj+MU5MoWMFg= X-Google-Smtp-Source: ABdhPJzUAdVzKmx1iDF4WfSe2NFUFUd1UHkrVACgSYPcG/QBd9F4FrK8xl8iqmJNfSTBUO3Oo6XgFw== X-Received: by 2002:a05:651c:1126:: with SMTP id e6mr15733463ljo.28.1630231014546; Sun, 29 Aug 2021 02:56:54 -0700 (PDT) Received: from localhost.localdomain (37-33-245-172.bb.dnainternet.fi. [37.33.245.172]) by smtp.gmail.com with ESMTPSA id d6sm1090521lfi.57.2021.08.29.02.56.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Aug 2021 02:56:54 -0700 (PDT) From: Kari Argillander To: Konstantin Komarov , ntfs3@lists.linux.dev Cc: Kari Argillander , Christoph Hellwig , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, =?utf-8?q?Pali_Roh=C3=A1r?= , Matthew Wilcox , Christian Brauner Subject: [PATCH v3 7/9] fs/ntfs3: Add iocharset= mount option as alias for nls= Date: Sun, 29 Aug 2021 12:56:12 +0300 Message-Id: <20210829095614.50021-8-kari.argillander@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210829095614.50021-1-kari.argillander@gmail.com> References: <20210829095614.50021-1-kari.argillander@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Other fs drivers are using iocharset= mount option for specifying charset. So add it also for ntfs3 and mark old nls= mount option as deprecated. Signed-off-by: Kari Argillander --- Documentation/filesystems/ntfs3.rst | 4 ++-- fs/ntfs3/super.c | 18 +++++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Documentation/filesystems/ntfs3.rst b/Documentation/filesystems/ntfs3.rst index af7158de6fde..ded706474825 100644 --- a/Documentation/filesystems/ntfs3.rst +++ b/Documentation/filesystems/ntfs3.rst @@ -32,12 +32,12 @@ generic ones. =============================================================================== -nls=name This option informs the driver how to interpret path +iocharset=name This option informs the driver how to interpret path strings and translate them to Unicode and back. If this option is not set, the default codepage will be used (CONFIG_NLS_DEFAULT). Examples: - 'nls=utf8' + 'iocharset=utf8' uid= gid= diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index 52e0dc45e060..e5c319604c4d 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -219,7 +219,7 @@ enum Opt { Opt_nohidden, Opt_showmeta, Opt_acl, - Opt_nls, + Opt_iocharset, Opt_prealloc, Opt_no_acs_rules, Opt_err, @@ -238,9 +238,13 @@ static const struct fs_parameter_spec ntfs_fs_parameters[] = { fsparam_flag_no("hidden", Opt_nohidden), fsparam_flag_no("acl", Opt_acl), fsparam_flag_no("showmeta", Opt_showmeta), - fsparam_string("nls", Opt_nls), fsparam_flag_no("prealloc", Opt_prealloc), fsparam_flag("no_acs_rules", Opt_no_acs_rules), + fsparam_string("iocharset", Opt_iocharset), + + __fsparam(fs_param_is_string, + "nls", Opt_iocharset, + fs_param_deprecated, NULL), {} }; @@ -339,7 +343,7 @@ static int ntfs_fs_parse_param(struct fs_context *fc, case Opt_showmeta: opts->showmeta = result.negated ? 0 : 1; break; - case Opt_nls: + case Opt_iocharset: kfree(opts->nls_name); opts->nls_name = param->string; param->string = NULL; @@ -373,11 +377,11 @@ static int ntfs_fs_reconfigure(struct fs_context *fc) new_opts->nls = ntfs_load_nls(new_opts->nls_name); if (IS_ERR(new_opts->nls)) { new_opts->nls = NULL; - errorf(fc, "ntfs3: Cannot load nls %s", new_opts->nls_name); + errorf(fc, "ntfs3: Cannot load iocharset %s", new_opts->nls_name); return -EINVAL; } if (new_opts->nls != sbi->options->nls) - return invalf(fc, "ntfs3: Cannot use different nls when remounting!"); + return invalf(fc, "ntfs3: Cannot use different iocharset when remounting!"); sync_filesystem(sb); @@ -519,9 +523,9 @@ static int ntfs_show_options(struct seq_file *m, struct dentry *root) if (opts->dmask) seq_printf(m, ",dmask=%04o", ~opts->fs_dmask_inv); if (opts->nls) - seq_printf(m, ",nls=%s", opts->nls->charset); + seq_printf(m, ",iocharset=%s", opts->nls->charset); else - seq_puts(m, ",nls=utf8"); + seq_puts(m, ",iocharset=utf8"); if (opts->sys_immutable) seq_puts(m, ",sys_immutable"); if (opts->discard) From patchwork Sun Aug 29 09:56:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kari Argillander X-Patchwork-Id: 12463849 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 AAF17C4320A for ; Sun, 29 Aug 2021 09:57:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 93F3260E76 for ; Sun, 29 Aug 2021 09:57:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235195AbhH2J5y (ORCPT ); Sun, 29 Aug 2021 05:57:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235177AbhH2J5u (ORCPT ); Sun, 29 Aug 2021 05:57:50 -0400 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC8B0C06175F; Sun, 29 Aug 2021 02:56:57 -0700 (PDT) Received: by mail-lj1-x229.google.com with SMTP id s3so20098297ljp.11; Sun, 29 Aug 2021 02:56:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=d0dAQLkYIlRiJK9IfureASYoNzBsPTMv+O08xyy3NXM=; b=nGOSyCLQIFlWIQ/Lc/mTiZ92PGZp+bmcaZZrQrxA5y5ObxD4l06ZoPBKJ7dD2clMjw iNJeBoahyaTfrXiBd3m6Y62rVnP1BDL+Ay52y3GWDfN5NDYno0bzPo2DLiM//4ITHsae ZTuGfyEkOrA5UjzpNcgi2/doDujxH6FNvZuMkonGwJvqTnlapCjEPYuZc7ZiL9FnYtmh 0vNlxrzqGaxpc2My9csZ/leU0MCy4o43UonG/M9RLzy4V6FzjBL4Ity5Rp0gcAexSaJ9 gsBZkLdm+RIH9O4zxM/voVE6C6hfEVX7cUJ1ZDBc2OwWEQHgJhVddg7bAQSIuL5/C5Cp hDLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=d0dAQLkYIlRiJK9IfureASYoNzBsPTMv+O08xyy3NXM=; b=ZkGl6OO6aVnTXmp16gbZ8ANObMeOm15hDMAKizV/Yt8CtieCaJZe+JOHCgGUocSll9 rpQZihu/0qlQPu30Gk4XkAMlXiaGyyV/q8tq2NDTgUrh8ZZVluXsqL5dqiR96XCYJLqv m8c4/cLi2mtcCEvjpw7Irlt/H/S9FZaaaPZaIfSK3f7BlP5cZlVkusD1Re1YBquZ9L34 pXYVG4rZ6ccfOF2D7BTr72NQ8Vr8hVAqu3Pe0/+ZXTLxtmirJvDiHA47wf2wb8yvatK3 ri8MCX35XV6XBt9XIcXxYcuXYeog8FxvEoFSWPe4OibPvj0LafZZq+UOD0VjrhNgNDWR lYoA== X-Gm-Message-State: AOAM532UTrOEz8rihG/cJbk3WjcYkvSvelJPjTIOdJpIO3FoRIFST7xG 8Ka4H0/MCeOSyhr8UCGmRwA= X-Google-Smtp-Source: ABdhPJyAqy1EFURVwVmMWuDazMXwGx/Mut8Do0gXgICIvI9X8r9bCzixcBEaLtH7W9BJ62DWUM4Q6w== X-Received: by 2002:a05:651c:1af:: with SMTP id c15mr15377950ljn.194.1630231016161; Sun, 29 Aug 2021 02:56:56 -0700 (PDT) Received: from localhost.localdomain (37-33-245-172.bb.dnainternet.fi. [37.33.245.172]) by smtp.gmail.com with ESMTPSA id d6sm1090521lfi.57.2021.08.29.02.56.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Aug 2021 02:56:55 -0700 (PDT) From: Kari Argillander To: Konstantin Komarov , ntfs3@lists.linux.dev Cc: Kari Argillander , Christoph Hellwig , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, =?utf-8?q?Pali_Roh=C3=A1r?= , Matthew Wilcox , Christian Brauner Subject: [PATCH v3 8/9] fs/ntfs3: Rename mount option no_acl_rules > (no)acl_rules Date: Sun, 29 Aug 2021 12:56:13 +0300 Message-Id: <20210829095614.50021-9-kari.argillander@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210829095614.50021-1-kari.argillander@gmail.com> References: <20210829095614.50021-1-kari.argillander@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Rename mount option no_acl_rules to noacl_rules. This allow us to use possibility to mount with options noacl_rules or acl_rules. Acked-by: Christian Brauner Reviewed-by: Christoph Hellwig Signed-off-by: Kari Argillander --- Documentation/filesystems/ntfs3.rst | 2 +- fs/ntfs3/file.c | 2 +- fs/ntfs3/ntfs_fs.h | 2 +- fs/ntfs3/super.c | 12 ++++++------ fs/ntfs3/xattr.c | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Documentation/filesystems/ntfs3.rst b/Documentation/filesystems/ntfs3.rst index ded706474825..bdc9dd5a9185 100644 --- a/Documentation/filesystems/ntfs3.rst +++ b/Documentation/filesystems/ntfs3.rst @@ -73,7 +73,7 @@ prealloc Preallocate space for files excessively when file size is increasing on writes. Decreases fragmentation in case of parallel write operations to different files. -no_acs_rules "No access rules" mount option sets access rights for +noacs_rules "No access rules" mount option sets access rights for files/folders to 777 and owner/group to root. This mount option absorbs all other permissions: - permissions change for files/folders will be reported diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c index c79e4aff7a19..4c9ff7fcf0b1 100644 --- a/fs/ntfs3/file.c +++ b/fs/ntfs3/file.c @@ -743,7 +743,7 @@ int ntfs3_setattr(struct user_namespace *mnt_userns, struct dentry *dentry, umode_t mode = inode->i_mode; int err; - if (sbi->options->no_acs_rules) { + if (sbi->options->noacs_rules) { /* "no access rules" - force any changes of time etc. */ attr->ia_valid |= ATTR_FORCE; /* and disable for editing some attributes */ diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h index 45d6f4f91222..5df55bc733bd 100644 --- a/fs/ntfs3/ntfs_fs.h +++ b/fs/ntfs3/ntfs_fs.h @@ -70,7 +70,7 @@ struct ntfs_mount_options { showmeta : 1, /*show meta files*/ nohidden : 1, /*do not show hidden files*/ force : 1, /*rw mount dirty volume*/ - no_acs_rules : 1, /*exclude acs rules*/ + noacs_rules : 1, /*exclude acs rules*/ prealloc : 1 /*preallocate space when file is growing*/ ; }; diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index e5c319604c4d..d7408b4f6813 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -221,7 +221,7 @@ enum Opt { Opt_acl, Opt_iocharset, Opt_prealloc, - Opt_no_acs_rules, + Opt_noacs_rules, Opt_err, }; @@ -239,7 +239,7 @@ static const struct fs_parameter_spec ntfs_fs_parameters[] = { fsparam_flag_no("acl", Opt_acl), fsparam_flag_no("showmeta", Opt_showmeta), fsparam_flag_no("prealloc", Opt_prealloc), - fsparam_flag("no_acs_rules", Opt_no_acs_rules), + fsparam_flag_no("acs_rules", Opt_noacs_rules), fsparam_string("iocharset", Opt_iocharset), __fsparam(fs_param_is_string, @@ -351,8 +351,8 @@ static int ntfs_fs_parse_param(struct fs_context *fc, case Opt_prealloc: opts->prealloc = result.negated ? 0 : 1; break; - case Opt_no_acs_rules: - opts->no_acs_rules = 1; + case Opt_noacs_rules: + opts->noacs_rules = result.negated ? 1 : 0; break; default: /* Should not be here unless we forget add case. */ @@ -538,8 +538,8 @@ static int ntfs_show_options(struct seq_file *m, struct dentry *root) seq_puts(m, ",nohidden"); if (opts->force) seq_puts(m, ",force"); - if (opts->no_acs_rules) - seq_puts(m, ",no_acs_rules"); + if (opts->noacs_rules) + seq_puts(m, ",noacs_rules"); if (opts->prealloc) seq_puts(m, ",prealloc"); if (sb->s_flags & SB_POSIXACL) diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c index a17d48735b99..4b37ed239579 100644 --- a/fs/ntfs3/xattr.c +++ b/fs/ntfs3/xattr.c @@ -774,7 +774,7 @@ int ntfs_acl_chmod(struct user_namespace *mnt_userns, struct inode *inode) int ntfs_permission(struct user_namespace *mnt_userns, struct inode *inode, int mask) { - if (ntfs_sb(inode->i_sb)->options->no_acs_rules) { + if (ntfs_sb(inode->i_sb)->options->noacs_rules) { /* "no access rules" mode - allow all changes */ return 0; } From patchwork Sun Aug 29 09:56:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kari Argillander X-Patchwork-Id: 12463847 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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 7D702C4320E for ; Sun, 29 Aug 2021 09:57:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6448E60FBF for ; Sun, 29 Aug 2021 09:57:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235206AbhH2J5z (ORCPT ); Sun, 29 Aug 2021 05:57:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235143AbhH2J5w (ORCPT ); Sun, 29 Aug 2021 05:57:52 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88087C06179A; Sun, 29 Aug 2021 02:56:59 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id b4so24507491lfo.13; Sun, 29 Aug 2021 02:56:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JGO9p+zPOp044oimW3cPMiovpARyFCGNR8oIPi8AZPU=; b=iBRgBpa916zJw8hbi24LiAh9/Hu8m47Nx6o4pD2LlpkIF9aQ20gMPj9aGBwVKFWA6s TOypUug1FWRmfJ+zy6F66Q2NzhA5r4uTzogjczATXBXb1StrEgnfQ57khKTPSxpUeDXP LyF5CjDBBny0MI+fgdJEiy9d0vHPizWW0MKDV6m4n6n1vEGmRPKoXPJcczx+LTGGdMHK w3hFynuvjM3XItFYn7AGGMno261glDZa1aYy0mTObKKSPNogvtEsb55uinMf78ncFRHZ Fl3IruujPZGbrg6QHSeUYJWDGwRlYPKVeXpZMwBOcBlfKsJCcofh49+E0WWS66iVC+eE bSgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JGO9p+zPOp044oimW3cPMiovpARyFCGNR8oIPi8AZPU=; b=ca9uGdyJBzM0ycy3ni36PoPGNtIhTohgvRor1xh7NS7JWyZ3ghmUH1/8fP0ugsAdJQ JlbB4PKop7zzk8C2IMt/UgIF5B/hc8TtvHEamTwJGkMmwGD/Fb0nOoehcDFMgyBDrSiY AgSTKsDmqIfEiTsbPOcseWyjc9m9JPRYcvZToMgZf94BUvikcPOWmnVoap5dCsFkVduH LHZ4O1ICKatxCTY072r9tT8GEC6aV5TgKvOYW0HPGU0IKXSxFJkAnrZAWvJd6WHbOjz3 ZAlpVipQ0sVPYQLsJd6qDd1oPKEhqK8sCNdwypi0w+aJ4T2axT5t75rnurH9P4DzgSg7 walQ== X-Gm-Message-State: AOAM531Iz/AmnU0bekdVWyXTTYGcuV7+nb1+igVaJzCBXGGvJr85fS3C lPEWmp4xgzVc0Hlh72UYrlY= X-Google-Smtp-Source: ABdhPJxOSCcWhZDxEOrrYu3IkI+msRTPX1/R7tSg5QfgUJ47bXKNWWftop/khiWZU5RKKIBZQOaiTA== X-Received: by 2002:a05:6512:234d:: with SMTP id p13mr13276912lfu.461.1630231017923; Sun, 29 Aug 2021 02:56:57 -0700 (PDT) Received: from localhost.localdomain (37-33-245-172.bb.dnainternet.fi. [37.33.245.172]) by smtp.gmail.com with ESMTPSA id d6sm1090521lfi.57.2021.08.29.02.56.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Aug 2021 02:56:57 -0700 (PDT) From: Kari Argillander To: Konstantin Komarov , ntfs3@lists.linux.dev Cc: Kari Argillander , Christoph Hellwig , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, =?utf-8?q?Pali_Roh=C3=A1r?= , Matthew Wilcox , Christian Brauner Subject: [PATCH v3 9/9] fs/ntfs3: Show uid/gid always in show_options() Date: Sun, 29 Aug 2021 12:56:14 +0300 Message-Id: <20210829095614.50021-10-kari.argillander@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210829095614.50021-1-kari.argillander@gmail.com> References: <20210829095614.50021-1-kari.argillander@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org Show options should show option according documentation when some value is not default or when ever coder wants. Uid/gid are problematic because it is hard to know which are defaults. In file system there is many different implementation for this problem. Some file systems show uid/gid when they are different than root, some when user has set them and some show them always. There is also problem that what if root uid/gid change. This code just choose to show them always. This way we do not need to think this any more. Signed-off-by: Kari Argillander --- fs/ntfs3/ntfs_fs.h | 23 ++++++++++------------- fs/ntfs3/super.c | 12 ++++-------- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h index 5df55bc733bd..a3a7d10de7cb 100644 --- a/fs/ntfs3/ntfs_fs.h +++ b/fs/ntfs3/ntfs_fs.h @@ -60,19 +60,16 @@ struct ntfs_mount_options { u16 fs_fmask_inv; u16 fs_dmask_inv; - unsigned uid : 1, /* uid was set */ - gid : 1, /* gid was set */ - fmask : 1, /* fmask was set */ - dmask : 1, /*dmask was set*/ - sys_immutable : 1, /* immutable system files */ - discard : 1, /* issue discard requests on deletions */ - sparse : 1, /*create sparse files*/ - showmeta : 1, /*show meta files*/ - nohidden : 1, /*do not show hidden files*/ - force : 1, /*rw mount dirty volume*/ - noacs_rules : 1, /*exclude acs rules*/ - prealloc : 1 /*preallocate space when file is growing*/ - ; + unsigned fmask : 1; /* fmask was set */ + unsigned dmask : 1; /*dmask was set*/ + unsigned sys_immutable : 1; /* immutable system files */ + unsigned discard : 1; /* issue discard requests on deletions */ + unsigned sparse : 1; /*create sparse files*/ + unsigned showmeta : 1; /*show meta files*/ + unsigned nohidden : 1; /*do not show hidden files*/ + unsigned force : 1; /*rw mount dirty volume*/ + unsigned noacs_rules : 1; /*exclude acs rules*/ + unsigned prealloc : 1; /*preallocate space when file is growing*/ }; /* special value to unpack and deallocate*/ diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index d7408b4f6813..d28fab6c2297 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -287,13 +287,11 @@ static int ntfs_fs_parse_param(struct fs_context *fc, opts->fs_uid = make_kuid(current_user_ns(), result.uint_32); if (!uid_valid(opts->fs_uid)) return invalf(fc, "ntfs3: Invalid value for uid."); - opts->uid = 1; break; case Opt_gid: opts->fs_gid = make_kgid(current_user_ns(), result.uint_32); if (!gid_valid(opts->fs_gid)) return invalf(fc, "ntfs3: Invalid value for gid."); - opts->gid = 1; break; case Opt_umask: if (result.uint_32 & ~07777) @@ -512,12 +510,10 @@ static int ntfs_show_options(struct seq_file *m, struct dentry *root) struct ntfs_mount_options *opts = sbi->options; struct user_namespace *user_ns = seq_user_ns(m); - if (opts->uid) - seq_printf(m, ",uid=%u", - from_kuid_munged(user_ns, opts->fs_uid)); - if (opts->gid) - seq_printf(m, ",gid=%u", - from_kgid_munged(user_ns, opts->fs_gid)); + seq_printf(m, ",uid=%u", + from_kuid_munged(user_ns, opts->fs_uid)); + seq_printf(m, ",gid=%u", + from_kgid_munged(user_ns, opts->fs_gid)); if (opts->fmask) seq_printf(m, ",fmask=%04o", ~opts->fs_fmask_inv); if (opts->dmask)