Skip to content

Commit

Permalink
Linux 4.9 compat: change inode_change_ok to setattr_prepare
Browse files Browse the repository at this point in the history
torvalds/linux@31051c8
inode_change_ok is changed to setattr_prepare and takes dentry

Signed-off-by: Chunwei Chen <[email protected]>
Requires-spl: refs/pull/581/head
  • Loading branch information
Chunwei Chen committed Oct 19, 2016
1 parent dc1bb65 commit 854a364
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
17 changes: 17 additions & 0 deletions config/kernel-setattr-prepare.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
dnl #
dnl # 4.9 API change,
dnl # inode_change_ok is changed to setattr_prepare and takes dentry
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SETATTR_PREPARE], [
AC_MSG_CHECKING([whether setattr_prepare() exists])
ZFS_LINUX_TRY_COMPILE([
#include <linux/fs.h>
],[
setattr_prepare(NULL, NULL);
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SETATTR_PREPARE, 1, [setattr_prepare() exists])
],[
AC_MSG_RESULT(no)
])
])
1 change: 1 addition & 0 deletions config/kernel.m4
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
ZFS_AC_KERNEL_MODULE_PARAM_CALL_CONST
ZFS_AC_KERNEL_RENAME_WANTS_FLAGS
ZFS_AC_KERNEL_HAVE_GENERIC_SETXATTR
ZFS_AC_KERNEL_SETATTR_PREPARE
AS_IF([test "$LINUX_OBJ" != "$LINUX"], [
KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
Expand Down
11 changes: 11 additions & 0 deletions include/linux/vfs_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -444,4 +444,15 @@ static inline void zfs_gid_write(struct inode *ip, gid_t gid)
#define zpl_follow_up(path) follow_up(path)
#endif

/*
* 4.9 API change
* inode_change_ok is changed to setattr_prepare and takes dentry
*/
#ifndef HAVE_SETATTR_PREPARE
static inline int setattr_prepare(struct dentry *dentry, struct iattr *attr)
{
return (inode_change_ok(dentry->d_inode, attr));
}
#endif

#endif /* _ZFS_VFS_H */
2 changes: 1 addition & 1 deletion module/zfs/zpl_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ zpl_setattr(struct dentry *dentry, struct iattr *ia)
int error;
fstrans_cookie_t cookie;

error = inode_change_ok(ip, ia);
error = setattr_prepare(dentry, ia);
if (error)
return (error);

Expand Down

0 comments on commit 854a364

Please sign in to comment.