From a373f0b7461158c8f17bad9a5d0511d67c765a0a Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Wed, 17 Apr 2013 17:39:09 -0500 Subject: [PATCH] Revert "LINUX: Avoid duplicate mntget in afs_linux_raw_open" This reverts commit 5ccbbda19f11e7027300409c46715155f439424a. dentry_open, at least on older kernels, decs the refcount on its arguments in the case of an error. So calling mntget for each dentry_open invocation actually is the correct thing to do. This code may need to be further fixed in order to work for newer kernels, but for now, at least put it back the way it was so we don't undercount ref counts on older kernels. Change-Id: Ie5e064b065bc41321c1cea8e0272cc4ea697e3b5 Reviewed-on: http://gerrit.openafs.org/9800 Reviewed-by: Derrick Brashear Reviewed-by: Marc Dionne Tested-by: BuildBot --- src/afs/LINUX/osi_file.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/afs/LINUX/osi_file.c b/src/afs/LINUX/osi_file.c index b48bf1a6e..eacffca07 100644 --- a/src/afs/LINUX/osi_file.c +++ b/src/afs/LINUX/osi_file.c @@ -54,17 +54,13 @@ afs_linux_raw_open(afs_dcache_id_t *ainode) tip = dp->d_inode; tip->i_flags |= S_NOATIME; /* Disable updating access times. */ - /* note that if this is ever changed to recover from errors, we will need - * to put this reference back */ - mntget(afs_cacheMnt); - #if defined(STRUCT_TASK_STRUCT_HAS_CRED) /* Use stashed credentials - prevent selinux/apparmor problems */ - filp = afs_dentry_open(dp, afs_cacheMnt, O_RDWR, cache_creds); + filp = afs_dentry_open(dp, mntget(afs_cacheMnt), O_RDWR, cache_creds); if (IS_ERR(filp)) - filp = afs_dentry_open(dp, afs_cacheMnt, O_RDWR, current_cred()); + filp = afs_dentry_open(dp, mntget(afs_cacheMnt), O_RDWR, current_cred()); #else - filp = dentry_open(dp, afs_cacheMnt, O_RDWR); + filp = dentry_open(dp, mntget(afs_cacheMnt), O_RDWR); #endif if (IS_ERR(filp)) osi_Panic("Can't open file: %d\n", (int) PTR_ERR(filp)); -- 2.39.5