From: Marko O. <d0...@us...> - 2010-11-27 17:35:22
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "kdfs". The branch, make_kdfs_compile has been updated via ef910377aab96ccc92c31391eb2be4c9d61ceb0a (commit) from df5c8a1e9e7ea4604a45a715bfc80dd663905001 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ef910377aab96ccc92c31391eb2be4c9d61ceb0a Author: Marko Obrovac <mar...@in...> Date: Sat Nov 27 19:18:41 2010 +0100 [BUGFIX] Do not mount a partition if the root partition hasn't been mounted yet The node trying to mount the partition fills its sb info. During this process it discovers the id of the root node. It gets the cluster-wide sb bitmap, and, using the new cw_bitmap_is_mounted function, checks whether the root node has mounted its partition. For this to be possible, kdfs_iol_sb_default_owner has been rewritten: it assumes that if the root node's id is unknown, the current node is the root one. The assumption is perfectly safe to make, since all other nodes trying to get the cw sb will have already set k_rootsb_nodeid. [BUGFIX] Take into account the return value of __kdfs_fill_sb [BUGFIX] Remove a possible null-pointer bug in kdfs_twice_grabsb diff --git a/fs/kdfs/super.c b/fs/kdfs/super.c index 0314574..f091226 100644 --- a/fs/kdfs/super.c +++ b/fs/kdfs/super.c @@ -853,6 +853,26 @@ int cw_bitmap_is_legit(void *data) return 0; } +/* + * Check whether the partition with the given nodeid is mounted + * + * @author Marko Obrovac + * + * @param cw_sb the cluster-wide superblock bitmap containing + * the mounted superblocks + * @param nodeid the nodeid to check + * + * @return 0 the partition is not mounted or a wrong nodeid + * was given + * 1 the partition is mounted + */ +int cw_bitmap_is_mounted(struct kdfs_cw_sb *cw_sb, unsigned long nodeid) +{ + if (nodeid < 1 || nodeid >= cw_sb->cw_bitmap->size) + return 0; + return test_bit(nodeid, (unsigned long *)cw_sb->cw_bitmap->map); +} + /******************************************************************************/ /* */ @@ -1317,6 +1337,7 @@ int kdfs_fill_super(struct kdfs_super_block *k_sb, void *data, int silent) { struct kdfs_inode *kdfs_root_inode; struct dentry *root_dentry; + struct kdfs_cw_sb *kdfs_cwsb = NULL; PRINT_FUNCTION_NAME; @@ -1338,14 +1359,23 @@ int kdfs_fill_super(struct kdfs_super_block *k_sb, void *data, int silent) if (!parse_options((char *) data, k_sb)) goto failed_mount; - + /* Retrieve root inodeid and inode bitmap from super metafile */ - /* - * TODO NOW, Marko - * Take into account return values - */ - __kdfs_fill_sb(k_sb); + if (__kdfs_fill_sb(k_sb) != 0) + goto failed_mount; + /* Check whether the ROOT node has been mounted */ + if (kerrighed_node_id != k_rootsb_nodeid) { + kdfs_cwsb = __kdfs_get_cwsb(); + BUG_ON(kdfs_cwsb == NULL); + if (cw_bitmap_is_mounted(kdfs_cwsb, k_rootsb_nodeid) == 0) { + DEBUG(DBG_ALERT, "KDFS: The root node has not been mounted yet! Cannot mount this partition!\n"); + __kdfs_put_cwsb(); + goto failed_mount; + } + __kdfs_put_cwsb(); + } + /* Get root inode */ kdfs_root_inode = kdfs_iget(KDFS_COMPUTE_ROOT_INODEID(k_sb)); /* Create the root dentry */ @@ -1378,7 +1408,7 @@ int kdfs_get_sb(struct file_system_type *fs_type, int flags, struct kdfs_cw_sb *kdfs_cwsb = NULL; PRINT_FUNCTION_NAME; - + k_sb = kdfs_grabsb(kerrighed_node_id); if (k_sb == NULL) { DEBUG(DBG_ALERT, "Cannot retrieve the kddm superblock\n"); @@ -1711,7 +1741,10 @@ void kdfs_removesb(unsigned long sbid) struct kdfs_super_block *kdfs_twice_grabsb(unsigned long sbid) { struct kdfs_generic_sb *kgsb = kddm_find_object(kddm_def_ns, KDFS_SB_KDDM_ID, sbid); - struct kdfs_super_block *k_sb = kgsb->real_sb; + struct kdfs_super_block *k_sb = NULL; + if (!kgsb) + return NULL; + k_sb = kgsb->real_sb; if (!k_sb) { kgsb = kddm_grab_object(kddm_def_ns, KDFS_SB_KDDM_ID, sbid); k_sb = kgsb->real_sb; @@ -2088,7 +2121,17 @@ kerrighed_node_t kdfs_iol_sb_default_owner(kddm_set_t *kddm_set, objid_t objid, * We should be able to return the same default node for the cw sb object. * For the moment, we use a global value k_rootsb_nodeid */ - return (objid != KDFS_CWSB_ID ? objid : k_rootsb_nodeid); + if (objid != KDFS_CWSB_ID) + return objid; + /* + * TODO PRIORITY 4: Marko + * Here we assume we're located on the root node, since we acquire + * k_rootsb_nodeid during mount time (here we assume the root node's + * partition hasn't yet been mounted + */ + if (k_rootsb_nodeid == KERRIGHED_NODE_ID_NONE) + k_rootsb_nodeid = kerrighed_node_id; + return k_rootsb_nodeid; } /* ----------------------------------------------------------------------- Summary of changes: fs/kdfs/super.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 52 insertions(+), 9 deletions(-) hooks/post-receive -- kdfs |