Linux 4.9: inode_change_ok() becomes setattr_prepare() 18/12418/3
authorMark Vitale <mvitale@sinenomine.net>
Thu, 20 Oct 2016 04:49:37 +0000 (00:49 -0400)
committerBenjamin Kaduk <kaduk@mit.edu>
Wed, 26 Oct 2016 01:37:33 +0000 (21:37 -0400)
Linux commit 31051c85b5e2 "fs: Give dentry to inode_change_ok() instead
of inode" renames and modifies inode_change_ok(inode, attrs) to
setattr_prepare(dentry, attrs).

Modify OpenAFS to cope.

Change-Id: I72f8dfbdbd25d7c775e9c35116e323ea4359e95c
Reviewed-on: https://gerrit.openafs.org/12418
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

acinclude.m4
src/afs/LINUX/osi_file.c

index f8c8456..c46a120 100644 (file)
@@ -1082,6 +1082,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 AC_CHECK_LINUX_FUNC([set_nlink],
                                     [#include <linux/fs.h>],
                                     [set_nlink(NULL, 1);])
+                AC_CHECK_LINUX_FUNC([setattr_prepare],
+                                    [#include <linux/fs.h>],
+                                    [setattr_prepare(NULL, NULL);])
                 AC_CHECK_LINUX_FUNC([sock_create_kern],
                                     [#include <linux/net.h>],
                                     [sock_create_kern(0, 0, 0, NULL);])
index c125c1c..e211c05 100644 (file)
@@ -183,7 +183,11 @@ osi_UFSTruncate(struct osi_file *afile, afs_int32 asize)
     newattrs.ia_ctime = CURRENT_TIME;
 
     /* avoid notify_change() since it wants to update dentry->d_parent */
+#ifdef HAVE_LINUX_SETATTR_PREPARE
+    code = setattr_prepare(file_dentry(afile->filp), &newattrs);
+#else
     code = inode_change_ok(inode, &newattrs);
+#endif
     if (!code)
        code = afs_inode_setattr(afile, &newattrs);
     if (!code)