ocfs2 fixes
PATCH 1/1 ocfs2 fixes
We're post rc1 so this is fixes only. The configfs ones are minor, but small, trivial, and obvious - so I included those as well.
Please pull from 'upstream-linus' branch ofgit://oss.oracle.com/home/sourcebo/git/ocfs2.git
to receive the following updates:
fs/Kconfig | 2 - fs/configfs/dir.c | 2 - fs/ocfs2/cluster/heartbeat.c | 40 ++++++++++++++++++----- fs/ocfs2/dlm/userdlm.c | 74 ++++++++++++++++++++++++++++++++----------- fs/ocfs2/file.c | 19 ++++++----- 5 files changed, 101 insertions(+), 36 deletions(-)
Adrian Bunk:
CONFIGFS_FS must depend on SYSFS
Eric Sesterhenn:
Bogus NULL pointer check in fs/configfs/dir.c
Mark Fasheh:
ocfs2: multi node truncate fix
ocfs2: remove an overly aggressive BUG() in dlmfs
ocfs2: catch an invalid ast case in dlmfs
ocfs2: Handle the DLM_CANCELGRANT case in user_unlock_ast()
ocfs2: test and set teardown flag early in user_dlm_destroy_lock()
ocfs2: Better I/O error handling in heartbeat
fs/Kconfig +1 -1
@@ -861,7 +861,7 @@ config RAMFS config CONFIGFS_FS tristate "Userspace-driven configuration filesystem (EXPERIMENTAL)" - depends on EXPERIMENTAL + depends on SYSFS && EXPERIMENTAL help configfs is a ram-based filesystem that provides the converse of sysfs's functionality. Where sysfs is a filesystem-based
fs/configfs/dir.c +1 -1
@@ -504,7 +504,7 @@ static int populate_groups(struct configint ret =0 ;int i; -if (group && group->default_groups) { +if (group->default_groups) {/* FYI, we're faking mkdir here * I'm not sure we need this semaphore, as we're called * from our parent's mkdir. That holds our parent's
fs/ocfs2/cluster/heartbeat.c +32 -8
@@ -153,6 +153,7 @@ struct o2hb_region {struct o2hb_bio_wait_ctxt {atomic_t wc_num_reqs;struct completion wc_io_complete; +int wc_error; };static void o2hb_write_timeout (void *arg)
@@ -186,6 +187,7 @@ static inline void o2hb_bio_wait_init(st {atomic_set (&wc->wc_num_reqs, num_ios);init_completion (&wc->wc_io_complete); + wc->wc_error =0 ; }/* Used in error paths too */
@@ -218,8 +220,10 @@ static int o2hb_bio_end_io(struct bio *b {struct o2hb_bio_wait_ctxt *wc = bio->bi_private; -if (error) +if (error) {mlog (ML_ERROR ,"IO Error %d\n" , error); + wc->wc_error = error; + }if (bio->bi_size)return 1 ;
@@ -390,6 +394,8 @@ static int o2hb_read_slots(struct o2hb_r bail_and_wait:o2hb_wait_on_io (reg, &wc); +if (wc.wc_error && !status) + status = wc.wc_error;if (bios) {for (i =0 ; i < num_bios; i++)
@@ -790,20 +796,24 @@ static int o2hb_highest_node(unsigned loreturn highest; } -static void o2hb_do_disk_heartbeat (struct o2hb_region *reg) +static int o2hb_do_disk_heartbeat (struct o2hb_region *reg) {int i, ret, highest_node, change =0 ;unsigned long configured_nodes[BITS_TO_LONGS (O2NM_MAX_NODES )];struct bio *write_bio;struct o2hb_bio_wait_ctxt write_wc; -if (o2nm_configured_node_map (configured_nodes,sizeof (configured_nodes))) -return ; + ret =o2nm_configured_node_map (configured_nodes, +sizeof (configured_nodes)); +if (ret) { +mlog_errno (ret); +return ret; + } highest_node =o2hb_highest_node (configured_nodes,O2NM_MAX_NODES );if (highest_node >=O2NM_MAX_NODES ) {mlog (ML_NOTICE ,"ocfs2_heartbeat: no configured nodes found!\n" ); -return ; +return -EINVAL ; }/* No sense in reading the slots of nodes that don't exist
@@ -813,7 +823,7 @@ static void o2hb_do_disk_heartbeat(struc ret =o2hb_read_slots (reg, highest_node +1 );if (ret <0 ) {mlog_errno (ret); -return ; +return ret; }/* With an up to date view of the slots, we can check that no
@@ -831,7 +841,7 @@ static void o2hb_do_disk_heartbeat(struc ret =o2hb_issue_node_write (reg, &write_bio, &write_wc);if (ret <0 ) {mlog_errno (ret); -return ; +return ret; } i =-1 ;
@@ -847,6 +857,15 @@ static void o2hb_do_disk_heartbeat(struc*/ o2hb_wait_on_io (reg, &write_wc);bio_put (write_bio); +if (write_wc.wc_error) { +/* Do not re-arm the write timeout on I/O error - we +* can't be sure that the new block ever made it to +* disk */ +mlog (ML_ERROR ,"Write error %d on device \"%s\"\n" , + write_wc.wc_error, reg->hr_dev_name); +return write_wc.wc_error; + } +o2hb_arm_write_timeout (reg);/* let the person who launched us know when things are steady */
@@ -854,6 +873,8 @@ static void o2hb_do_disk_heartbeat(strucif (atomic_dec_and_test (®->hr_steady_iterations))wake_up (&o2hb_steady_queue); } + +return 0 ; }/* Subtract b from a, storing the result in a. a *must* have a larger
@@ -913,7 +934,10 @@ static int o2hb_thread(void *data)* likely to time itself out. */ do_gettimeofday (&before_hb); -o2hb_do_disk_heartbeat (reg); + i =0 ; +do { + ret =o2hb_do_disk_heartbeat (reg); + }while (ret && ++i <2 );do_gettimeofday (&after_hb); elapsed_msec =o2hb_elapsed_msecs (&before_hb, &after_hb);
fs/ocfs2/dlm/userdlm.c +56 -18
132 lines not on this page · raw message
fs/ocfs2/file.c +11 -8
@@ -260,6 +260,17 @@ static int ocfs2_truncate_file(struct inif (new_i_size ==le64_to_cpu (fe->i_size)) goto bail; +/* This forces other nodes to sync and drop their pages. Do +* this even if we have a truncate without allocation change - +* ocfs2 cluster sizes can be much greater than page size, so +* we have to truncate them anyway. */ + status =ocfs2_data_lock (inode,1 ); +if (status <0 ) { +mlog_errno (status); + goto bail; + } +ocfs2_data_unlock (inode,1 ); +if (le32_to_cpu (fe->i_clusters) ==ocfs2_clusters_for_bytes (osb->sb, new_i_size)) { mlog(0, "fe->i_clusters = %u, so we do a simple truncate\n",
@@ -272,14 +283,6 @@ static int ocfs2_truncate_file(struct in goto bail; } -/* This forces other nodes to sync and drop their pages */ - status =ocfs2_data_lock (inode,1 ); -if (status <0 ) { -mlog_errno (status); - goto bail; - } -ocfs2_data_unlock (inode,1 ); -/* alright, we're going to need to do a full blown alloc size * change. Orphan the inode so that recovery can complete the * truncate if necessary. This does the task of marking