diff options
| author | Mark J Musante <Mark.Musante@Sun.COM> | 2010-05-03 09:07:08 -0600 |
|---|---|---|
| committer | Mark J Musante <Mark.Musante@Sun.COM> | 2010-05-03 09:07:08 -0600 |
| commit | 55da60b91d96984f12de050ce428373ea25c7f35 (patch) | |
| tree | a7ed1a951a706f3fa3bd793cbdaf4b753f62e12c /usr/src/uts/common/fs/zfs/zfs_vfsops.c | |
| parent | d94ffb286aba68edc813c6eda61754891db7f7a1 (diff) | |
| download | illumos-joyent-55da60b91d96984f12de050ce428373ea25c7f35.tar.gz | |
PSARC/2010/108 zil synchronicity
6280630 zil synchronicity
Contributed by Robert Milkowski <milek@task.gda.pl>
Diffstat (limited to 'usr/src/uts/common/fs/zfs/zfs_vfsops.c')
| -rw-r--r-- | usr/src/uts/common/fs/zfs/zfs_vfsops.c | 67 |
1 files changed, 33 insertions, 34 deletions
diff --git a/usr/src/uts/common/fs/zfs/zfs_vfsops.c b/usr/src/uts/common/fs/zfs/zfs_vfsops.c index 237bff1285..da9163c963 100644 --- a/usr/src/uts/common/fs/zfs/zfs_vfsops.c +++ b/usr/src/uts/common/fs/zfs/zfs_vfsops.c @@ -22,6 +22,8 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. */ +/* Portions Copyright 2010 Robert Milkowski */ + #include <sys/types.h> #include <sys/param.h> #include <sys/systm.h> @@ -165,8 +167,7 @@ zfs_sync(vfs_t *vfsp, short flag, cred_t *cr) if (zfsvfs->z_log != NULL) zil_commit(zfsvfs->z_log, UINT64_MAX, 0); - else - txg_wait_synced(dp, 0); + ZFS_EXIT(zfsvfs); } else { /* @@ -1024,10 +1025,6 @@ zfsvfs_setup(zfsvfs_t *zfsvfs, boolean_t mounting) mutex_exit(&zfsvfs->z_os->os_user_ptr_lock); zfsvfs->z_log = zil_open(zfsvfs->z_os, zfs_get_data); - if (zil_disable) { - zil_destroy(zfsvfs->z_log, B_FALSE); - zfsvfs->z_log = NULL; - } /* * If we are not mounting (ie: online recv), then we don't @@ -1047,34 +1044,36 @@ zfsvfs_setup(zfsvfs_t *zfsvfs, boolean_t mounting) else zfs_unlinked_drain(zfsvfs); - if (zfsvfs->z_log) { - /* - * Parse and replay the intent log. - * - * Because of ziltest, this must be done after - * zfs_unlinked_drain(). (Further note: ziltest - * doesn't use readonly mounts, where - * zfs_unlinked_drain() isn't called.) This is because - * ziltest causes spa_sync() to think it's committed, - * but actually it is not, so the intent log contains - * many txg's worth of changes. - * - * In particular, if object N is in the unlinked set in - * the last txg to actually sync, then it could be - * actually freed in a later txg and then reallocated - * in a yet later txg. This would write a "create - * object N" record to the intent log. Normally, this - * would be fine because the spa_sync() would have - * written out the fact that object N is free, before - * we could write the "create object N" intent log - * record. - * - * But when we are in ziltest mode, we advance the "open - * txg" without actually spa_sync()-ing the changes to - * disk. So we would see that object N is still - * allocated and in the unlinked set, and there is an - * intent log record saying to allocate it. - */ + /* + * Parse and replay the intent log. + * + * Because of ziltest, this must be done after + * zfs_unlinked_drain(). (Further note: ziltest + * doesn't use readonly mounts, where + * zfs_unlinked_drain() isn't called.) This is because + * ziltest causes spa_sync() to think it's committed, + * but actually it is not, so the intent log contains + * many txg's worth of changes. + * + * In particular, if object N is in the unlinked set in + * the last txg to actually sync, then it could be + * actually freed in a later txg and then reallocated + * in a yet later txg. This would write a "create + * object N" record to the intent log. Normally, this + * would be fine because the spa_sync() would have + * written out the fact that object N is free, before + * we could write the "create object N" intent log + * record. + * + * But when we are in ziltest mode, we advance the "open + * txg" without actually spa_sync()-ing the changes to + * disk. So we would see that object N is still + * allocated and in the unlinked set, and there is an + * intent log record saying to allocate it. + */ + if (zil_replay_disable) { + zil_destroy(zfsvfs->z_log, B_FALSE); + } else { zfsvfs->z_replay = B_TRUE; zil_replay(zfsvfs->z_os, zfsvfs, zfs_replay_vector); zfsvfs->z_replay = B_FALSE; |
