mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-31 06:28:22 +00:00
vfs: redo locking
This commit is contained in:
@@ -32,6 +32,7 @@ syscallret_t syscall_utimensat(context_t *, int fd, char *upath, timespec_t uts[
|
||||
}
|
||||
|
||||
node = file->vnode;
|
||||
VOP_LOCK(node);
|
||||
VOP_HOLD(node);
|
||||
fd_release(file);
|
||||
} else {
|
||||
@@ -62,8 +63,10 @@ syscallret_t syscall_utimensat(context_t *, int fd, char *upath, timespec_t uts[
|
||||
|
||||
vattr_t attr;
|
||||
ret.errno = VOP_GETATTR(node, &attr, &_cpu()->thread->proc->cred);
|
||||
if (ret.errno)
|
||||
if (ret.errno) {
|
||||
VOP_UNLOCK(node);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
attr.atime = ts[0];
|
||||
attr.mtime = ts[1];
|
||||
@@ -73,12 +76,15 @@ syscallret_t syscall_utimensat(context_t *, int fd, char *upath, timespec_t uts[
|
||||
if (uts == NULL)
|
||||
ret.errno = VOP_ACCESS(node, V_ACCESS_WRITE, &_cpu()->thread->proc->cred);
|
||||
|
||||
if (ret.errno)
|
||||
if (ret.errno) {
|
||||
VOP_UNLOCK(node);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
ret.errno = VOP_SETATTR(node, &attr, V_ATTR_ATIME | V_ATTR_MTIME, &_cpu()->thread->proc->cred);
|
||||
ret.ret = ret.errno ? -1 : 0;
|
||||
VOP_UNLOCK(node);
|
||||
|
||||
cleanup:
|
||||
if (node)
|
||||
|
||||
Reference in New Issue
Block a user