mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 23:10:58 +00:00
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 <marc.c.dionne@gmail.com> Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
parent
bd95ded9cf
commit
d6d82659d0
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user