diff --git a/acinclude.m4 b/acinclude.m4 index 44082c2e75..0a90e162e7 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1098,6 +1098,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) AC_CHECK_LINUX_FUNC([inode_nohighmem], [#include ], [inode_nohighmem(NULL);]) + AC_CHECK_LINUX_FUNC([inode_lock], + [#include ], + [inode_lock(NULL);]) dnl Consequences - things which get set as a result of the dnl above tests diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h index 5b3f12b8d8..9e2e22ab47 100644 --- a/src/afs/LINUX/osi_compat.h +++ b/src/afs/LINUX/osi_compat.h @@ -445,7 +445,9 @@ afs_init_sb_export_ops(struct super_block *sb) { static inline void afs_linux_lock_inode(struct inode *ip) { -#ifdef STRUCT_INODE_HAS_I_MUTEX +#if defined(HAVE_LINUX_INODE_LOCK) + inode_lock(ip); +#elif defined(STRUCT_INODE_HAS_I_MUTEX) mutex_lock(&ip->i_mutex); #else down(&ip->i_sem); @@ -454,7 +456,9 @@ afs_linux_lock_inode(struct inode *ip) { static inline void afs_linux_unlock_inode(struct inode *ip) { -#ifdef STRUCT_INODE_HAS_I_MUTEX +#if defined(HAVE_LINUX_INODE_LOCK) + inode_unlock(ip); +#elif defined(STRUCT_INODE_HAS_I_MUTEX) mutex_unlock(&ip->i_mutex); #else up(&ip->i_sem); diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index a82464cb7d..bcdfbde634 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -583,13 +583,13 @@ afs_linux_fsync(struct file *fp, int datasync) cred_t *credp = crref(); #if defined(FOP_FSYNC_TAKES_RANGE) - mutex_lock(&ip->i_mutex); + afs_linux_lock_inode(ip); #endif AFS_GLOCK(); code = afs_fsync(VTOAFS(ip), credp); AFS_GUNLOCK(); #if defined(FOP_FSYNC_TAKES_RANGE) - mutex_unlock(&ip->i_mutex); + afs_linux_unlock_inode(ip); #endif crfree(credp); return afs_convert_code(code);