fs: pass dentry to set acl method
authorChristian Brauner <brauner@kernel.org>
Fri, 23 Sep 2022 08:29:39 +0000 (10:29 +0200)
committerChristian Brauner (Microsoft) <brauner@kernel.org>
Wed, 19 Oct 2022 10:55:42 +0000 (12:55 +0200)
The current way of setting and getting posix acls through the generic
xattr interface is error prone and type unsafe. The vfs needs to
interpret and fixup posix acls before storing or reporting it to
userspace. Various hacks exist to make this work. The code is hard to
understand and difficult to maintain in it's current form. Instead of
making this work by hacking posix acls through xattr handlers we are
building a dedicated posix acl api around the get and set inode
operations. This removes a lot of hackiness and makes the codepaths
easier to maintain. A lot of background can be found in [1].

Since some filesystem rely on the dentry being available to them when
setting posix acls (e.g., 9p and cifs) they cannot rely on set acl inode
operation. But since ->set_acl() is required in order to use the generic
posix acl xattr handlers filesystems that do not implement this inode
operation cannot use the handler and need to implement their own
dedicated posix acl handlers.

Update the ->set_acl() inode method to take a dentry argument. This
allows all filesystems to rely on ->set_acl().

As far as I can tell all codepaths can be switched to rely on the dentry
instead of just the inode. Note that the original motivation for passing
the dentry separate from the inode instead of just the dentry in the
xattr handlers was because of security modules that call
security_d_instantiate(). This hook is called during
d_instantiate_new(), d_add(), __d_instantiate_anon(), and
d_splice_alias() to initialize the inode's security context and possibly
to set security.* xattrs. Since this only affects security.* xattrs this
is completely irrelevant for posix acls.

Link: https://lore.kernel.org/all/20220801145520.1532837-1-brauner@kernel.org
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
55 files changed:
Documentation/filesystems/vfs.rst
fs/bad_inode.c
fs/btrfs/acl.c
fs/btrfs/ctree.h
fs/btrfs/inode.c
fs/ceph/acl.c
fs/ceph/inode.c
fs/ceph/super.h
fs/ext2/acl.c
fs/ext2/acl.h
fs/ext2/inode.c
fs/ext4/acl.c
fs/ext4/acl.h
fs/ext4/inode.c
fs/f2fs/acl.c
fs/f2fs/acl.h
fs/f2fs/file.c
fs/fuse/acl.c
fs/fuse/fuse_i.h
fs/gfs2/acl.c
fs/gfs2/acl.h
fs/gfs2/inode.c
fs/jffs2/acl.c
fs/jffs2/acl.h
fs/jffs2/fs.c
fs/jfs/acl.c
fs/jfs/file.c
fs/jfs/jfs_acl.h
fs/ksmbd/smb2pdu.c
fs/ksmbd/smbacl.c
fs/ksmbd/vfs.c
fs/ksmbd/vfs.h
fs/nfs/nfs3_fs.h
fs/nfs/nfs3acl.c
fs/nfsd/nfs2acl.c
fs/nfsd/nfs3acl.c
fs/nfsd/vfs.c
fs/ntfs3/file.c
fs/ntfs3/ntfs_fs.h
fs/ntfs3/xattr.c
fs/ocfs2/acl.c
fs/ocfs2/acl.h
fs/orangefs/acl.c
fs/orangefs/inode.c
fs/orangefs/orangefs-kernel.h
fs/posix_acl.c
fs/reiserfs/acl.h
fs/reiserfs/inode.c
fs/reiserfs/xattr_acl.c
fs/xfs/xfs_acl.c
fs/xfs/xfs_acl.h
fs/xfs/xfs_iops.c
include/linux/fs.h
include/linux/posix_acl.h
mm/shmem.c

index 2b55f71..cbf3088 100644 (file)
@@ -443,7 +443,7 @@ As of kernel 2.6.22, the following members are defined:
                int (*atomic_open)(struct inode *, struct dentry *, struct file *,
                                   unsigned open_flag, umode_t create_mode);
                int (*tmpfile) (struct user_namespace *, struct inode *, struct file *, umode_t);
-               int (*set_acl)(struct user_namespace *, struct inode *, struct posix_acl *, int);
+               int (*set_acl)(struct user_namespace *, struct dentry *, struct posix_acl *, int);
                int (*fileattr_set)(struct user_namespace *mnt_userns,
                                    struct dentry *dentry, struct fileattr *fa);
                int (*fileattr_get)(struct dentry *dentry, struct fileattr *fa);
index 9d1cde8..bc9917d 100644 (file)
@@ -154,7 +154,7 @@ static int bad_inode_tmpfile(struct user_namespace *mnt_userns,
 }
 
 static int bad_inode_set_acl(struct user_namespace *mnt_userns,
-                            struct inode *inode, struct posix_acl *acl,
+                            struct dentry *dentry, struct posix_acl *acl,
                             int type)
 {
        return -EIO;
index 548d6a5..1e47b3e 100644 (file)
@@ -110,10 +110,11 @@ out:
        return ret;
 }
 
-int btrfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+int btrfs_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
                  struct posix_acl *acl, int type)
 {
        int ret;
+       struct inode *inode = d_inode(dentry);
        umode_t old_mode = inode->i_mode;
 
        if (type == ACL_TYPE_ACCESS && acl) {
index 727595e..d93a4d0 100644 (file)
@@ -3987,7 +3987,7 @@ static inline int __btrfs_fs_compat_ro(struct btrfs_fs_info *fs_info, u64 flag)
 /* acl.c */
 #ifdef CONFIG_BTRFS_FS_POSIX_ACL
 struct posix_acl *btrfs_get_acl(struct inode *inode, int type, bool rcu);
-int btrfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+int btrfs_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
                  struct posix_acl *acl, int type);
 int __btrfs_set_acl(struct btrfs_trans_handle *trans, struct inode *inode,
                    struct posix_acl *acl, int type);
index b0807c5..312ba03 100644 (file)
@@ -5256,7 +5256,7 @@ static int btrfs_setattr(struct user_namespace *mnt_userns, struct dentry *dentr
                err = btrfs_dirty_inode(inode);
 
                if (!err && attr->ia_valid & ATTR_MODE)
-                       err = posix_acl_chmod(mnt_userns, inode, inode->i_mode);
+                       err = posix_acl_chmod(mnt_userns, dentry, inode->i_mode);
        }
 
        return err;
index f4fc8e0..c7e8dd5 100644 (file)
@@ -85,13 +85,14 @@ retry:
        return acl;
 }
 
-int ceph_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+int ceph_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
                 struct posix_acl *acl, int type)
 {
        int ret = 0, size = 0;
        const char *name = NULL;
        char *value = NULL;
        struct iattr newattrs;
+       struct inode *inode = d_inode(dentry);
        struct timespec64 old_ctime = inode->i_ctime;
        umode_t new_mode = inode->i_mode, old_mode = inode->i_mode;
 
index 4af5e55..ca8aef9 100644 (file)
@@ -2255,7 +2255,7 @@ int ceph_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
        err = __ceph_setattr(inode, attr);
 
        if (err >= 0 && (attr->ia_valid & ATTR_MODE))
-               err = posix_acl_chmod(&init_user_ns, inode, attr->ia_mode);
+               err = posix_acl_chmod(&init_user_ns, dentry, attr->ia_mode);
 
        return err;
 }
index 40630e6..50e57a1 100644 (file)
@@ -1117,7 +1117,7 @@ void ceph_release_acl_sec_ctx(struct ceph_acl_sec_ctx *as_ctx);
 
 struct posix_acl *ceph_get_acl(struct inode *, int, bool);
 int ceph_set_acl(struct user_namespace *mnt_userns,
-                struct inode *inode, struct posix_acl *acl, int type);
+                struct dentry *dentry, struct posix_acl *acl, int type);
 int ceph_pre_init_acls(struct inode *dir, umode_t *mode,
                       struct ceph_acl_sec_ctx *as_ctx);
 void ceph_init_inode_acls(struct inode *inode,
index bf29896..440d5f1 100644 (file)
@@ -219,11 +219,12 @@ __ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
  * inode->i_mutex: down
  */
 int
-ext2_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+ext2_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
             struct posix_acl *acl, int type)
 {
        int error;
        int update_mode = 0;
+       struct inode *inode = d_inode(dentry);
        umode_t mode = inode->i_mode;
 
        if (type == ACL_TYPE_ACCESS && acl) {
index 925ab62..3841bec 100644 (file)
@@ -56,7 +56,7 @@ static inline int ext2_acl_count(size_t size)
 
 /* acl.c */
 extern struct posix_acl *ext2_get_acl(struct inode *inode, int type, bool rcu);
-extern int ext2_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+extern int ext2_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
                        struct posix_acl *acl, int type);
 extern int ext2_init_acl (struct inode *, struct inode *);
 
index 918ab2f..e97e77b 100644 (file)
@@ -1652,7 +1652,7 @@ int ext2_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
        }
        setattr_copy(&init_user_ns, inode, iattr);
        if (iattr->ia_valid & ATTR_MODE)
-               error = posix_acl_chmod(&init_user_ns, inode, inode->i_mode);
+               error = posix_acl_chmod(&init_user_ns, dentry, inode->i_mode);
        mark_inode_dirty(inode);
 
        return error;
index 57e82e2..a9f8953 100644 (file)
@@ -225,12 +225,13 @@ __ext4_set_acl(handle_t *handle, struct inode *inode, int type,
 }
 
 int
-ext4_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+ext4_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
             struct posix_acl *acl, int type)
 {
        handle_t *handle;
        int error, credits, retries = 0;
        size_t acl_size = acl ? ext4_acl_size(acl->a_count) : 0;
+       struct inode *inode = d_inode(dentry);
        umode_t mode = inode->i_mode;
        int update_mode = 0;
 
index 3219669..09c4a8a 100644 (file)
@@ -56,7 +56,7 @@ static inline int ext4_acl_count(size_t size)
 
 /* acl.c */
 struct posix_acl *ext4_get_acl(struct inode *inode, int type, bool rcu);
-int ext4_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+int ext4_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
                 struct posix_acl *acl, int type);
 extern int ext4_init_acl(handle_t *, struct inode *, struct inode *);
 
index 2b5ef1b..a8e12ce 100644 (file)
@@ -5550,7 +5550,7 @@ out_mmap_sem:
                ext4_orphan_del(NULL, inode);
 
        if (!error && (ia_valid & ATTR_MODE))
-               rc = posix_acl_chmod(mnt_userns, inode, inode->i_mode);
+               rc = posix_acl_chmod(mnt_userns, dentry, inode->i_mode);
 
 err_out:
        if  (error)
index 5bbc44a..c1c74aa 100644 (file)
@@ -276,9 +276,11 @@ static int __f2fs_set_acl(struct user_namespace *mnt_userns,
        return error;
 }
 
-int f2fs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+int f2fs_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
                 struct posix_acl *acl, int type)
 {
+       struct inode *inode = d_inode(dentry);
+
        if (unlikely(f2fs_cp_error(F2FS_I_SB(inode))))
                return -EIO;
 
index a26e33c..ea2bbb3 100644 (file)
@@ -34,7 +34,7 @@ struct f2fs_acl_header {
 #ifdef CONFIG_F2FS_FS_POSIX_ACL
 
 extern struct posix_acl *f2fs_get_acl(struct inode *, int, bool);
-extern int f2fs_set_acl(struct user_namespace *, struct inode *,
+extern int f2fs_set_acl(struct user_namespace *, struct dentry *,
                        struct posix_acl *, int);
 extern int f2fs_init_acl(struct inode *, struct inode *, struct page *,
                                                        struct page *);
index 82cda12..1223394 100644 (file)
@@ -1025,7 +1025,7 @@ int f2fs_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
        __setattr_copy(mnt_userns, inode, attr);
 
        if (attr->ia_valid & ATTR_MODE) {
-               err = posix_acl_chmod(mnt_userns, inode, f2fs_get_inode_mode(inode));
+               err = posix_acl_chmod(mnt_userns, dentry, f2fs_get_inode_mode(inode));
 
                if (is_inode_flag_set(inode, FI_ACL_MODE)) {
                        if (!err)
index 337cb29..8edd0f3 100644 (file)
@@ -53,9 +53,10 @@ struct posix_acl *fuse_get_acl(struct inode *inode, int type, bool rcu)
        return acl;
 }
 
-int fuse_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+int fuse_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
                 struct posix_acl *acl, int type)
 {
+       struct inode *inode = d_inode(dentry);
        struct fuse_conn *fc = get_fuse_conn(inode);
        const char *name;
        int ret;
index 98a9cf5..26a7c52 100644 (file)
@@ -1269,7 +1269,7 @@ extern const struct xattr_handler *fuse_no_acl_xattr_handlers[];
 
 struct posix_acl;
 struct posix_acl *fuse_get_acl(struct inode *inode, int type, bool rcu);
-int fuse_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+int fuse_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
                 struct posix_acl *acl, int type);
 
 /* readdir.c */
index 734d1f0..3dcde49 100644 (file)
@@ -109,9 +109,10 @@ out:
        return error;
 }
 
-int gfs2_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+int gfs2_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
                 struct posix_acl *acl, int type)
 {
+       struct inode *inode = d_inode(dentry);
        struct gfs2_inode *ip = GFS2_I(inode);
        struct gfs2_holder gh;
        bool need_unlock = false;
index cd180ca..b8de8c1 100644 (file)
@@ -13,7 +13,7 @@
 
 extern struct posix_acl *gfs2_get_acl(struct inode *inode, int type, bool rcu);
 extern int __gfs2_set_acl(struct inode *inode, struct posix_acl *acl, int type);
-extern int gfs2_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+extern int gfs2_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
                        struct posix_acl *acl, int type);
 
 #endif /* __ACL_DOT_H__ */
index 04a2015..314b9ce 100644 (file)
@@ -1997,7 +1997,7 @@ static int gfs2_setattr(struct user_namespace *mnt_userns,
        else {
                error = gfs2_setattr_simple(inode, attr);
                if (!error && attr->ia_valid & ATTR_MODE)
-                       error = posix_acl_chmod(&init_user_ns, inode,
+                       error = posix_acl_chmod(&init_user_ns, dentry,
                                                inode->i_mode);
        }
 
index e945e34..8bb58ce 100644 (file)
@@ -229,10 +229,11 @@ static int __jffs2_set_acl(struct inode *inode, int xprefix, struct posix_acl *a
        return rc;
 }
 
-int jffs2_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+int jffs2_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
                  struct posix_acl *acl, int type)
 {
        int rc, xprefix;
+       struct inode *inode = d_inode(dentry);
 
        switch (type) {
        case ACL_TYPE_ACCESS:
index 9d9fb7c..ca36a6e 100644 (file)
@@ -28,7 +28,7 @@ struct jffs2_acl_header {
 #ifdef CONFIG_JFFS2_FS_POSIX_ACL
 
 struct posix_acl *jffs2_get_acl(struct inode *inode, int type, bool rcu);
-int jffs2_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+int jffs2_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
                  struct posix_acl *acl, int type);
 extern int jffs2_init_acl_pre(struct inode *, struct inode *, umode_t *);
 extern int jffs2_init_acl_post(struct inode *);
index 39cec28..66af51c 100644 (file)
@@ -202,7 +202,7 @@ int jffs2_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
 
        rc = jffs2_do_setattr(inode, iattr);
        if (!rc && (iattr->ia_valid & ATTR_MODE))
-               rc = posix_acl_chmod(&init_user_ns, inode, inode->i_mode);
+               rc = posix_acl_chmod(&init_user_ns, dentry, inode->i_mode);
 
        return rc;
 }
index a653f34..3b667ec 100644 (file)
@@ -94,12 +94,13 @@ out:
        return rc;
 }
 
-int jfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+int jfs_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
                struct posix_acl *acl, int type)
 {
        int rc;
        tid_t tid;
        int update_mode = 0;
+       struct inode *inode = d_inode(dentry);
        umode_t mode = inode->i_mode;
 
        tid = txBegin(inode->i_sb, 0);
index 332dc9a..e3eb9c3 100644 (file)
@@ -123,7 +123,7 @@ int jfs_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
        mark_inode_dirty(inode);
 
        if (iattr->ia_valid & ATTR_MODE)
-               rc = posix_acl_chmod(&init_user_ns, inode, inode->i_mode);
+               rc = posix_acl_chmod(&init_user_ns, dentry, inode->i_mode);
        return rc;
 }
 
index 3de4028..f0704a2 100644 (file)
@@ -8,7 +8,7 @@
 #ifdef CONFIG_JFS_POSIX_ACL
 
 struct posix_acl *jfs_get_acl(struct inode *inode, int type, bool rcu);
-int jfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+int jfs_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
                struct posix_acl *acl, int type);
 int jfs_init_acl(tid_t, struct inode *, struct inode *);
 
index b2fc85d..2466edc 100644 (file)
@@ -2956,7 +2956,7 @@ int smb2_open(struct ksmbd_work *work)
                struct inode *inode = d_inode(path.dentry);
 
                posix_acl_rc = ksmbd_vfs_inherit_posix_acl(user_ns,
-                                                          inode,
+                                                          path.dentry,
                                                           d_inode(path.dentry->d_parent));
                if (posix_acl_rc)
                        ksmbd_debug(SMB, "inherit posix acl failed : %d\n", posix_acl_rc);
@@ -2972,7 +2972,7 @@ int smb2_open(struct ksmbd_work *work)
                        if (rc) {
                                if (posix_acl_rc)
                                        ksmbd_vfs_set_init_posix_acl(user_ns,
-                                                                    inode);
+                                                                    path.dentry);
 
                                if (test_share_config_flag(work->tcon->share_conf,
                                                           KSMBD_SHARE_FLAG_ACL_XATTR)) {
index b05ff9b..a1e05fe 100644 (file)
@@ -1386,14 +1386,14 @@ int set_info_sec(struct ksmbd_conn *conn, struct ksmbd_tree_connect *tcon,
        ksmbd_vfs_remove_acl_xattrs(user_ns, path->dentry);
        /* Update posix acls */
        if (IS_ENABLED(CONFIG_FS_POSIX_ACL) && fattr.cf_dacls) {
-               rc = set_posix_acl(user_ns, inode,
+               rc = set_posix_acl(user_ns, path->dentry,
                                   ACL_TYPE_ACCESS, fattr.cf_acls);
                if (rc < 0)
                        ksmbd_debug(SMB,
                                    "Set posix acl(ACL_TYPE_ACCESS) failed, rc : %d\n",
                                    rc);
                if (S_ISDIR(inode->i_mode) && fattr.cf_dacls) {
-                       rc = set_posix_acl(user_ns, inode,
+                       rc = set_posix_acl(user_ns, path->dentry,
                                           ACL_TYPE_DEFAULT, fattr.cf_dacls);
                        if (rc)
                                ksmbd_debug(SMB,
index 8de970d..7dee8b7 100644 (file)
@@ -1824,10 +1824,11 @@ void ksmbd_vfs_posix_lock_unblock(struct file_lock *flock)
 }
 
 int ksmbd_vfs_set_init_posix_acl(struct user_namespace *user_ns,
-                                struct inode *inode)
+                                struct dentry *dentry)
 {
        struct posix_acl_state acl_state;
        struct posix_acl *acls;
+       struct inode *inode = d_inode(dentry);
        int rc;
 
        if (!IS_ENABLED(CONFIG_FS_POSIX_ACL))
@@ -1856,14 +1857,13 @@ int ksmbd_vfs_set_init_posix_acl(struct user_namespace *user_ns,
                return -ENOMEM;
        }
        posix_state_to_acl(&acl_state, acls->a_entries);
-       rc = set_posix_acl(user_ns, inode, ACL_TYPE_ACCESS, acls);
+       rc = set_posix_acl(user_ns, dentry, ACL_TYPE_ACCESS, acls);
        if (rc < 0)
                ksmbd_debug(SMB, "Set posix acl(ACL_TYPE_ACCESS) failed, rc : %d\n",
                            rc);
        else if (S_ISDIR(inode->i_mode)) {
                posix_state_to_acl(&acl_state, acls->a_entries);
-               rc = set_posix_acl(user_ns, inode, ACL_TYPE_DEFAULT,
-                                  acls);
+               rc = set_posix_acl(user_ns, dentry, ACL_TYPE_DEFAULT, acls);
                if (rc < 0)
                        ksmbd_debug(SMB, "Set posix acl(ACL_TYPE_DEFAULT) failed, rc : %d\n",
                                    rc);
@@ -1874,10 +1874,11 @@ int ksmbd_vfs_set_init_posix_acl(struct user_namespace *user_ns,
 }
 
 int ksmbd_vfs_inherit_posix_acl(struct user_namespace *user_ns,
-                               struct inode *inode, struct inode *parent_inode)
+                               struct dentry *dentry, struct inode *parent_inode)
 {
        struct posix_acl *acls;
        struct posix_acl_entry *pace;
+       struct inode *inode = d_inode(dentry);
        int rc, i;
 
        if (!IS_ENABLED(CONFIG_FS_POSIX_ACL))
@@ -1895,12 +1896,12 @@ int ksmbd_vfs_inherit_posix_acl(struct user_namespace *user_ns,
                }
        }
 
-       rc = set_posix_acl(user_ns, inode, ACL_TYPE_ACCESS, acls);
+       rc = set_posix_acl(user_ns, dentry, ACL_TYPE_ACCESS, acls);
        if (rc < 0)
                ksmbd_debug(SMB, "Set posix acl(ACL_TYPE_ACCESS) failed, rc : %d\n",
                            rc);
        if (S_ISDIR(inode->i_mode)) {
-               rc = set_posix_acl(user_ns, inode, ACL_TYPE_DEFAULT,
+               rc = set_posix_acl(user_ns, dentry, ACL_TYPE_DEFAULT,
                                   acls);
                if (rc < 0)
                        ksmbd_debug(SMB, "Set posix acl(ACL_TYPE_DEFAULT) failed, rc : %d\n",
index 593059c..0d73d73 100644 (file)
@@ -160,8 +160,8 @@ int ksmbd_vfs_get_dos_attrib_xattr(struct user_namespace *user_ns,
                                   struct dentry *dentry,
                                   struct xattr_dos_attrib *da);
 int ksmbd_vfs_set_init_posix_acl(struct user_namespace *user_ns,
-                                struct inode *inode);
+                                struct dentry *dentry);
 int ksmbd_vfs_inherit_posix_acl(struct user_namespace *user_ns,
-                               struct inode *inode,
+                               struct dentry *dentry,
                                struct inode *parent_inode);
 #endif /* __KSMBD_VFS_H__ */
index 03a4e67..df9ca56 100644 (file)
@@ -12,7 +12,7 @@
  */
 #ifdef CONFIG_NFS_V3_ACL
 extern struct posix_acl *nfs3_get_acl(struct inode *inode, int type, bool rcu);
-extern int nfs3_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+extern int nfs3_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
                        struct posix_acl *acl, int type);
 extern int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
                struct posix_acl *dfacl);
index 93de0b5..22890d9 100644 (file)
@@ -255,10 +255,11 @@ int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
 
 }
 
-int nfs3_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+int nfs3_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
                 struct posix_acl *acl, int type)
 {
        struct posix_acl *orig = acl, *dfacl = NULL, *alloc;
+       struct inode *inode = d_inode(dentry);
        int status;
 
        if (S_ISDIR(inode->i_mode)) {
index 13e6e68..b183963 100644 (file)
@@ -113,11 +113,11 @@ static __be32 nfsacld_proc_setacl(struct svc_rqst *rqstp)
 
        inode_lock(inode);
 
-       error = set_posix_acl(&init_user_ns, inode, ACL_TYPE_ACCESS,
+       error = set_posix_acl(&init_user_ns, fh->fh_dentry, ACL_TYPE_ACCESS,
                              argp->acl_access);
        if (error)
                goto out_drop_lock;
-       error = set_posix_acl(&init_user_ns, inode, ACL_TYPE_DEFAULT,
+       error = set_posix_acl(&init_user_ns, fh->fh_dentry, ACL_TYPE_DEFAULT,
                              argp->acl_default);
        if (error)
                goto out_drop_lock;
index 2fb9ee3..da4a0d0 100644 (file)
@@ -103,11 +103,11 @@ static __be32 nfsd3_proc_setacl(struct svc_rqst *rqstp)
 
        inode_lock(inode);
 
-       error = set_posix_acl(&init_user_ns, inode, ACL_TYPE_ACCESS,
+       error = set_posix_acl(&init_user_ns, fh->fh_dentry, ACL_TYPE_ACCESS,
                              argp->acl_access);
        if (error)
                goto out_drop_lock;
-       error = set_posix_acl(&init_user_ns, inode, ACL_TYPE_DEFAULT,
+       error = set_posix_acl(&init_user_ns, fh->fh_dentry, ACL_TYPE_DEFAULT,
                              argp->acl_default);
 
 out_drop_lock:
index f650afe..4eded07 100644 (file)
@@ -480,12 +480,12 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp,
                        attr->na_seclabel->data, attr->na_seclabel->len);
        if (IS_ENABLED(CONFIG_FS_POSIX_ACL) && attr->na_pacl)
                attr->na_aclerr = set_posix_acl(&init_user_ns,
-                                               inode, ACL_TYPE_ACCESS,
+                                               dentry, ACL_TYPE_ACCESS,
                                                attr->na_pacl);
        if (IS_ENABLED(CONFIG_FS_POSIX_ACL) &&
            !attr->na_aclerr && attr->na_dpacl && S_ISDIR(inode->i_mode))
                attr->na_aclerr = set_posix_acl(&init_user_ns,
-                                               inode, ACL_TYPE_DEFAULT,
+                                               dentry, ACL_TYPE_DEFAULT,
                                                attr->na_dpacl);
        inode_unlock(inode);
        if (size_change)
index 4f2ffc7..ee5101e 100644 (file)
@@ -802,7 +802,7 @@ int ntfs3_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
        setattr_copy(mnt_userns, inode, attr);
 
        if (mode != inode->i_mode) {
-               err = ntfs_acl_chmod(mnt_userns, inode);
+               err = ntfs_acl_chmod(mnt_userns, dentry);
                if (err)
                        goto out;
 
index 2c79122..a4d2928 100644 (file)
@@ -843,7 +843,7 @@ int ntfs_cmp_names_cpu(const struct cpu_str *uni1, const struct le_str *uni2,
 /* globals from xattr.c */
 #ifdef CONFIG_NTFS3_FS_POSIX_ACL
 struct posix_acl *ntfs_get_acl(struct inode *inode, int type, bool rcu);
-int ntfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+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,
                  struct inode *dir);
@@ -852,7 +852,7 @@ int ntfs_init_acl(struct user_namespace *mnt_userns, struct inode *inode,
 #define ntfs_set_acl NULL
 #endif
 
-int ntfs_acl_chmod(struct user_namespace *mnt_userns, struct inode *inode);
+int ntfs_acl_chmod(struct user_namespace *mnt_userns, struct dentry *dentry);
 int ntfs_permission(struct user_namespace *mnt_userns, struct inode *inode,
                    int mask);
 ssize_t ntfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
index 7de8718..aafe98e 100644 (file)
@@ -619,10 +619,10 @@ out:
 /*
  * ntfs_set_acl - inode_operations::set_acl
  */
-int ntfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+int ntfs_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
                 struct posix_acl *acl, int type)
 {
-       return ntfs_set_acl_ex(mnt_userns, inode, acl, type, false);
+       return ntfs_set_acl_ex(mnt_userns, d_inode(dentry), acl, type, false);
 }
 
 /*
@@ -664,8 +664,9 @@ int ntfs_init_acl(struct user_namespace *mnt_userns, struct inode *inode,
 /*
  * ntfs_acl_chmod - Helper for ntfs3_setattr().
  */
-int ntfs_acl_chmod(struct user_namespace *mnt_userns, struct inode *inode)
+int ntfs_acl_chmod(struct user_namespace *mnt_userns, struct dentry *dentry)
 {
+       struct inode *inode = d_inode(dentry);
        struct super_block *sb = inode->i_sb;
 
        if (!(sb->s_flags & SB_POSIXACL))
@@ -674,7 +675,7 @@ int ntfs_acl_chmod(struct user_namespace *mnt_userns, struct inode *inode)
        if (S_ISLNK(inode->i_mode))
                return -EOPNOTSUPP;
 
-       return posix_acl_chmod(mnt_userns, inode, inode->i_mode);
+       return posix_acl_chmod(mnt_userns, dentry, inode->i_mode);
 }
 
 /*
index 23a72a4..9f19cf9 100644 (file)
@@ -260,12 +260,13 @@ static int ocfs2_set_acl(handle_t *handle,
        return ret;
 }
 
-int ocfs2_iop_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+int ocfs2_iop_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
                      struct posix_acl *acl, int type)
 {
        struct buffer_head *bh = NULL;
        int status, had_lock;
        struct ocfs2_lock_holder oh;
+       struct inode *inode = d_inode(dentry);
 
        had_lock = ocfs2_inode_lock_tracker(inode, &bh, 1, &oh);
        if (had_lock < 0)
index 95a57c8..a897c4e 100644 (file)
@@ -17,7 +17,7 @@ struct ocfs2_acl_entry {
 };
 
 struct posix_acl *ocfs2_iop_get_acl(struct inode *inode, int type, bool rcu);
-int ocfs2_iop_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+int ocfs2_iop_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
                      struct posix_acl *acl, int type);
 extern int ocfs2_acl_chmod(struct inode *, struct buffer_head *);
 extern int ocfs2_init_acl(handle_t *, struct inode *, struct inode *,
index 0e2db84..c5da209 100644 (file)
@@ -118,12 +118,13 @@ out:
        return error;
 }
 
-int orangefs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+int orangefs_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
                     struct posix_acl *acl, int type)
 {
        int error;
        struct iattr iattr;
        int rc;
+       struct inode *inode = d_inode(dentry);
 
        memset(&iattr, 0, sizeof iattr);
 
@@ -152,7 +153,7 @@ int orangefs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
        rc = __orangefs_set_acl(inode, acl, type);
 
        if (!rc && (iattr.ia_valid == ATTR_MODE))
-               rc = __orangefs_setattr_mode(inode, &iattr);
+               rc = __orangefs_setattr_mode(dentry, &iattr);
 
        return rc;
 }
index 35788cd..825872d 100644 (file)
@@ -833,14 +833,15 @@ out:
        return ret;
 }
 
-int __orangefs_setattr_mode(struct inode *inode, struct iattr *iattr)
+int __orangefs_setattr_mode(struct dentry *dentry, struct iattr *iattr)
 {
        int ret;
+       struct inode *inode = d_inode(dentry);
 
        ret = __orangefs_setattr(inode, iattr);
        /* change mode on a file that has ACLs */
        if (!ret && (iattr->ia_valid & ATTR_MODE))
-               ret = posix_acl_chmod(&init_user_ns, inode, inode->i_mode);
+               ret = posix_acl_chmod(&init_user_ns, dentry, inode->i_mode);
        return ret;
 }
 
@@ -856,7 +857,7 @@ int orangefs_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
        ret = setattr_prepare(&init_user_ns, dentry, iattr);
        if (ret)
                goto out;
-       ret = __orangefs_setattr_mode(d_inode(dentry), iattr);
+       ret = __orangefs_setattr_mode(dentry, iattr);
        sync_inode_metadata(d_inode(dentry), 1);
 out:
        gossip_debug(GOSSIP_INODE_DEBUG, "orangefs_setattr: returning %d\n",
index 3298b15..55cd6d5 100644 (file)
@@ -107,7 +107,7 @@ extern const struct xattr_handler *orangefs_xattr_handlers[];
 
 extern struct posix_acl *orangefs_get_acl(struct inode *inode, int type, bool rcu);
 extern int orangefs_set_acl(struct user_namespace *mnt_userns,
-                           struct inode *inode, struct posix_acl *acl,
+                           struct dentry *dentry, struct posix_acl *acl,
                            int type);
 int __orangefs_set_acl(struct inode *inode, struct posix_acl *acl, int type);
 
@@ -361,7 +361,7 @@ struct inode *orangefs_new_inode(struct super_block *sb,
                              struct orangefs_object_kref *ref);
 
 int __orangefs_setattr(struct inode *, struct iattr *);
-int __orangefs_setattr_mode(struct inode *inode, struct iattr *iattr);
+int __orangefs_setattr_mode(struct dentry *dentry, struct iattr *iattr);
 int orangefs_setattr(struct user_namespace *, struct dentry *, struct iattr *);
 
 int orangefs_getattr(struct user_namespace *mnt_userns, const struct path *path,
index 74dc0f5..c4bc58a 100644 (file)
@@ -578,19 +578,20 @@ EXPORT_SYMBOL(__posix_acl_chmod);
  * posix_acl_chmod - chmod a posix acl
  *
  * @mnt_userns:        user namespace of the mount @inode was found from
- * @inode:     inode to check permissions on
+ * @dentry:    dentry to check permissions on
  * @mode:      the new mode of @inode
  *
- * If the inode has been found through an idmapped mount the user namespace of
+ * If the dentry has been found through an idmapped mount the user namespace of
  * the vfsmount must be passed through @mnt_userns. This function will then
  * take care to map the inode according to @mnt_userns before checking
  * permissions. On non-idmapped mounts or if permission checking is to be
  * performed on the raw inode simply passs init_user_ns.
  */
 int
- posix_acl_chmod(struct user_namespace *mnt_userns, struct inode *inode,
+ posix_acl_chmod(struct user_namespace *mnt_userns, struct dentry *dentry,
                    umode_t mode)
 {
+       struct inode *inode = d_inode(dentry);
        struct posix_acl *acl;
        int ret = 0;
 
@@ -609,7 +610,7 @@ int
        ret = __posix_acl_chmod(&acl, GFP_KERNEL, mode);
        if (ret)
                return ret;
-       ret = inode->i_op->set_acl(mnt_userns, inode, acl, ACL_TYPE_ACCESS);
+       ret = inode->i_op->set_acl(mnt_userns, dentry, acl, ACL_TYPE_ACCESS);
        posix_acl_release(acl);
        return ret;
 }
@@ -1139,9 +1140,11 @@ posix_acl_xattr_get(const struct xattr_handler *handler,
 }
 
 int
-set_posix_acl(struct user_namespace *mnt_userns, struct inode *inode,
+set_posix_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
              int type, struct posix_acl *acl)
 {
+       struct inode *inode = d_inode(dentry);
+
        if (!IS_POSIXACL(inode))
                return -EOPNOTSUPP;
        if (!inode->i_op->set_acl)
@@ -1157,14 +1160,14 @@ set_posix_acl(struct user_namespace *mnt_userns, struct inode *inode,
                if (ret)
                        return ret;
        }
-       return inode->i_op->set_acl(mnt_userns, inode, acl, type);
+       return inode->i_op->set_acl(mnt_userns, dentry, acl, type);
 }
 EXPORT_SYMBOL(set_posix_acl);
 
 static int
 posix_acl_xattr_set(const struct xattr_handler *handler,
                           struct user_namespace *mnt_userns,
-                          struct dentry *unused, struct inode *inode,
+                          struct dentry *dentry, struct inode *inode,
                           const char *name, const void *value, size_t size,
                           int flags)
 {
@@ -1186,7 +1189,7 @@ posix_acl_xattr_set(const struct xattr_handler *handler,
                if (IS_ERR(acl))
                        return PTR_ERR(acl);
        }
-       ret = set_posix_acl(mnt_userns, inode, handler->flags, acl);
+       ret = set_posix_acl(mnt_userns, dentry, handler->flags, acl);
        posix_acl_release(acl);
        return ret;
 }
@@ -1215,10 +1218,11 @@ const struct xattr_handler posix_acl_default_xattr_handler = {
 };
 EXPORT_SYMBOL_GPL(posix_acl_default_xattr_handler);
 
-int simple_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+int simple_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
                   struct posix_acl *acl, int type)
 {
        int error;
+       struct inode *inode = d_inode(dentry);
 
        if (type == ACL_TYPE_ACCESS) {
                error = posix_acl_update_mode(mnt_userns, inode,
index d9052b8..29c503a 100644 (file)
@@ -49,9 +49,9 @@ static inline int reiserfs_acl_count(size_t size)
 
 #ifdef CONFIG_REISERFS_FS_POSIX_ACL
 struct posix_acl *reiserfs_get_acl(struct inode *inode, int type, bool rcu);
-int reiserfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+int reiserfs_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
                     struct posix_acl *acl, int type);
-int reiserfs_acl_chmod(struct inode *inode);
+int reiserfs_acl_chmod(struct dentry *dentry);
 int reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
                                 struct inode *dir, struct dentry *dentry,
                                 struct inode *inode);
@@ -63,7 +63,7 @@ int reiserfs_cache_default_acl(struct inode *dir);
 #define reiserfs_get_acl NULL
 #define reiserfs_set_acl NULL
 
-static inline int reiserfs_acl_chmod(struct inode *inode)
+static inline int reiserfs_acl_chmod(struct dentry *dentry)
 {
        return 0;
 }
index b9580a6..c7d1fa5 100644 (file)
@@ -3404,7 +3404,7 @@ int reiserfs_setattr(struct user_namespace *mnt_userns, struct dentry *dentry,
 
        if (!error && reiserfs_posixacl(inode->i_sb)) {
                if (attr->ia_valid & ATTR_MODE)
-                       error = reiserfs_acl_chmod(inode);
+                       error = reiserfs_acl_chmod(dentry);
        }
 
 out:
index d6fcddc..966ba48 100644 (file)
@@ -18,7 +18,7 @@ static int __reiserfs_set_acl(struct reiserfs_transaction_handle *th,
 
 
 int
-reiserfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+reiserfs_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
                 struct posix_acl *acl, int type)
 {
        int error, error2;
@@ -26,6 +26,7 @@ reiserfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
        size_t jcreate_blocks;
        int size = acl ? posix_acl_xattr_size(acl->a_count) : 0;
        int update_mode = 0;
+       struct inode *inode = d_inode(dentry);
        umode_t mode = inode->i_mode;
 
        /*
@@ -396,13 +397,15 @@ int reiserfs_cache_default_acl(struct inode *inode)
 /*
  * Called under i_mutex
  */
-int reiserfs_acl_chmod(struct inode *inode)
+int reiserfs_acl_chmod(struct dentry *dentry)
 {
+       struct inode *inode = d_inode(dentry);
+
        if (IS_PRIVATE(inode))
                return 0;
        if (get_inode_sd_version(inode) == STAT_DATA_V1 ||
            !reiserfs_posixacl(inode->i_sb))
                return 0;
 
-       return posix_acl_chmod(&init_user_ns, inode, inode->i_mode);
+       return posix_acl_chmod(&init_user_ns, dentry, inode->i_mode);
 }
index b744c62..a05f44e 100644 (file)
@@ -242,12 +242,13 @@ xfs_acl_set_mode(
 }
 
 int
-xfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+xfs_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
            struct posix_acl *acl, int type)
 {
        umode_t mode;
        bool set_mode = false;
        int error = 0;
+       struct inode *inode = d_inode(dentry);
 
        if (!acl)
                goto set_acl;
index 263404d..dcd1761 100644 (file)
@@ -11,7 +11,7 @@ struct posix_acl;
 
 #ifdef CONFIG_XFS_POSIX_ACL
 extern struct posix_acl *xfs_get_acl(struct inode *inode, int type, bool rcu);
-extern int xfs_set_acl(struct user_namespace *mnt_userns, struct inode *inode,
+extern int xfs_set_acl(struct user_namespace *mnt_userns, struct dentry *dentry,
                       struct posix_acl *acl, int type);
 extern int __xfs_set_acl(struct inode *inode, struct posix_acl *acl, int type);
 void xfs_forget_acl(struct inode *inode, const char *name);
index 2e10e1c..ab266ba 100644 (file)
@@ -651,6 +651,7 @@ xfs_vn_change_ok(
 static int
 xfs_setattr_nonsize(
        struct user_namespace   *mnt_userns,
+       struct dentry           *dentry,
        struct xfs_inode        *ip,
        struct iattr            *iattr)
 {
@@ -757,7 +758,7 @@ xfs_setattr_nonsize(
         *           Posix ACL code seems to care about this issue either.
         */
        if (mask & ATTR_MODE) {
-               error = posix_acl_chmod(mnt_userns, inode, inode->i_mode);
+               error = posix_acl_chmod(mnt_userns, dentry, inode->i_mode);
                if (error)
                        return error;
        }
@@ -779,6 +780,7 @@ out_dqrele:
 STATIC int
 xfs_setattr_size(
        struct user_namespace   *mnt_userns,
+       struct dentry           *dentry,
        struct xfs_inode        *ip,
        struct iattr            *iattr)
 {
@@ -810,7 +812,7 @@ xfs_setattr_size(
                 * Use the regular setattr path to update the timestamps.
                 */
                iattr->ia_valid &= ~ATTR_SIZE;
-               return xfs_setattr_nonsize(mnt_userns, ip, iattr);
+               return xfs_setattr_nonsize(mnt_userns, dentry, ip, iattr);
        }
 
        /*
@@ -987,7 +989,7 @@ xfs_vn_setattr_size(
        error = xfs_vn_change_ok(mnt_userns, dentry, iattr);
        if (error)
                return error;
-       return xfs_setattr_size(mnt_userns, ip, iattr);
+       return xfs_setattr_size(mnt_userns, dentry, ip, iattr);
 }
 
 STATIC int
@@ -1019,7 +1021,7 @@ xfs_vn_setattr(
 
                error = xfs_vn_change_ok(mnt_userns, dentry, iattr);
                if (!error)
-                       error = xfs_setattr_nonsize(mnt_userns, ip, iattr);
+                       error = xfs_setattr_nonsize(mnt_userns, dentry, ip, iattr);
        }
 
        return error;
index e654435..3db0b23 100644 (file)
@@ -2172,7 +2172,7 @@ struct inode_operations {
                           umode_t create_mode);
        int (*tmpfile) (struct user_namespace *, struct inode *,
                        struct file *, umode_t);
-       int (*set_acl)(struct user_namespace *, struct inode *,
+       int (*set_acl)(struct user_namespace *, struct dentry *,
                       struct posix_acl *, int);
        int (*fileattr_set)(struct user_namespace *mnt_userns,
                            struct dentry *dentry, struct fileattr *fa);
index 7d1e604..cd16a75 100644 (file)
@@ -69,21 +69,21 @@ extern int __posix_acl_create(struct posix_acl **, gfp_t, umode_t *);
 extern int __posix_acl_chmod(struct posix_acl **, gfp_t, umode_t);
 
 extern struct posix_acl *get_posix_acl(struct inode *, int);
-extern int set_posix_acl(struct user_namespace *, struct inode *, int,
-                        struct posix_acl *);
+int set_posix_acl(struct user_namespace *, struct dentry *, int,
+                 struct posix_acl *);
 
 struct posix_acl *get_cached_acl_rcu(struct inode *inode, int type);
 struct posix_acl *posix_acl_clone(const struct posix_acl *acl, gfp_t flags);
 
 #ifdef CONFIG_FS_POSIX_ACL
-int posix_acl_chmod(struct user_namespace *, struct inode *, umode_t);
+int posix_acl_chmod(struct user_namespace *, struct dentry *, umode_t);
 extern int posix_acl_create(struct inode *, umode_t *, struct posix_acl **,
                struct posix_acl **);
 int posix_acl_update_mode(struct user_namespace *, struct inode *, umode_t *,
                          struct posix_acl **);
 
-extern int simple_set_acl(struct user_namespace *, struct inode *,
-                         struct posix_acl *, int);
+int simple_set_acl(struct user_namespace *, struct dentry *,
+                  struct posix_acl *, int);
 extern int simple_acl_create(struct inode *, struct inode *);
 
 struct posix_acl *get_cached_acl(struct inode *inode, int type);
@@ -101,7 +101,7 @@ static inline void cache_no_acl(struct inode *inode)
 }
 #else
 static inline int posix_acl_chmod(struct user_namespace *mnt_userns,
-                                 struct inode *inode, umode_t mode)
+                                 struct dentry *dentry, umode_t mode)
 {
        return 0;
 }
index 8280a5c..b9255c1 100644 (file)
@@ -1121,7 +1121,7 @@ static int shmem_setattr(struct user_namespace *mnt_userns,
 
        setattr_copy(&init_user_ns, inode, attr);
        if (attr->ia_valid & ATTR_MODE)
-               error = posix_acl_chmod(&init_user_ns, inode, inode->i_mode);
+               error = posix_acl_chmod(&init_user_ns, dentry, inode->i_mode);
        if (!error && update_ctime) {
                inode->i_ctime = current_time(inode);
                if (update_mtime)