hammer2 - Cleanup error paths

Operating Systems / DragonFlyBSD - Matthew Dillon [apollo.backplane.com] - 30 March 2015 23:50 UTC

- Do not try to return I/O error status from hammer2_chain_lock() or hammer2_cluster_lock(). This is just asking for trouble by depending on callers to keep track of state in local variables.

Instead, accumulate error status in chain->error and cluster->error. Adjust cluster->error based on focus. Code does not yet check this field.

- Do not NULL-out cluster array entries on I/O errors or if unavailable. Leave the chain structure intact.

This makes the cluster's array-of-chains more deterministic and will allow upcoming code to use errored chains as a placeholder for blocking operations.

- When locking a cluster, attempt to select alternative masters or slaves for our focus if the chain we would have otherwised used is errored.

- Add inlines to test whether a chain or cluster can be read or written (writing still also requires calling *_modify()).

- Document leaving inode->pfs_nmasters set to 0 for new masters.

- Adjust hammer2 pfs-list to display whether a master is a normal master or a snapshot.

23c7c7d hammer2 - Cleanup error paths
sbin/hammer2/cmd_pfs.c | 16 +-
sbin/newfs_hammer2/newfs_hammer2.c | 5 +
sys/vfs/hammer2/hammer2.h | 64 ++++++-
sys/vfs/hammer2/hammer2_chain.c | 76 ++++----
sys/vfs/hammer2/hammer2_cluster.c | 368 ++++++++----------------------------
sys/vfs/hammer2/hammer2_vfsops.c | 4 +-
6 files changed, 191 insertions(+), 342 deletions(-)

Upstream: gitweb.dragonflybsd.org


  • Share