mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
To: <ntfs3@lists.linux.dev>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	<linux-fsdevel@vger.kernel.org>
Subject: [PATCH 08/11] fs/ntfs3: Changed ntfs_get_acl() to use dentry
Date: Wed, 15 Feb 2023 17:38:54 +0400	[thread overview]
Message-ID: <2f017ba3-78a9-211d-2a61-f8a1c90c3cab@paragon-software.com> (raw)
In-Reply-To: <d7c91201-5e09-5c06-3283-7887f5a5b7f1@paragon-software.com>

ntfs_get_acl changed to match new interface in struct inode_operations.

Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
---
  fs/ntfs3/file.c    |  2 +-
  fs/ntfs3/namei.c   |  4 ++--
  fs/ntfs3/ntfs_fs.h |  3 ++-
  fs/ntfs3/xattr.c   | 26 +++++++++-----------------
  4 files changed, 14 insertions(+), 21 deletions(-)

diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c
index df7b76d1c127..09b7931e6be3 100644
--- a/fs/ntfs3/file.c
+++ b/fs/ntfs3/file.c
@@ -1143,7 +1143,7 @@ const struct inode_operations 
ntfs_file_inode_operations = {
      .getattr    = ntfs_getattr,
      .setattr    = ntfs3_setattr,
      .listxattr    = ntfs_listxattr,
-    .get_inode_acl    = ntfs_get_acl,
+    .get_acl    = ntfs_get_acl,
      .set_acl    = ntfs_set_acl,
      .fiemap        = ntfs_fiemap,
  };
diff --git a/fs/ntfs3/namei.c b/fs/ntfs3/namei.c
index 5d5fe2f1f77c..8b68ead5cc1f 100644
--- a/fs/ntfs3/namei.c
+++ b/fs/ntfs3/namei.c
@@ -607,7 +607,7 @@ const struct inode_operations 
ntfs_dir_inode_operations = {
      .rmdir        = ntfs_rmdir,
      .mknod        = ntfs_mknod,
      .rename        = ntfs_rename,
-    .get_inode_acl    = ntfs_get_acl,
+    .get_acl    = ntfs_get_acl,
      .set_acl    = ntfs_set_acl,
      .setattr    = ntfs3_setattr,
      .getattr    = ntfs_getattr,
@@ -620,7 +620,7 @@ const struct inode_operations 
ntfs_special_inode_operations = {
      .setattr    = ntfs3_setattr,
      .getattr    = ntfs_getattr,
      .listxattr    = ntfs_listxattr,
-    .get_inode_acl    = ntfs_get_acl,
+    .get_acl    = ntfs_get_acl,
      .set_acl    = ntfs_set_acl,
  };

diff --git a/fs/ntfs3/ntfs_fs.h b/fs/ntfs3/ntfs_fs.h
index 26957dbfe471..b7782107ce8a 100644
--- a/fs/ntfs3/ntfs_fs.h
+++ b/fs/ntfs3/ntfs_fs.h
@@ -855,7 +855,8 @@ unsigned long ntfs_names_hash(const u16 *name, 
size_t len, const u16 *upcase,

  /* globals from xattr.c */
  #ifdef CONFIG_NTFS3_FS_POSIX_ACL
-struct posix_acl *ntfs_get_acl(struct inode *inode, int type, bool rcu);
+struct posix_acl *ntfs_get_acl(struct user_namespace *mnt_userns,
+         struct dentry *dentry, int type);
  int ntfs_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
           struct posix_acl *acl, int type);
  int ntfs_init_acl(struct user_namespace *mnt_userns, struct inode *inode,
diff --git a/fs/ntfs3/xattr.c b/fs/ntfs3/xattr.c
index e7a66225361d..95c479d7ebba 100644
--- a/fs/ntfs3/xattr.c
+++ b/fs/ntfs3/xattr.c
@@ -520,9 +520,14 @@ static noinline int ntfs_set_ea(struct inode 
*inode, const char *name,
  }

  #ifdef CONFIG_NTFS3_FS_POSIX_ACL
-static struct posix_acl *ntfs_get_acl_ex(struct inode *inode, int type,
-                     int locked)
+
+/*
+ * ntfs_get_acl - inode_operations::get_acl
+ */
+struct posix_acl *ntfs_get_acl(struct user_namespace *mnt_userns,
+                   struct dentry *dentry, int type)
  {
+    struct inode *inode = d_inode(dentry);
      struct ntfs_inode *ni = ntfs_i(inode);
      const char *name;
      size_t name_len;
@@ -545,13 +550,11 @@ static struct posix_acl *ntfs_get_acl_ex(struct 
inode *inode, int type,
          name_len = sizeof(XATTR_NAME_POSIX_ACL_DEFAULT) - 1;
      }

-    if (!locked)
-        ni_lock(ni);
+    ni_lock(ni);

      err = ntfs_get_ea(inode, name, name_len, buf, PATH_MAX, &req);

-    if (!locked)
-        ni_unlock(ni);
+    ni_unlock(ni);

      /* Translate extended attribute to acl. */
      if (err >= 0) {
@@ -570,17 +573,6 @@ static struct posix_acl *ntfs_get_acl_ex(struct 
inode *inode, int type,
      return acl;
  }

-/*
- * ntfs_get_acl - inode_operations::get_acl
- */
-struct posix_acl *ntfs_get_acl(struct inode *inode, int type, bool rcu)
-{
-    if (rcu)
-        return ERR_PTR(-ECHILD);
-
-    return ntfs_get_acl_ex(inode, type, 0);
-}
-
  static noinline int ntfs_set_acl_ex(struct user_namespace *mnt_userns,
                      struct inode *inode, struct posix_acl *acl,
                      int type, bool init_acl)
-- 
2.34.1


  parent reply	other threads:[~2023-02-15 13:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-15 13:33 [PATCH 00/11] fs/ntfs3: Bugfix and refactoring Konstantin Komarov
2023-02-15 13:34 ` [PATCH 01/11] fs/ntfs3: Use bh_read to simplify code Konstantin Komarov
2023-02-15 13:34 ` [PATCH 02/11] fs/ntfs3: Remove noacsrules Konstantin Komarov
2023-02-15 13:35 ` [PATCH 03/11] fs/ntfs3: Fix ntfs_create_inode() Konstantin Komarov
2023-02-15 13:36 ` [PATCH 04/11] fs/ntfs3: Optimization in ntfs_set_state() Konstantin Komarov
2023-02-15 13:36 ` [PATCH 05/11] fs/ntfs3: Undo endian changes Konstantin Komarov
2023-02-15 13:37 ` [PATCH 06/11] fs/ntfs3: Undo critial modificatins to keep directory consistency Konstantin Komarov
2023-02-15 13:38 ` [PATCH 07/11] fs/ntfs3: Remove field sbi->used.bitmap.set_tail Konstantin Komarov
2023-02-15 13:38 ` Konstantin Komarov [this message]
2023-02-15 13:39 ` [PATCH 09/11] fs/ntfs3: Code formatting and refactoring Konstantin Komarov
2023-02-15 13:39 ` [PATCH 10/11] fs/ntfs3: Add missed "nocase" in ntfs_show_options Konstantin Komarov
2023-02-15 13:40 ` [PATCH 11/11] fs/ntfs3: Print details about mount fails Konstantin Komarov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2f017ba3-78a9-211d-2a61-f8a1c90c3cab@paragon-software.com \
    --to=almaz.alexandrovich@paragon-software.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ntfs3@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®