From d6d82659d0b68aad201916b6323591ff497486f8 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Fri, 23 Apr 2010 16:54:39 +0100 Subject: [PATCH] Linux: Don't pass f_pos down to the filesystem In 2.6.8, Linux shifted from passing f_pos directly to the read and write routines, and started passing a copy. This helps reduce, but does not remove, the race issues with f_pos itself. Make this change for us. Take the opportunity to remove the uneccessary macros, and tidy up some casting. Change-Id: I3b4cdf1e6e8127cbe0055829605268953c4397a6 Reviewed-on: http://gerrit.openafs.org/1818 Reviewed-by: Marc Dionne Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/afs/LINUX/osi_file.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/afs/LINUX/osi_file.c b/src/afs/LINUX/osi_file.c index 8b2151ac1..ba6c87365 100644 --- a/src/afs/LINUX/osi_file.c +++ b/src/afs/LINUX/osi_file.c @@ -363,9 +363,6 @@ osi_InitCacheInfo(char *aname) } -#define FOP_READ(F, B, C) (F)->f_op->read(F, B, (size_t)(C), &(F)->f_pos) -#define FOP_WRITE(F, B, C) (F)->f_op->write(F, B, (size_t)(C), &(F)->f_pos) - /* osi_rdwr * seek, then read or write to an open inode. addrp points to data in * kernel space. @@ -377,8 +374,9 @@ osi_rdwr(struct osi_file *osifile, uio_t * uiop, int rw) KERNEL_SPACE_DECL; int code = 0; struct iovec *iov; - afs_size_t count; + size_t count; unsigned long savelim; + loff_t pos; savelim = current->TASK_STRUCT_RLIM[RLIMIT_FSIZE].rlim_cur; current->TASK_STRUCT_RLIM[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY; @@ -401,10 +399,12 @@ osi_rdwr(struct osi_file *osifile, uio_t * uiop, int rw) continue; } + pos = filp->f_pos; if (rw == UIO_READ) - code = FOP_READ(filp, iov->iov_base, count); + code = filp->f_op->read(filp, iov->iov_base, count, &pos); else - code = FOP_WRITE(filp, iov->iov_base, count); + code = filp->f_op->write(filp, iov->iov_base, count, &pos); + filp->f_pos = pos; if (code < 0) { code = -code; -- 2.39.5