From: Simon Wilkinson Date: Thu, 24 Jun 2010 15:00:22 +0000 (+0100) Subject: Linux: Check return code from VerifyVCache in mmap X-Git-Tag: openafs-devel-1_5_75~77 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=f9c9b78a2c3e7167f22af6af813a3902af4e5e3d;p=packages%2Fo%2Fopenafs.git 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 --- diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 0e1850489..324820b12 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; }