ZFS should update timestamps upon the creat() of an existing file.

Obtained from:	OpenSolaris
Bug:		http://bugs.opensolaris.org/view_bug.do?bug_id=6465105
This commit is contained in:
Pawel Jakub Dawidek 2007-05-02 00:18:22 +00:00
parent 6de6bff649
commit 0775674bbc
4 changed files with 10 additions and 4 deletions

View File

@ -23,6 +23,8 @@
* Use is subject to license terms.
*/
/* Portions Copyright 2007 Jeremy Teo */
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
@ -1280,7 +1282,6 @@ zfs_create(vnode_t *dvp, char *name, vattr_t *vap, int excl, int mode,
* Truncate regular files if requested.
*/
if ((ZTOV(zp)->v_type == VREG) &&
(zp->z_phys->zp_size != 0) &&
(vap->va_mask & AT_SIZE) && (vap->va_size == 0)) {
error = zfs_freesp(zp, 0, 0, mode, TRUE);
if (error == ERESTART &&

View File

@ -23,6 +23,8 @@
* Use is subject to license terms.
*/
/* Portions Copyright 2007 Jeremy Teo */
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef _KERNEL
@ -830,7 +832,7 @@ zfs_freesp(znode_t *zp, uint64_t off, uint64_t len, int flag, boolean_t log)
* Nothing to do if file already at desired length.
*/
size = zp->z_phys->zp_size;
if (len == 0 && size == off) {
if (len == 0 && size == off && off != 0) {
zfs_range_unlock(rl);
return (0);
}

View File

@ -23,6 +23,8 @@
* Use is subject to license terms.
*/
/* Portions Copyright 2007 Jeremy Teo */
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
@ -1280,7 +1282,6 @@ zfs_create(vnode_t *dvp, char *name, vattr_t *vap, int excl, int mode,
* Truncate regular files if requested.
*/
if ((ZTOV(zp)->v_type == VREG) &&
(zp->z_phys->zp_size != 0) &&
(vap->va_mask & AT_SIZE) && (vap->va_size == 0)) {
error = zfs_freesp(zp, 0, 0, mode, TRUE);
if (error == ERESTART &&

View File

@ -23,6 +23,8 @@
* Use is subject to license terms.
*/
/* Portions Copyright 2007 Jeremy Teo */
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef _KERNEL
@ -830,7 +832,7 @@ zfs_freesp(znode_t *zp, uint64_t off, uint64_t len, int flag, boolean_t log)
* Nothing to do if file already at desired length.
*/
size = zp->z_phys->zp_size;
if (len == 0 && size == off) {
if (len == 0 && size == off && off != 0) {
zfs_range_unlock(rl);
return (0);
}