From f9c9b78a2c3e7167f22af6af813a3902af4e5e3d Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Thu, 24 Jun 2010 16:00:22 +0100 Subject: [PATCH] Linux: Check return code from VerifyVCache in mmap afs_linux_mmap wasn't doing anything with the return code from afs_linux_VerifyVCache. Change the code so that it matches the other callers of afs_linux_VerifyVCache Change-Id: I83b949bf3b9579e5dd2e20b487862566c1d7c730 Reviewed-on: http://gerrit.openafs.org/2247 Reviewed-by: Marc Dionne Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/afs/LINUX/osi_vnodeops.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 0e18504893..324820b12a 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -379,16 +379,18 @@ afs_linux_mmap(struct file *fp, struct vm_area_struct *vmap) /* get a validated vcache entry */ code = afs_linux_VerifyVCache(vcp, NULL); - /* Linux's Flushpage implementation doesn't use credp, so optimise - * our code to not need to crref() it */ - osi_FlushPages(vcp, NULL); /* ensure stale pages are gone */ + if (code == 0) { + /* Linux's Flushpage implementation doesn't use credp, so optimise + * our code to not need to crref() it */ + osi_FlushPages(vcp, NULL); /* ensure stale pages are gone */ + AFS_GUNLOCK(); + code = generic_file_mmap(fp, vmap); + AFS_GLOCK(); + if (!code) + vcp->f.states |= CMAPPED; + } AFS_GUNLOCK(); - code = generic_file_mmap(fp, vmap); - AFS_GLOCK(); - if (!code) - vcp->f.states |= CMAPPED; - AFS_GUNLOCK(); return code; }