From 252b3bcc75ea141ff93a7b3147865f4b952fcaca Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Fri, 24 Aug 2018 13:03:24 -0500 Subject: [PATCH] afs: Detect VIOCPREFETCH special case properly Currently, afs_syscall_pioctl handles the VIOCPREFETCH pioctl as a special case, calling into a different code path to handle backgrounding the prefetch operation. However, we detect that we're handling a VIOCPREFETCH operation just by looking at the lower 8 bits of the given opcode. This means that any pioctl that ends in 0x0F will trigger this codepath, such as if we add a 'C' or 'O' pioctl that uses code 0x0F. We only want to catch VIOCPREFETCH requests for this code path, so fix the check to also check if we're processing a 'V' pioctl. Change-Id: Ica8c2364f96aa3c8b4d2213bebd9a1e4cb6fa730 Reviewed-on: https://gerrit.openafs.org/13301 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot --- src/afs/afs_pioctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c index eee4d88dd1..1f36540e87 100644 --- a/src/afs/afs_pioctl.c +++ b/src/afs/afs_pioctl.c @@ -1119,7 +1119,9 @@ afs_syscall_pioctl(char *path, unsigned int com, caddr_t cmarg, int follow) #endif } #endif /* AFS_NEED_CLIENTCONTEXT */ - if ((com & 0xff) == 15) { + + /* VIOCPREFETCH */ + if ((com & 0xff00) >> 8 == 'V' && (com & 0xff) == 15) { /* special case prefetch so entire pathname eval occurs in helper process. * otherwise, the pioctl call is essentially useless */ #if defined(AFS_SUN5_ENV) || defined(AFS_AIX41_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)