From patchwork Thu Aug 19 00:26:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kari Argillander X-Patchwork-Id: 12445729 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.8 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 6EAC8C4338F for ; Thu, 19 Aug 2021 00:27:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4BB01610D2 for ; Thu, 19 Aug 2021 00:27:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235344AbhHSA1p (ORCPT ); Wed, 18 Aug 2021 20:27:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234388AbhHSA1o (ORCPT ); Wed, 18 Aug 2021 20:27:44 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EED0DC061764; Wed, 18 Aug 2021 17:27:08 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id d4so8577238lfk.9; Wed, 18 Aug 2021 17:27:08 -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=Tfj//FhhyfKeVdQKBClWYDezrF9aDmSu69DJf1xq7P8=; b=thVoF9ouc3UABUSLBdo0ij9UzOTBrj3X8W/FHCdoHzz88ZfvvTe97dyzMhmdyk3zNM YImGEfe57iO6S49EtR0cfXdhqFrgWWYqQmYDX3D8hmLv5LebdvUH8Qx0Bq7svVTPjMEr pkNMZlH/Vj2uLfoTjGlpCAT28VTwKPzBJoMIDY8KhzpdhDa08sVqtcwWDCzP2rxU/gbM MDOSGMVm+J3WIzn3U4LWpkhgCcj5mC1D3jxhcee6NjaRCCyGJKm836UfipILfxkpEpAE CzYURShrAPoo4Dzs/qQw4dcpFLaJsI1TCdJBveoGnYRkuKymyFGZvitzqGMpbkUlLqpp wHbw== 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=Tfj//FhhyfKeVdQKBClWYDezrF9aDmSu69DJf1xq7P8=; b=ftqBv0j34Cf9w9L87Y7pSJkSgNydlK1qkZ9RAQ98UQE/r5yl/JOiPq8lWJnEUYzjnP AGQTHuvVjc9fEe17ku5iZp6QylueXABj1S+1l1yz1aqXXepm66OJXB7YcgqUpOZ7LOgC eW2kTRbydgwCofzdDpp3bcisNJR0ctF8IpLw1RboZLzCcmxW7NcbYSYR4BgROqsXqBT4 UQ5kjdOeGrIxO0/rMUZa75lwJzspL52y7Z72gniVeQtmiPDEfYYn1P9yk0wwReEZIpd9 SQMv0RvPT/8PraYDdcGfzJ8/Rvi4fvigv77vSVDIvi8s66rfob70rCHh+WSCXWLwQcNp NgkQ== X-Gm-Message-State: AOAM531/WPLUkG/8ZU5Jtj4kvSLRSU776r+30kwxS/6eiHpf8ESO+ih8 PvIK7bwzxqYFV3d03SkSfOo= X-Google-Smtp-Source: ABdhPJwT3+v+7NqeseVFVx9AsF7XLv/dX5uKdtVC+OFkf26i730dxctkKj3zsuC8pyWlV0/5AnxgyA== X-Received: by 2002:ac2:58d4:: with SMTP id u20mr8007445lfo.157.1629332827385; Wed, 18 Aug 2021 17:27:07 -0700 (PDT) Received: from kari-VirtualBox.telewell.oy (85-23-89-224.bb.dnainternet.fi. [85.23.89.224]) by smtp.gmail.com with ESMTPSA id l14sm125907lji.106.2021.08.18.17.27.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 17:27:07 -0700 (PDT) From: Kari Argillander To: Konstantin Komarov , Christoph Hellwig Cc: Kari Argillander , ntfs3@lists.linux.dev, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, =?utf-8?q?Pali?= =?utf-8?q?_Roh=C3=A1r?= , Matthew Wilcox , Christian Brauner Subject: [PATCH v2 1/6] fs/ntfs3: Remove unnecesarry mount option noatime Date: Thu, 19 Aug 2021 03:26:28 +0300 Message-Id: <20210819002633.689831-2-kari.argillander@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210819002633.689831-1-kari.argillander@gmail.com> References: <20210819002633.689831-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. Signed-off-by: Kari Argillander Reviewed-by: Christoph Hellwig Acked-by: Christian Brauner --- 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 6be13e256c1a..081ac875a61a 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -215,7 +215,6 @@ enum Opt { Opt_nohidden, Opt_showmeta, Opt_acl, - Opt_noatime, Opt_nls, Opt_prealloc, Opt_no_acs_rules, @@ -234,7 +233,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" }, @@ -325,9 +323,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; @@ -574,8 +569,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 Thu Aug 19 00:26:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kari Argillander X-Patchwork-Id: 12445731 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.8 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 13A59C4338F for ; Thu, 19 Aug 2021 00:27:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EC8EA610A5 for ; Thu, 19 Aug 2021 00:27:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235379AbhHSA1s (ORCPT ); Wed, 18 Aug 2021 20:27:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234388AbhHSA1r (ORCPT ); Wed, 18 Aug 2021 20:27:47 -0400 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 416CAC061764; Wed, 18 Aug 2021 17:27:12 -0700 (PDT) Received: by mail-lj1-x22a.google.com with SMTP id f2so8385839ljn.1; Wed, 18 Aug 2021 17:27:12 -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=+mLjxLSEHZbWDASGXk6f6L4oOTwEXpRclV6xV2hv/zQ=; b=KVGz7UtKDDA5D4dyMAchK21PYLITGd23DuesglQwSDdZKDgRcMgpgyfgbeI0spunGt +Zw+sr5Yybpq2ql2yqW+T5rob10oybFDgSlKBeIv7dlPjnWciq8vEoF10XzaoWGHSOWi Xmh8bzXgIw50kFs2m3bO3coWuw1n6F6Mwe/S9nxYsFzCx4uRRim9bWP3E4Amle3o34Lm gouiVf4vsP7BD84jtebstAw7NikELniQGlDnungnPv8coXHznp4ysEwYkgIvpKGN4giM oq1yq8n2Tkb8abEmNy+Ok2DLmhmJVY/l1ZakOUHtMqEg0CYDzoR36+D8aaNVna5/yK1z JBeA== 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=+mLjxLSEHZbWDASGXk6f6L4oOTwEXpRclV6xV2hv/zQ=; b=gCuCYnIt26IT201Xgy3WmQPxYAMQgTrRpHvbSCaw86Hy1td1DSDWPMVAllybYpJFKQ YssjQ3ZR35nAB8HGkkUyI7UPAwP8N7b1fglTHjlpoFtCcRlYRvwCNXOW4GzA5H5ktSRq xS/eEovBDWaYwbhfjhLy7xUnjy0n5kk38HuksWiXd/DtiWCpQD0neZME072QPlHDj8KR BCYEl/NDK7fmojZsqst5xGTA7BcwQcN72GuJE/f5XomIrlllIdNRZ4oCT7d1tyq7zxQz 5EuSVDN6BALhEz/NYoU5SbL5oNI5/rsz5xPVNpLw/f/KO2FpeamrzUgTQiRl4DTe4Bct I1iQ== X-Gm-Message-State: AOAM532tZtAjSZ0VfyBmfwSjPoAitmOF3lvawEFxDehEvouJAvNr+YR1 SMdd40vn/xQmFpPjXjmG+Ss= X-Google-Smtp-Source: ABdhPJzEz78zC8JxSKikbHOB2+HRAblmqMoJ/I20iwWQFQ422ar8BBo1ck1ZNqEn7R4GLt4fVTErGw== X-Received: by 2002:a2e:8583:: with SMTP id b3mr9842869lji.389.1629332830685; Wed, 18 Aug 2021 17:27:10 -0700 (PDT) Received: from kari-VirtualBox.telewell.oy (85-23-89-224.bb.dnainternet.fi. [85.23.89.224]) by smtp.gmail.com with ESMTPSA id l14sm125907lji.106.2021.08.18.17.27.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 17:27:10 -0700 (PDT) From: Kari Argillander To: Konstantin Komarov , Christoph Hellwig Cc: Kari Argillander , ntfs3@lists.linux.dev, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, =?utf-8?q?Pali?= =?utf-8?q?_Roh=C3=A1r?= , Matthew Wilcox , Christian Brauner Subject: [PATCH v2 2/6] fs/ntfs3: Remove unnecesarry remount flag handling Date: Thu, 19 Aug 2021 03:26:29 +0300 Message-Id: <20210819002633.689831-3-kari.argillander@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210819002633.689831-1-kari.argillander@gmail.com> References: <20210819002633.689831-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. Signed-off-by: Kari Argillander Reviewed-by: Christoph Hellwig Acked-by: Christian Brauner --- fs/ntfs3/super.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index 081ac875a61a..702da1437cfd 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -406,8 +406,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 Thu Aug 19 00:26:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kari Argillander X-Patchwork-Id: 12445733 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.8 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 BAC54C4338F for ; Thu, 19 Aug 2021 00:27:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A11C8610A6 for ; Thu, 19 Aug 2021 00:27:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235449AbhHSA1u (ORCPT ); Wed, 18 Aug 2021 20:27:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234388AbhHSA1t (ORCPT ); Wed, 18 Aug 2021 20:27:49 -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 1AEB2C061764; Wed, 18 Aug 2021 17:27:14 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id i28so8341323ljm.7; Wed, 18 Aug 2021 17:27:14 -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=slL8WQJpSveoTSV6+zYKqn8eOOZlUj3SM/meJfx6NDE=; b=er/1safoIgTxu/eLbD4Co2oQLxnwwTPhTP5q2/hH/B+Ygmcw8aJ6Qlmm7SGkaX5Z45 Zgirj1kMlOd/110wA8MHzABWDOu6um7oWHSK8PxXikf0o5jgUNdgrvuuH4tPHM83OU6c y2cKPz9UWu2do6g+9zk5lRSyKxvcttRbgcR3KPnlr5D6nlWK7Kj11enyOo5MY7oUvV+c xDulBemre9SsOijns6dcaGHX8H8+NzwASYPILHSlm1Hi/tUHU55sAsytO0/Xo7IY2yzI yk1HrOEBZbWzEM3j+BZgAGdq6jSd8dn3hWHlUZklh8mHbF7bqjv9LiHGfbrCrl3FbNlh HBqQ== 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=slL8WQJpSveoTSV6+zYKqn8eOOZlUj3SM/meJfx6NDE=; b=isVvTyGADfK346lgVLMvFL2JpWpzhc8Fz2gJXifwZ3BqKbtCFLRrG8t+pzOpI4IyyH 0VbALJU7q0NYHd3nAlXeVkORnSBLr8hRztb6+gSwonG0HyYyN+4p3qFrbowcn4Dfnh1n L7GaihIF5dKJ3JIZ0EGG/U6v/4TNAm1oqV58FmEYg2vNjkoQPYFXBGIYbeR2c/eGXovT mGhLxdS5t1TQZPP5oUxo2eqJBT5cBcY4zsH9AgiC+e0Hi6XHTnDkDKlzVRxMCUy41nyo R/vLVDkeHj5K7UTnD1vDLarJqU2rs77rJWMXgB05pBfXUUtVmhitTgY3iNT6bFIKth2u ADiQ== X-Gm-Message-State: AOAM531f4gHkyS0BYWYlW2E+E9ddeA3MMbUv8tdpyGj8JbFicoWM0ezE gGfDEncV/oEK+tsPrPbOZBI= X-Google-Smtp-Source: ABdhPJwnsV4SMG7OuYD6myrNeUyMpHAoYwCBMPSkB+2stWoo/1xHNTQTieSp3EsNJbGeq8GutcExbA== X-Received: by 2002:a2e:9d8e:: with SMTP id c14mr10187135ljj.156.1629332832420; Wed, 18 Aug 2021 17:27:12 -0700 (PDT) Received: from kari-VirtualBox.telewell.oy (85-23-89-224.bb.dnainternet.fi. [85.23.89.224]) by smtp.gmail.com with ESMTPSA id l14sm125907lji.106.2021.08.18.17.27.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 17:27:12 -0700 (PDT) From: Kari Argillander To: Konstantin Komarov , Christoph Hellwig Cc: Kari Argillander , ntfs3@lists.linux.dev, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, =?utf-8?q?Pali?= =?utf-8?q?_Roh=C3=A1r?= , Matthew Wilcox , Christian Brauner Subject: [PATCH v2 3/6] fs/ntfs3: Use new api for mounting Date: Thu, 19 Aug 2021 03:26:30 +0300 Message-Id: <20210819002633.689831-4-kari.argillander@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210819002633.689831-1-kari.argillander@gmail.com> References: <20210819002633.689831-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 Acked-by: Christian Brauner --- fs/ntfs3/ntfs_fs.h | 1 + fs/ntfs3/super.c | 392 +++++++++++++++++++++++---------------------- 2 files changed, 199 insertions(+), 194 deletions(-) diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h index 0c3ac89c3115..1f07dd17c6c7 100644 --- a/fs/ntfs3/ntfs_fs.h +++ b/fs/ntfs3/ntfs_fs.h @@ -50,6 +50,7 @@ struct ntfs_mount_options { struct nls_table *nls; + char *nls_name; kuid_t fs_uid; kgid_t fs_gid; diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c index 702da1437cfd..39936a4ce831 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -28,10 +28,11 @@ #include #include #include +#include +#include #include #include #include -#include #include #include @@ -197,8 +198,32 @@ void *ntfs_put_shared(void *ptr) return ret; } +/* + * Load nls table or if @nls is utf8 then return NULL because + * nls=utf8 is totally broken. + */ +static struct nls_table *ntfs_load_nls(char *nls) +{ + struct nls_table *ret; + + if (!nls) + nls = CONFIG_NLS_DEFAULT; + + if (strcmp(nls, "utf8")) + return NULL; + if (strcmp(nls, CONFIG_NLS_DEFAULT)) + return load_nls_default(); + + ret = load_nls(nls); + if (!ret) + return ERR_PTR(-EINVAL); + + return ret; +} + static inline void clear_mount_options(struct ntfs_mount_options *options) { + kfree(options->nls_name); unload_nls(options->nls); } @@ -221,202 +246,150 @@ 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) +static int ntfs_fs_parse_param(struct fs_context *fc, + struct fs_parameter *param) { - char *p; - substring_t args[MAX_OPT_ARGS]; - int option; - char nls_name[30]; - struct nls_table *nls; - - 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 (!options) - goto out; - - while ((p = strsep(&options, ","))) { - int token; + struct ntfs_sb_info *sbi = fc->s_fs_info; + struct ntfs_mount_options *opts = &sbi->options; + struct fs_parse_result result; + int opt; - if (!*p) - continue; + opt = fs_parse(fc, ntfs_fs_parameters, param, &result); + if (opt < 0) + return opt; - 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: + switch (opt) { + case Opt_uid: + opts->fs_uid = make_kuid(current_user_ns(), result.uint_32); + if (!uid_valid(opts->fs_uid)) + return -EINVAL; + 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 -EINVAL; + opts->gid = 1; + break; + case Opt_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: + opts->fs_dmask_inv = ~result.uint_32; + opts->dmask = 1; + break; + case Opt_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; - } + else + fc->sb_flags &= ~SB_POSIXACL; + break; + case Opt_showmeta: + opts->showmeta = result.negated ? 0 : 1; + break; + case Opt_nls: + 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; } - -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; - } - } - 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); + struct ntfs_mount_options *new_opts = fc->s_fs_info; + int ro_rw; - 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(sbi->options)); - - 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"); + goto clear_new_fc; } 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!"); + goto clear_new_fc; } - clear_mount_options(&old_opts); + /* + * TODO: We should probably check some mount options does + * they all work after remount. Example can we really change + * nls. Remove this comment when all testing is done or + * even better xfstest is made for it. + */ - ntfs_info(sb, "re-mounted. Opts: %s", orig_data); - err = 0; - goto out; + new_opts->nls = ntfs_load_nls(new_opts->nls_name); + if (IS_ERR(new_opts->nls)) { + errorf(fc, "ntfs3: Cannot load nls %s", new_opts->nls_name); + goto clear_new_fc; + } -restore_opts: clear_mount_options(&sbi->options); - memcpy(&sbi->options, &old_opts, sizeof(old_opts)); + sbi->options = *new_opts; + return 0; -out: - kfree(orig_data); - return err; +clear_new_fc: + clear_mount_options(new_opts); + return -EINVAL; } static struct kmem_cache *ntfs_inode_cachep; @@ -545,10 +518,8 @@ static int ntfs_show_options(struct seq_file *m, struct dentry *root) seq_printf(m, ",fmask=%04o", ~opts->fs_fmask_inv); if (opts->dmask) seq_printf(m, ",dmask=%04o", ~opts->fs_dmask_inv); - if (opts->nls) - seq_printf(m, ",nls=%s", opts->nls->charset); - else - seq_puts(m, ",nls=utf8"); + if (opts->nls_name) + seq_printf(m, ",nls=%s", opts->nls_name); if (opts->sys_immutable) seq_puts(m, ",sys_immutable"); if (opts->discard) @@ -619,7 +590,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, }; @@ -883,10 +853,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); @@ -905,11 +875,6 @@ static int ntfs_fill_super(struct super_block *sb, void *data, int silent) ref.high = 0; - sbi = ntfs_zalloc(sizeof(struct ntfs_sb_info)); - if (!sbi) - return -ENOMEM; - - sb->s_fs_info = sbi; sbi->sb = sb; sb->s_flags |= SB_NODIRATIME; sb->s_magic = 0x7366746e; // "ntfs" @@ -921,10 +886,6 @@ 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; - if (!rq || !blk_queue_discard(rq) || !rq->limits.discard_granularity) { ; } else { @@ -933,6 +894,14 @@ static int ntfs_fill_super(struct super_block *sb, void *data, int silent) ~(u64)(sbi->discard_granularity - 1); } + sbi->options.nls = ntfs_load_nls(sbi->options.nls_name); + if (IS_ERR(sbi->options.nls)) { + ntfs_err(sb, "ntfs3: Cannot load nls %s", + sbi->options.nls_name); + err = PTR_ERR(sbi->options.nls); + goto out; + } + sb_set_blocksize(sb, PAGE_SIZE); /* parse boot */ @@ -1400,19 +1369,54 @@ 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); +} + +static void ntfs_fs_free(struct fs_context *fc) +{ + struct ntfs_sb_info *sbi = fc->s_fs_info; + + if (sbi) + put_ntfs(sbi); +} + +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, +}; + +static int ntfs_init_fs_context(struct fs_context *fc) { - return mount_bdev(fs_type, flags, dev_name, data, ntfs_fill_super); + struct ntfs_sb_info *sbi; + + sbi = ntfs_zalloc(sizeof(struct ntfs_sb_info)); + if (!sbi) + return -ENOMEM; + + /* Default options */ + sbi->options.fs_uid = current_uid(); + sbi->options.fs_gid = current_gid(); + sbi->options.fs_fmask_inv = ~current_umask(); + sbi->options.fs_dmask_inv = ~current_umask(); + + fc->s_fs_info = sbi; + 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 Thu Aug 19 00:26:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kari Argillander X-Patchwork-Id: 12445735 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.8 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 514E7C432BE for ; Thu, 19 Aug 2021 00:27:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3B1AC610A6 for ; Thu, 19 Aug 2021 00:27:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235527AbhHSA1y (ORCPT ); Wed, 18 Aug 2021 20:27:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235481AbhHSA1v (ORCPT ); Wed, 18 Aug 2021 20:27:51 -0400 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 996B6C061764; Wed, 18 Aug 2021 17:27:15 -0700 (PDT) Received: by mail-lj1-x233.google.com with SMTP id h9so8322777ljq.8; Wed, 18 Aug 2021 17:27:15 -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=TB/XZBGPIVAOC56VciYkS4c+U53Iayfs//+43Dxn0UY=; b=LzrA6rYIvTj3n8pdQAsAtgJ26pLhb6CIHBT0zfuKWYz3M5oEf/rKazkStEBmaZKhaq jjgGUIjPnR0krSB++yEzGXPrRq+eHagwKpBNmNLwH61B/au0MPR2WIVvzZI45qLkJ3B8 oQGIAbmjeWFvvfNax/zRDyTX5piaDcON3AMQkFsYdr9hHziRSk7s5lyGpAVx3udacUbl yxSiuitBivds4xf0IvZuHprFrtTWmuaZRXe9kNtlqz56gbDmRPeWktZht8kDKBMR4qJl yuLUzAH+FWNsD5Z9C57/Nf57+P3O8n/yqG1kuzaNZe13NhBJirugRhA1Ny9z7YCvsslC J8pQ== 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=TB/XZBGPIVAOC56VciYkS4c+U53Iayfs//+43Dxn0UY=; b=S4edgrUr+3OnFjtdEJbdhSs5EkZvtuYOnj4tPy1XYxloNx+oAUkz9zF65PUyWKnQey XPlG9Ma/kcbunSMMjhhoTfijKA53mCAOjmqplicpxRMB94gnq3vymdNIjadHZeqFlXuy gl7j+zLHQcDOj8vVnf4St+j/+NSABt70RZFtW6Xa5tfvZC47PHF7dSMa/oHW8lzdHCCW VtUOOWV7GZFwcp0xj7nPL01M8pwQQc088YFDgr0PQbRko2AU1pXUw/ZrL+DgcFZmVdaE 02jN4bxtKDhJo2fajabS4rALF0jzBzchsVYhO7SSzIpx/c16DO60seZiiyLNdwEUz+KD dXyg== X-Gm-Message-State: AOAM531fGoInVS4LR3FAzddlRowesLU2yyturrgD9p2IDeWV9PjIQLZu HHqTzCmvu2q7DoL5p3QUQLE= X-Google-Smtp-Source: ABdhPJzWqGuZZycph73+9DAemhgxOKuVLuXMF7rsHuW033/8wK/igrGFIRakj3K1MUO4C+JNb39mjQ== X-Received: by 2002:a05:651c:30d:: with SMTP id a13mr9420182ljp.393.1629332834048; Wed, 18 Aug 2021 17:27:14 -0700 (PDT) Received: from kari-VirtualBox.telewell.oy (85-23-89-224.bb.dnainternet.fi. [85.23.89.224]) by smtp.gmail.com with ESMTPSA id l14sm125907lji.106.2021.08.18.17.27.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 17:27:13 -0700 (PDT) From: Kari Argillander To: Konstantin Komarov , Christoph Hellwig Cc: Kari Argillander , ntfs3@lists.linux.dev, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, =?utf-8?q?Pali?= =?utf-8?q?_Roh=C3=A1r?= , Matthew Wilcox , Christian Brauner Subject: [PATCH v2 4/6] fs/ntfs3: Make mount option nohidden more universal Date: Thu, 19 Aug 2021 03:26:31 +0300 Message-Id: <20210819002633.689831-5-kari.argillander@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210819002633.689831-1-kari.argillander@gmail.com> References: <20210819002633.689831-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. Signed-off-by: Kari Argillander Reviewed-by: Christoph Hellwig Acked-by: Christian Brauner --- 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 39936a4ce831..8e86e1956486 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -256,7 +256,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), @@ -317,7 +317,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 Thu Aug 19 00:26:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kari Argillander X-Patchwork-Id: 12445737 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.8 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 2A9D6C4338F for ; Thu, 19 Aug 2021 00:27:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 14E13610A5 for ; Thu, 19 Aug 2021 00:27:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235560AbhHSA2C (ORCPT ); Wed, 18 Aug 2021 20:28:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235464AbhHSA1x (ORCPT ); Wed, 18 Aug 2021 20:27:53 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD7E3C0613D9; Wed, 18 Aug 2021 17:27:17 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id x7so8287001ljn.10; Wed, 18 Aug 2021 17:27:17 -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=DOuni2n/29LbC0ytAK0Fi8GuUBVC6c+VlqLmnjT4LqI=; b=emAMHPR2eshcvqE3HBYuyFC4p3XBf3LMqQL/Mb5s/G07siv0KIi1+8HtbTEGrqkRT+ /01tH6FRvnoM85cxpHdL72VrHIs+tQlYdD09YEiuJBBqj6aSqQ8tixp9CSBT68mcnq7f y2We3CorfLz/6ciy99TVZF00BjpC3BOZhvUgp+HUsktQ9EvLPn1w6fg1ZFT6OS/3Xb90 ADtjbb/dHJ/vEkLpbfFNPWZ40bjS1Sx8loX+SjCEFnNpfCoRBnd7WxsHKjLYr0WSDKxk DBYeg2hFfJox56SAAsk6qYyzDCamx4L92zHgN03xTGGc30xar+lVlndErPkfHm0/u2M9 b1+Q== 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=DOuni2n/29LbC0ytAK0Fi8GuUBVC6c+VlqLmnjT4LqI=; b=c71afJhpIlVflAeGWpOTw2MSmT4rxyAQHS6Ts1h+EUf2KXwv1NXClqKQU9Z6flhslF mqPGzAKF+ie57en2KJjrc5nTpsMEIZenLvqdd3caCZtCvH+BTQjsRxMIler1cOS9HnQY pLcx1o/Hy9zHlo9hSD3ipzbueD6xwrvMtJLJKFVA6V02adU9kzR7Blk5E1o5DwCy5cQP TTd/WRvWmTsa4E64PPV1CjeTFP2l+1youZuCldAO21oy3Nai9zKzeqoW3Br61FL8/8rI xmIH77l9derB0maYE/KYkN3dEJSDM7wFEteAgLuw2g+I2VBaI80pOH6PyPH4tuvH2zay RYwg== X-Gm-Message-State: AOAM530vhN9W4D1p8LXKQ9KuCR0DxhzEFXylv/yD/v/v175StUDZNoeC gf0mSH4pKdBRqIiVg/i+jNo= X-Google-Smtp-Source: ABdhPJxCrzU2oaf6pHPW39AB8R+VNEta0gb/FOqjgHsyTDV/Qrr39Yg42+D8rgutlUtM2FVm7GWacg== X-Received: by 2002:a2e:3914:: with SMTP id g20mr9926594lja.88.1629332835912; Wed, 18 Aug 2021 17:27:15 -0700 (PDT) Received: from kari-VirtualBox.telewell.oy (85-23-89-224.bb.dnainternet.fi. [85.23.89.224]) by smtp.gmail.com with ESMTPSA id l14sm125907lji.106.2021.08.18.17.27.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 17:27:15 -0700 (PDT) From: Kari Argillander To: Konstantin Komarov , Christoph Hellwig Cc: Kari Argillander , ntfs3@lists.linux.dev, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, =?utf-8?q?Pali?= =?utf-8?q?_Roh=C3=A1r?= , Matthew Wilcox , Christian Brauner Subject: [PATCH v2 5/6] fs/ntfs3: Add iocharset= mount option as alias for nls= Date: Thu, 19 Aug 2021 03:26:32 +0300 Message-Id: <20210819002633.689831-6-kari.argillander@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210819002633.689831-1-kari.argillander@gmail.com> References: <20210819002633.689831-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 | 12 ++++++++---- 2 files changed, 10 insertions(+), 6 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 8e86e1956486..c3c07c181f15 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -240,7 +240,7 @@ enum Opt { Opt_nohidden, Opt_showmeta, Opt_acl, - Opt_nls, + Opt_iocharset, Opt_prealloc, Opt_no_acs_rules, Opt_err, @@ -259,9 +259,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), {} }; @@ -332,7 +336,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: opts->nls_name = param->string; param->string = NULL; break; @@ -519,7 +523,7 @@ 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_name) - seq_printf(m, ",nls=%s", opts->nls_name); + seq_printf(m, ",iocharset=%s", opts->nls_name); if (opts->sys_immutable) seq_puts(m, ",sys_immutable"); if (opts->discard) From patchwork Thu Aug 19 00:26:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kari Argillander X-Patchwork-Id: 12445739 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.8 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 2BF50C4320A for ; Thu, 19 Aug 2021 00:27:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 15D1D610CB for ; Thu, 19 Aug 2021 00:27:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235579AbhHSA2D (ORCPT ); Wed, 18 Aug 2021 20:28:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235514AbhHSA1y (ORCPT ); Wed, 18 Aug 2021 20:27:54 -0400 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BD86C06179A; Wed, 18 Aug 2021 17:27:19 -0700 (PDT) Received: by mail-lj1-x22d.google.com with SMTP id n7so8432095ljq.0; Wed, 18 Aug 2021 17:27:18 -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=OuvPHidmzGM3xfvyJ/iRKu/nSL+2mL7ylUN+am7Bbio=; b=QHLuK343vWAbHssWFJiqUq/ClvS8ybP8SFbiNvZdDGERaX8lm1TiDdscI58S6H0brn Eh5mHnYJpSUloyVBFz9UdJiB/Fi91YUkuZ4mLc9zDbZ8pCn9IXzZ3+c6xcqcsLguGNvr NqbQihZmTgou2SRrEUMfiHLJcNhgqEXeobum2ayxoFkbh3H9iDb9q7WjlvdbzvwSpszy TS0gceKowVH5pVA/uCaJV+sfu7xgg1Ypo4ERRJw2Hxj8rLnUdJ6EnVhDef5XjeZZfwbw clNSp7oPFAbO6IfZwCu8GBrkfjohEczljt/LrIEqgNY+mwAlylqefmI96dQxWLQPg3LJ 9gSQ== 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=OuvPHidmzGM3xfvyJ/iRKu/nSL+2mL7ylUN+am7Bbio=; b=jEnkjMBbX8SfZimgTjrVIdsdqORqqpxuFm1Sv4SJdQ3hbl0piQ+Robd0MXVg/1EDCH 1BzOJ25Q/x9HjM2BrbsWOEdlotVPXslvLF6DUQEa+Ngfuk3xJZPuUL9GdVNzFcYyI1yZ dQXYOMegPRZn2kLbyVqOPKhJfdA5aEQb0fhE0bO+J7dQaoFOUwFtxhVEI7mesFBa8Txb JAIwUQIT9Cmtfl1Pjf9PMAkui8U6pSt2jwd7IK9fdSqG5JGnsD6ZoZZmt1kR2zx7jv+z lT1dPZqbxhSm5y8U2V3yGwKk5PAvlz55VHOesjQbH7GenVD+O2KUoL+TWkLAtnHe0Pim 1ijw== X-Gm-Message-State: AOAM5327svj7GGuN+krMx77TmI+ofa3z26Q5PvnE9UN1QektfWbDNlKw Udbb2sT/ijBulODCig0aG3I= X-Google-Smtp-Source: ABdhPJzNY06Mdbi0olL8L1uvNM5ELIcy5kw93h80MXSXsXqRbYMBDqVIa2QxmhSxS/+xaf9EiS0iBg== X-Received: by 2002:a2e:a912:: with SMTP id j18mr8953804ljq.330.1629332837418; Wed, 18 Aug 2021 17:27:17 -0700 (PDT) Received: from kari-VirtualBox.telewell.oy (85-23-89-224.bb.dnainternet.fi. [85.23.89.224]) by smtp.gmail.com with ESMTPSA id l14sm125907lji.106.2021.08.18.17.27.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 17:27:17 -0700 (PDT) From: Kari Argillander To: Konstantin Komarov , Christoph Hellwig Cc: Kari Argillander , ntfs3@lists.linux.dev, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, =?utf-8?q?Pali?= =?utf-8?q?_Roh=C3=A1r?= , Matthew Wilcox , Christian Brauner Subject: [PATCH v2 6/6] fs/ntfs3: Rename mount option no_acl_rules > (no)acl_rules Date: Thu, 19 Aug 2021 03:26:33 +0300 Message-Id: <20210819002633.689831-7-kari.argillander@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210819002633.689831-1-kari.argillander@gmail.com> References: <20210819002633.689831-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. Signed-off-by: Kari Argillander Reviewed-by: Christoph Hellwig Acked-by: Christian Brauner --- 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 59344985c2e8..de3c6c76ab7d 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 1f07dd17c6c7..bec51e6f476d 100644 --- a/fs/ntfs3/ntfs_fs.h +++ b/fs/ntfs3/ntfs_fs.h @@ -67,7 +67,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 c3c07c181f15..a94a094463ad 100644 --- a/fs/ntfs3/super.c +++ b/fs/ntfs3/super.c @@ -242,7 +242,7 @@ enum Opt { Opt_acl, Opt_iocharset, Opt_prealloc, - Opt_no_acs_rules, + Opt_noacs_rules, Opt_err, }; @@ -260,7 +260,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, @@ -343,8 +343,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. */ @@ -536,8 +536,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 98871c895e77..e20e710a065f 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; }