The dedicated check for a readonly filesystem can be removed
in sys_utimensat(), because it is part of vn_access(). The commit
also fixes a leak of reference to the dentry in case of an error.
Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Rares Miculescu <miculescur@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #865
UK_ASSERT(dp);
}
- if (dp->d_mount->m_flags & MNT_RDONLY) {
- error = EROFS;
- } else {
- if (vn_access(dp->d_vnode, VWRITE)) {
- return EACCES;
- }
- error = vn_settimes(dp->d_vnode, timespec_times);
- }
+ error = vn_access(dp->d_vnode, VWRITE);
+ if (unlikely(error))
+ goto exit_rel;
+
+ error = vn_settimes(dp->d_vnode, timespec_times);
exit_rel:
if (fp)