diff --git a/acinclude.m4 b/acinclude.m4 index 28d60f9b0e..05a933fd30 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -908,6 +908,10 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) [#include #include ], [path_lookup(NULL, 0, NULL);]) + AC_CHECK_LINUX_FUNC([putname], + [#include + #include ], + [putname(NULL);]) AC_CHECK_LINUX_FUNC([rcu_read_lock], [#include ], [rcu_read_lock();]) diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h index 0314a22d94..35eafc547d 100644 --- a/src/afs/LINUX/osi_compat.h +++ b/src/afs/LINUX/osi_compat.h @@ -524,4 +524,13 @@ afs_dentry_open(struct dentry *dp, struct vfsmount *mnt, int flags, const struct } #endif +static inline void +afs_putname(struct filename *name) { +#if defined(HAVE_LINUX_PUTNAME) + putname(name); +#else + kmem_cache_free(names_cachep, (void *)name); +#endif +} + #endif /* AFS_LINUX_OSI_COMPAT_H */ diff --git a/src/afs/LINUX/osi_misc.c b/src/afs/LINUX/osi_misc.c index 9a8ccbe18b..0fe7484092 100644 --- a/src/afs/LINUX/osi_misc.c +++ b/src/afs/LINUX/osi_misc.c @@ -93,7 +93,7 @@ osi_lookupname(char *aname, uio_seg_t seg, int followlink, } code = osi_lookupname_internal(tname, followlink, NULL, dpp); if (seg == AFS_UIOUSER) { - putname(tname); + afs_putname(tname); } return code; } @@ -129,7 +129,7 @@ int osi_abspath(char *aname, char *buf, int buflen, mntput(mnt); } - putname(tname); + afs_putname(tname); return code; }