Suppose I want to create an atomic llseek+writev operation. Is this
more or less sufficient:
ssize_t ret = -EBADF;
file = fget_light(fd, &fput_needed);
if (file) {
if (unlikely(origin > 2)) {
ret = -EINVAL;
} else {
write_lock_irq(&file->f_owner.lock);
pos = vfs_llseek(file, ((loff_t) offset_high <<
32) | offset_low, origin);
ret = (ssize_t)pos;
if (likely(ret >= 0)) {
ret = vfs_writev(file, vec, vlen, &pos);
file_pos_write(file, pos);
}
write_unlock_irq(&file->f_owner.lock);
}
fput_light(file, fput_needed);
}
Or is this the wrong sort of lock to be using to protect against
having file->pos altered by another thread executing through the same
code?
Cheers,
- Michael
-
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Greg Kroah-Hartman | [PATCH 004/196] Chinese: add translation of SubmittingPatches |
| Artem Bityutskiy | [PATCH 18/44 take 2] [UBI] build unit implementation |
| James Morris | Re: LSM conversion to static interface |
git: | |
| Paul Jackson | [PATCH] cpuset sched_load_balance kmalloc fix |
| Gerrit Renker | [PATCH 15/37] dccp: Set per-connection CCIDs via socket options |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Linus Torvalds | Re: [GIT]: Networking |
