ocfs2 updates
Subsystems (3)
PATCH 1/1 ocfs2 updates
Please pull from 'upstream-linus' branch ofgit://oss.oracle.com/home/sourcebo/git/ocfs2.git
to receive the following updates:
Documentation/filesystems/ocfs2.txt | 1 fs/Kconfig | 2 fs/ocfs2/buffer_head_io.c | 10 - fs/ocfs2/dlm/dlmcommon.h | 1 fs/ocfs2/dlm/dlmdomain.c | 18 ++ fs/ocfs2/dlm/dlmmaster.c | 24 +-- fs/ocfs2/dlm/dlmrecovery.c | 250 ++++++++++++++++++++++++++++++------ fs/ocfs2/dlm/dlmunlock.c | 13 + fs/ocfs2/dlm/userdlm.c | 2 fs/ocfs2/extent_map.c | 2 fs/ocfs2/inode.c | 6 fs/ocfs2/inode.h | 4 fs/ocfs2/journal.c | 14 +- fs/ocfs2/ocfs2.h | 3 fs/ocfs2/super.c | 8 - fs/ocfs2/uptodate.c | 12 - fs/ocfs2/uptodate.h | 2 17 files changed, 290 insertions(+), 82 deletions(-)
Adrian Bunk:
OCFS2: __init / __exit problem fs/ocfs2/dlm/dlmrecovery.c must #include <linux/delay.h>
Arjan van de Ven:
ocfs2: Semaphore to mutex conversion.
J. Bruce Fields:
[OCFS2] Documentation Fix
Jeff Mahoney:
ocfs2/dlm: fix compilation on ia64
Joel Becker:
o Remove confusing Kconfig text for CONFIGFS_FS.
Kurt Hackel:
ocfs2/dlm: fixes
Mark Fasheh:
[OCFS2] Make ip_io_sem a mutex
Documentation/filesystems/ocfs2.txt +1 -0
@@ -35,6 +35,7 @@ Features which OCFS2 does not support ye be cluster coherent. - quotas - cluster aware flock + - cluster aware lockf - Directory change notification (F_NOTIFY) - Distributed Caching (F_SETLEASE/F_GETLEASE/break_lease) - POSIX ACLs
fs/Kconfig +0 -2
@@ -883,8 +883,6 @@ config CONFIGFS_FS Both sysfs and configfs can and should exist together on the same system. One is not a replacement for the other. - If unsure, say N. - endmenu menu "Miscellaneous filesystems"
fs/ocfs2/buffer_head_io.c +5 -5
@@ -58,7 +58,7 @@ int ocfs2_write_block(struct ocfs2_super goto out; } -down (&OCFS2_I (inode)->ip_io_sem); +mutex_lock (&OCFS2_I (inode)->ip_io_mutex);lock_buffer (bh);set_buffer_uptodate (bh);
@@ -82,7 +82,7 @@ int ocfs2_write_block(struct ocfs2_superbrelse (bh); } -up (&OCFS2_I (inode)->ip_io_sem); +mutex_unlock (&OCFS2_I (inode)->ip_io_mutex); out:mlog_exit (ret);return ret;
@@ -125,13 +125,13 @@ int ocfs2_read_blocks(struct ocfs2_super flags &= ~OCFS2_BH_CACHED ;if (inode) -down (&OCFS2_I (inode)->ip_io_sem); +mutex_lock (&OCFS2_I (inode)->ip_io_mutex);for (i =0 ; i < nr ; i++) {if (bhs[i] ==NULL ) { bhs[i] =sb_getblk (sb, block++);if (bhs[i] ==NULL ) {if (inode) -up (&OCFS2_I (inode)->ip_io_sem); +mutex_unlock (&OCFS2_I (inode)->ip_io_mutex); status = -EIO ;mlog_errno (status); goto bail;
@@ -220,7 +220,7 @@ int ocfs2_read_blocks(struct ocfs2_superocfs2_set_buffer_uptodate (inode, bh); }if (inode) -up (&OCFS2_I (inode)->ip_io_sem); +mutex_unlock (&OCFS2_I (inode)->ip_io_mutex);mlog (ML_BH_IO ,"block=(%" MLFu64"), nr=(%d), cached=%s\n" , block, nr, (!(flags &OCFS2_BH_CACHED ) || ignore_cache) ?"no" :"yes" );
fs/ocfs2/dlm/dlmcommon.h +1 -0
@@ -657,6 +657,7 @@ void dlm_complete_thread(struct dlm_ctxtint dlm_launch_recovery_thread (struct dlm_ctxt *dlm);void dlm_complete_recovery_thread (struct dlm_ctxt *dlm);void dlm_wait_for_recovery (struct dlm_ctxt *dlm); +int dlm_is_node_dead (struct dlm_ctxt *dlm,u8 node);void dlm_put (struct dlm_ctxt *dlm);struct dlm_ctxt *dlm_grab (struct dlm_ctxt *dlm);
fs/ocfs2/dlm/dlmdomain.c +17 -1
@@ -573,8 +573,11 @@ static int dlm_query_join_handler(structspin_lock (&dlm_domain_lock); dlm =__dlm_lookup_domain_full (query->domain, query->name_len);/* Once the dlm ctxt is marked as leaving then we don't want -* to be put in someone's domain map. */ +* to be put in someone's domain map. +* Also, explicitly disallow joining at certain troublesome +* times (ie. during recovery). */ if (dlm && dlm->dlm_state !=DLM_CTXT_LEAVING ) { +int bit = query->node_idx;spin_lock (&dlm->spinlock); if (dlm->dlm_state == DLM_CTXT_NEW &&
@@ -586,6 +589,19 @@ static int dlm_query_join_handler(struct }else if (dlm->joining_node !=DLM_LOCK_RES_OWNER_UNKNOWN ) {/* Disallow parallel joins. */ response =JOIN_DISALLOW ; + }else if (dlm->reco.state &DLM_RECO_STATE_ACTIVE ) { +mlog (ML_NOTICE ,"node %u trying to join, but recovery " +"is ongoing.\n" , bit); + response =JOIN_DISALLOW ; + }else if (test_bit (bit, dlm->recovery_map)) { +mlog (ML_NOTICE ,"node %u trying to join, but it " +"still needs recovery.\n" , bit); + response =JOIN_DISALLOW ; + }else if (test_bit (bit, dlm->domain_map)) { +mlog (ML_NOTICE ,"node %u trying to join, but it " +"is still in the domain! needs recovery?\n" , + bit); + response =JOIN_DISALLOW ; }else {/* Alright we're fully a part of this domain * so we keep some state as to who's joining
fs/ocfs2/dlm/dlmmaster.c +13 -11
@@ -1050,17 +1050,10 @@ static int dlm_restart_lock_mastery(stru node =dlm_bitmap_diff_iter_next (&bdi, &sc);while (node >=0 ) {if (sc ==NODE_UP ) { -/* a node came up. easy. might not even need -* to talk to it if its node number is higher -* or if we are already blocked. */ -mlog (0 ,"node up! %d\n" , node); -if (blocked) - goto next; - -if (node > dlm->node_num) { -mlog (0 ,"node > this node. skipping.\n" ); - goto next; - } +/* a node came up. clear any old vote from +* the response map and set it in the vote map +* then restart the mastery. */ +mlog (ML_NOTICE ,"node %d up while restarting\n" , node);/* redo the master request, but only for the new node */ mlog (0 ,"sending request to new node\n" );
@@ -2005,6 +1998,15 @@ fail:break ;mlog (0 ,"timed out during migration\n" ); +/* avoid hang during shutdown when migrating lockres +* to a node which also goes down */ +if (dlm_is_node_dead (dlm, target)) { +mlog (0 ,"%s:%.*s: expected migration target %u " +"is no longer up. restarting.\n" , + dlm->name, res->lockname.len, + res->lockname.name, target); + ret = -ERESTARTSYS ; + } }if (ret == -ERESTARTSYS ) {/* migration failed, detach and clean up mle */
fs/ocfs2/dlm/dlmrecovery.c +213 -37
427 lines not on this page · raw message
fs/ocfs2/dlm/dlmunlock.c +13 -0
@@ -188,6 +188,19 @@ static enum dlm_status dlmunlock_common( actions &= ~(DLM_UNLOCK_REMOVE_LOCK |DLM_UNLOCK_REGRANT_LOCK |DLM_UNLOCK_CLEAR_CONVERT_TYPE ); + }else if (status ==DLM_RECOVERING || + status ==DLM_MIGRATING || + status ==DLM_FORWARD ) { +/* must clear the actions because this unlock +* is about to be retried. cannot free or do +* any list manipulation. */ +mlog (0 ,"%s:%.*s: clearing actions, %s\n" , + dlm->name, res->lockname.len, + res->lockname.name, + status==DLM_RECOVERING ?"recovering" : + (status==DLM_MIGRATING ?"migrating" : +"forward" )); + actions =0 ; }if (flags &LKM_CANCEL ) lock->cancel_pending =0 ;
fs/ocfs2/dlm/userdlm.c +1 -1
@@ -27,7 +27,7 @@* Boston, MA 021110-1307, USA. */ -#include <asm/signal.h> +#include <linux/signal.h> #include <linux/module.h> #include <linux/fs.h>
fs/ocfs2/extent_map.c +1 -1
@@ -988,7 +988,7 @@ int __init init_ocfs2_extent_maps(void)return 0 ; } -void __exit exit_ocfs2_extent_maps(void) +void exit_ocfs2_extent_maps (void ) {kmem_cache_destroy (ocfs2_em_ent_cachep); }
fs/ocfs2/inode.c +3 -3
@@ -903,10 +903,10 @@ void ocfs2_clear_inode(struct inode *ino"Clear inode of %" MLFu64", inode is locked\n" , oi->ip_blkno); -mlog_bug_on_msg (down_trylock (&oi->ip_io_sem), -"Clear inode of %" MLFu64", io_sem is locked\n" , +mlog_bug_on_msg (!mutex_trylock (&oi->ip_io_mutex), +"Clear inode of %" MLFu64", io_mutex is locked\n" , oi->ip_blkno); -up (&oi->ip_io_sem); +mutex_unlock (&oi->ip_io_mutex);/* * down_trylock() returns 0, down_write_trylock() returns 1
fs/ocfs2/inode.h +2 -2
@@ -46,10 +46,10 @@ struct ocfs2_inode_infostruct list_head ip_io_markers;int ip_orphaned_slot; -struct semaphore ip_io_sem; +struct mutex ip_io_mutex;/* Used by the journalling code to attach an inode to a -* handle. These are protected by ip_io_sem in order to lock +* handle. These are protected by ip_io_mutex in order to lock * out other I/O to the inode until we either commit or * abort. */ struct list_head ip_handle_list;
fs/ocfs2/journal.c +7 -7
@@ -401,7 +401,7 @@ int ocfs2_journal_access(struct ocfs2_jo* j_trans_barrier for us. */ ocfs2_set_inode_lock_trans (OCFS2_SB (inode->i_sb)->journal, inode); -down (&OCFS2_I (inode)->ip_io_sem); +mutex_lock (&OCFS2_I (inode)->ip_io_mutex);switch (type) {case OCFS2_JOURNAL_ACCESS_CREATE :case OCFS2_JOURNAL_ACCESS_WRITE :
@@ -416,7 +416,7 @@ int ocfs2_journal_access(struct ocfs2_jo status = -EINVAL ;mlog (ML_ERROR ,"Uknown access type!\n" ); } -up (&OCFS2_I (inode)->ip_io_sem); +mutex_unlock (&OCFS2_I (inode)->ip_io_mutex);if (status <0 ) mlog(ML_ERROR, "Error %d getting %d access to buffer!\n",
@@ -1072,10 +1072,10 @@ restart: NULL); bail: -down (&osb->recovery_lock); +mutex_lock (&osb->recovery_lock);if (!status && !ocfs2_node_map_is_empty (osb, &osb->recovery_map)) { -up (&osb->recovery_lock); +mutex_unlock (&osb->recovery_lock); goto restart; }
@@ -1083,7 +1083,7 @@ bail:mb ();/* sync with ocfs2_recovery_thread_running */ wake_up (&osb->recovery_event); -up (&osb->recovery_lock); +mutex_unlock (&osb->recovery_lock);mlog_exit (status);/* no one is callint kthread_stop() for us so the kthread() api
@@ -1098,7 +1098,7 @@ void ocfs2_recovery_thread(struct ocfs2_mlog_entry ("(node_num=%d, osb->node_num = %d)\n" , node_num, osb->node_num); -down (&osb->recovery_lock); +mutex_lock (&osb->recovery_lock);if (osb->disable_recovery) goto out;
@@ -1120,7 +1120,7 @@ void ocfs2_recovery_thread(struct ocfs2_ } out: -up (&osb->recovery_lock); +mutex_unlock (&osb->recovery_lock);wake_up (&osb->recovery_event);mlog_exit_void ();
fs/ocfs2/ocfs2.h +2 -1
@@ -33,6 +33,7 @@#include <linux/rbtree.h> #include <linux/workqueue.h> #include <linux/kref.h> +#include <linux/mutex.h> #include "cluster/nodemanager.h" #include "cluster/heartbeat.h"
@@ -233,7 +234,7 @@ struct ocfs2_superstruct proc_dir_entry *proc_sub_dir;/* points to /proc/fs/ocfs2/<maj_min> */ atomic_t vol_state; -struct semaphore recovery_lock; +struct mutex recovery_lock;struct task_struct *recovery_thread_task;int disable_recovery;wait_queue_head_t checkpoint_event;
fs/ocfs2/super.c +4 -4
@@ -932,7 +932,7 @@ static void ocfs2_inode_init_once(void * oi->ip_dir_start_lookup =0 ;init_rwsem (&oi->ip_alloc_sem); -init_MUTEX (&(oi->ip_io_sem)); +mutex_init (&oi->ip_io_mutex); oi->ip_blkno =0ULL ; oi->ip_clusters =0 ;
@@ -1137,9 +1137,9 @@ static void ocfs2_dismount_volume(struct/* disable any new recovery threads and wait for any currently * running ones to exit. Do this before setting the vol_state. */ -down (&osb->recovery_lock); +mutex_lock (&osb->recovery_lock); osb->disable_recovery =1 ; -up (&osb->recovery_lock); +mutex_unlock (&osb->recovery_lock);wait_event (osb->recovery_event, !ocfs2_recovery_thread_running (osb));/* At this point, we know that no more recovery threads can be
@@ -1283,7 +1283,7 @@ static int ocfs2_initialize_super(structsnprintf (osb->dev_str,sizeof (osb->dev_str),"%u,%u" ,MAJOR (osb->sb->s_dev),MINOR (osb->sb->s_dev)); -init_MUTEX (&osb->recovery_lock); +mutex_init (&osb->recovery_lock); osb->disable_recovery =0 ; osb->recovery_thread_task =NULL ;
fs/ocfs2/uptodate.c +6 -6
@@ -388,7 +388,7 @@ out_free: } } -/* Item insertion is guarded by ip_io_sem, so the insertion path takes +/* Item insertion is guarded by ip_io_mutex, so the insertion path takes * advantage of this by not rechecking for a duplicate insert during * the slow case. Additionally, if the cache needs to be bumped up to * a tree, the code will not recheck after acquiring the lock --
@@ -418,7 +418,7 @@ void ocfs2_set_buffer_uptodate(struct in (unsigned long long) bh->b_blocknr);/* No need to recheck under spinlock - insertion is guarded by -* ip_io_sem */ +* ip_io_mutex */ spin_lock (&oi->ip_lock);if (ocfs2_insert_can_use_array (oi, ci)) {/* Fast case - it's an array and there's a free
@@ -440,7 +440,7 @@ void ocfs2_set_buffer_uptodate(struct in/* Called against a newly allocated buffer. Most likely nobody should * be able to read this sort of metadata while it's still being -* allocated, but this is careful to take ip_io_sem anyway. */ +* allocated, but this is careful to take ip_io_mutex anyway. */ void ocfs2_set_new_buffer_uptodate (struct inode *inode,struct buffer_head *bh) {
@@ -451,9 +451,9 @@ void ocfs2_set_new_buffer_uptodate(strucset_buffer_uptodate (bh); -down (&oi->ip_io_sem); +mutex_lock (&oi->ip_io_mutex);ocfs2_set_buffer_uptodate (inode, bh); -up (&oi->ip_io_sem); +mutex_unlock (&oi->ip_io_mutex); }/* Requires ip_lock. */
@@ -537,7 +537,7 @@ int __init init_ocfs2_uptodate_cache(voireturn 0 ; } -void __exit exit_ocfs2_uptodate_cache(void) +void exit_ocfs2_uptodate_cache (void ) {if (ocfs2_uptodate_cachep)kmem_cache_destroy (ocfs2_uptodate_cachep);
fs/ocfs2/uptodate.h +1 -1
@@ -27,7 +27,7 @@#define OCFS2_UPTODATE_H int __init init_ocfs2_uptodate_cache (void ); -void __exit exit_ocfs2_uptodate_cache(void); +void exit_ocfs2_uptodate_cache (void );void ocfs2_metadata_cache_init (struct inode *inode);void ocfs2_metadata_cache_purge (struct inode *inode);