hammer2 - Cleanup error paths
authorMatthew Dillon <dillon@apollo.backplane.com>
Tue, 31 Mar 2015 04:50:14 +0000 (21:50 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Tue, 31 Mar 2015 04:50:14 +0000 (21:50 -0700)
commit23c7c7dd4e59da5bdb6ffa7fe2074c5b7ffe5e4f
tree0e961b31cac96a1331c71188f0a8073b1f01be80
parent2221183477f89177a60e7c8a337d9dc720fca9a2
hammer2 - Cleanup error paths

* 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.
sbin/hammer2/cmd_pfs.c
sbin/newfs_hammer2/newfs_hammer2.c
sys/vfs/hammer2/hammer2.h
sys/vfs/hammer2/hammer2_chain.c
sys/vfs/hammer2/hammer2_cluster.c
sys/vfs/hammer2/hammer2_vfsops.c