send attributes to osts when truncate and utimes
(not only when setting times to past)
i=vitaly
if (ia_valid & ATTR_SIZE)
attr->ia_valid |= ATTR_SIZE;
if (ia_valid & ATTR_SIZE)
attr->ia_valid |= ATTR_SIZE;
- if ((ia_valid & ATTR_SIZE) |
- ((ia_valid | ATTR_ATIME | ATTR_ATIME_SET) &&
- LTIME_S(attr->ia_atime) < LTIME_S(attr->ia_ctime)) ||
- ((ia_valid | ATTR_MTIME | ATTR_MTIME_SET) &&
- LTIME_S(attr->ia_mtime) < LTIME_S(attr->ia_ctime)))
- /* perform truncate and setting mtime/atime to past under PW
- * 0:EOF extent lock (new_size:EOF for truncate) */
+ if ((ia_valid & ATTR_SIZE) ||
+ (ia_valid | ATTR_ATIME | ATTR_ATIME_SET) ||
+ (ia_valid | ATTR_MTIME | ATTR_MTIME_SET))
+ /* on truncate and utimes send attributes to osts, setting
+ * mtime/atime to past will be performed under PW 0:EOF extent
+ * lock (new_size:EOF for truncate)
+ * it may seem excessive to send mtime/atime updates to osts
+ * when not setting times to past, but it is necessary due to
+ * possible time de-synchronization */
rc = cl_setattr_ost(inode, attr, NULL);
EXIT;
out:
rc = cl_setattr_ost(inode, attr, NULL);
EXIT;
out:
if (ia_valid & ATTR_SIZE)
attr->ia_valid |= ATTR_SIZE;
if (ia_valid & ATTR_SIZE)
attr->ia_valid |= ATTR_SIZE;
- if ((ia_valid & ATTR_SIZE) |
- ((ia_valid | ATTR_ATIME | ATTR_ATIME_SET) &&
- LTIME_S(attr->ia_atime) < LTIME_S(attr->ia_ctime)) ||
- ((ia_valid | ATTR_MTIME | ATTR_MTIME_SET) &&
- LTIME_S(attr->ia_mtime) < LTIME_S(attr->ia_ctime)))
- /* perform truncate and setting mtime/atime to past under PW
- * 0:EOF extent lock (new_size:EOF for truncate) */
+ if ((ia_valid & ATTR_SIZE) ||
+ (ia_valid | ATTR_ATIME | ATTR_ATIME_SET) ||
+ (ia_valid | ATTR_MTIME | ATTR_MTIME_SET))
+ /* on truncate and utimes send attributes to osts, setting
+ * mtime/atime to past will be performed under PW 0:EOF extent
+ * lock (new_size:EOF for truncate)
+ * it may seem excessive to send mtime/atime updates to osts
+ * when not setting times to past, but it is necessary due to
+ * possible time de-synchronization */
rc = ll_setattr_ost(inode, attr);
EXIT;
out:
rc = ll_setattr_ost(inode, attr);
EXIT;
out:
if (new_size == 0)
enqflags = CEF_DISCARD_DATA;
} else {
if (new_size == 0)
enqflags = CEF_DISCARD_DATA;
} else {
- LASSERT((io->u.ci_setattr.sa_attr.lvb_mtime <
- io->u.ci_setattr.sa_attr.lvb_ctime) ||
- (io->u.ci_setattr.sa_attr.lvb_atime <
- io->u.ci_setattr.sa_attr.lvb_ctime));
+ if ((io->u.ci_setattr.sa_attr.lvb_mtime >=
+ io->u.ci_setattr.sa_attr.lvb_ctime) ||
+ (io->u.ci_setattr.sa_attr.lvb_atime >=
+ io->u.ci_setattr.sa_attr.lvb_ctime))
+ return 0;
new_size = 0;
}
cio->u.setattr.cui_local_lock = SETATTR_EXTENT_LOCK;
new_size = 0;
}
cio->u.setattr.cui_local_lock = SETATTR_EXTENT_LOCK;
$OPENFILE -f O_CREAT:O_TRUNC:O_WRONLY $DIR/${tfile}2
if [ ! $DIR/${tfile}2 -nt $DIR/$tfile ]; then
echo "mtime"
$OPENFILE -f O_CREAT:O_TRUNC:O_WRONLY $DIR/${tfile}2
if [ ! $DIR/${tfile}2 -nt $DIR/$tfile ]; then
echo "mtime"
- ls -l $DIR/$tfile $DIR/${tfile}2
+ ls -l --full-time $DIR/$tfile $DIR/${tfile}2
- ls -lu $DIR/$tfile $DIR/${tfile}2
+ ls -lu --full-time $DIR/$tfile $DIR/${tfile}2
- ls -lc $DIR/$tfile $DIR/${tfile}2
+ ls -lc --full-time $DIR/$tfile $DIR/${tfile}2
error "O_TRUNC didn't change timestamps"
fi
}
error "O_TRUNC didn't change timestamps"
fi
}