Skip to content

Commit d424187

Browse files
committed
zfs_netbsd_gop_markupdate: actually update file timestamp
the implementation before this commit was basically no-op. some notes: * this is (ab)used in zfs_netbsd_write for fifo/spec vnodes. i feel it's a bit excessive to update the timestamp on every writes to /dev/null. unfortunately, zfs doesn't have nodevmtime option. well, i suspect netbsd is the only os with the traditional devmtime behavior these days. we may want to implement delayed mtime update as ffs does. * this is used by zfs_netbsd_putpages via genfs_putpages. but it's redundant because zfs_putapage updates the timestamp as well. * this is not used by zfs_netbsd_getpages. zfs doesn't use genfs_getpages. zfs_netbsd_getpages doesn't have the corresponding logic either. maybe it's ok for most of applications as far as mtime will be updated sooner or later.
1 parent a18e172 commit d424187

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6237,6 +6237,8 @@ zfs_netbsd_gop_markupdate(vnode_t *vp, int flags)
62376237
KASSERT(flags == GOP_UPDATE_MODIFIED);
62386238

62396239
tx = dmu_tx_create(zfsvfs->z_os);
6240+
dmu_tx_hold_sa(tx, zp->z_sa_hdl, B_FALSE);
6241+
zfs_sa_upgrade_txholds(tx, zp);
62406242
err = dmu_tx_assign(tx, TXG_WAIT);
62416243
if (err != 0) {
62426244
dmu_tx_abort(tx);
@@ -6245,7 +6247,11 @@ zfs_netbsd_gop_markupdate(vnode_t *vp, int flags)
62456247
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_MTIME(zfsvfs), NULL, &mtime, 16);
62466248
SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_CTIME(zfsvfs), NULL, &ctime, 16);
62476249
zfs_tstamp_update_setup(zp, CONTENT_MODIFIED, mtime, ctime, B_TRUE);
6250+
err = sa_bulk_update(zp->z_sa_hdl, bulk, count, tx);
62486251
dmu_tx_commit(tx);
6252+
if (err != 0) {
6253+
printf("%s: sa_bulk_update failed with %d\n", __func__, err);
6254+
}
62496255
}
62506256

62516257
static int

0 commit comments

Comments
 (0)