Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4e337ada authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/mfasheh/ocfs2

* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/mfasheh/ocfs2:
  ocfs2_dlm: Add missing locks in dlm_empty_lockres
  ocfs2_dlm: Missing get/put lockres in dlm_run_purge_lockres
  configfs: add missing mutex_unlock()
  ocfs2: add some missing address space callbacks
  ocfs2: Concurrent access of o2hb_region->hr_task was not locked
  ocfs2: Proper cleanup in case of error in ocfs2_register_hb_callbacks()
parents 0bdd0f38 b36c3f84
Loading
Loading
Loading
Loading
+12 −15
Original line number Original line Diff line number Diff line
@@ -1141,23 +1141,20 @@ int configfs_register_subsystem(struct configfs_subsystem *subsys)


	err = -ENOMEM;
	err = -ENOMEM;
	dentry = d_alloc(configfs_sb->s_root, &name);
	dentry = d_alloc(configfs_sb->s_root, &name);
	if (!dentry)
	if (dentry) {
		goto out_release;

		d_add(dentry, NULL);
		d_add(dentry, NULL);


		err = configfs_attach_group(sd->s_element, &group->cg_item,
		err = configfs_attach_group(sd->s_element, &group->cg_item,
					    dentry);
					    dentry);
	if (!err)
		if (err) {
		dentry = NULL;
	else
			d_delete(dentry);
			d_delete(dentry);
			dput(dentry);
		}
	}


	mutex_unlock(&configfs_sb->s_root->d_inode->i_mutex);
	mutex_unlock(&configfs_sb->s_root->d_inode->i_mutex);


	if (dentry) {
	if (err) {
	    dput(dentry);
out_release:
		unlink_group(group);
		unlink_group(group);
		configfs_release_fs();
		configfs_release_fs();
	}
	}
+25 −1
Original line number Original line Diff line number Diff line
@@ -614,6 +614,27 @@ static void ocfs2_dio_end_io(struct kiocb *iocb,
	ocfs2_rw_unlock(inode, 0);
	ocfs2_rw_unlock(inode, 0);
}
}


/*
 * ocfs2_invalidatepage() and ocfs2_releasepage() are shamelessly stolen
 * from ext3.  PageChecked() bits have been removed as OCFS2 does not
 * do journalled data.
 */
static void ocfs2_invalidatepage(struct page *page, unsigned long offset)
{
	journal_t *journal = OCFS2_SB(page->mapping->host->i_sb)->journal->j_journal;

	journal_invalidatepage(journal, page, offset);
}

static int ocfs2_releasepage(struct page *page, gfp_t wait)
{
	journal_t *journal = OCFS2_SB(page->mapping->host->i_sb)->journal->j_journal;

	if (!page_has_buffers(page))
		return 0;
	return journal_try_to_free_buffers(journal, page, wait);
}

static ssize_t ocfs2_direct_IO(int rw,
static ssize_t ocfs2_direct_IO(int rw,
			       struct kiocb *iocb,
			       struct kiocb *iocb,
			       const struct iovec *iov,
			       const struct iovec *iov,
@@ -661,5 +682,8 @@ const struct address_space_operations ocfs2_aops = {
	.commit_write	= ocfs2_commit_write,
	.commit_write	= ocfs2_commit_write,
	.bmap		= ocfs2_bmap,
	.bmap		= ocfs2_bmap,
	.sync_page	= block_sync_page,
	.sync_page	= block_sync_page,
	.direct_IO	= ocfs2_direct_IO
	.direct_IO	= ocfs2_direct_IO,
	.invalidatepage	= ocfs2_invalidatepage,
	.releasepage	= ocfs2_releasepage,
	.migratepage	= buffer_migrate_page,
};
};
+34 −16
Original line number Original line Diff line number Diff line
@@ -1234,6 +1234,7 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg,
				     const char *page,
				     const char *page,
				     size_t count)
				     size_t count)
{
{
	struct task_struct *hb_task;
	long fd;
	long fd;
	int sectsize;
	int sectsize;
	char *p = (char *)page;
	char *p = (char *)page;
@@ -1319,20 +1320,28 @@ static ssize_t o2hb_region_dev_write(struct o2hb_region *reg,
	 */
	 */
	atomic_set(&reg->hr_steady_iterations, O2HB_LIVE_THRESHOLD + 1);
	atomic_set(&reg->hr_steady_iterations, O2HB_LIVE_THRESHOLD + 1);


	reg->hr_task = kthread_run(o2hb_thread, reg, "o2hb-%s",
	hb_task = kthread_run(o2hb_thread, reg, "o2hb-%s",
			      reg->hr_item.ci_name);
			      reg->hr_item.ci_name);
	if (IS_ERR(reg->hr_task)) {
	if (IS_ERR(hb_task)) {
		ret = PTR_ERR(reg->hr_task);
		ret = PTR_ERR(hb_task);
		mlog_errno(ret);
		mlog_errno(ret);
		reg->hr_task = NULL;
		goto out;
		goto out;
	}
	}


	spin_lock(&o2hb_live_lock);
	reg->hr_task = hb_task;
	spin_unlock(&o2hb_live_lock);

	ret = wait_event_interruptible(o2hb_steady_queue,
	ret = wait_event_interruptible(o2hb_steady_queue,
				atomic_read(&reg->hr_steady_iterations) == 0);
				atomic_read(&reg->hr_steady_iterations) == 0);
	if (ret) {
	if (ret) {
		kthread_stop(reg->hr_task);
		spin_lock(&o2hb_live_lock);
		hb_task = reg->hr_task;
		reg->hr_task = NULL;
		reg->hr_task = NULL;
		spin_unlock(&o2hb_live_lock);

		if (hb_task)
			kthread_stop(hb_task);
		goto out;
		goto out;
	}
	}


@@ -1354,10 +1363,17 @@ out:
static ssize_t o2hb_region_pid_read(struct o2hb_region *reg,
static ssize_t o2hb_region_pid_read(struct o2hb_region *reg,
                                      char *page)
                                      char *page)
{
{
	if (!reg->hr_task)
	pid_t pid = 0;

	spin_lock(&o2hb_live_lock);
	if (reg->hr_task)
		pid = reg->hr_task->pid;
	spin_unlock(&o2hb_live_lock);

	if (!pid)
		return 0;
		return 0;


	return sprintf(page, "%u\n", reg->hr_task->pid);
	return sprintf(page, "%u\n", pid);
}
}


struct o2hb_region_attribute {
struct o2hb_region_attribute {
@@ -1495,13 +1511,17 @@ out:
static void o2hb_heartbeat_group_drop_item(struct config_group *group,
static void o2hb_heartbeat_group_drop_item(struct config_group *group,
					   struct config_item *item)
					   struct config_item *item)
{
{
	struct task_struct *hb_task;
	struct o2hb_region *reg = to_o2hb_region(item);
	struct o2hb_region *reg = to_o2hb_region(item);


	/* stop the thread when the user removes the region dir */
	/* stop the thread when the user removes the region dir */
	if (reg->hr_task) {
	spin_lock(&o2hb_live_lock);
		kthread_stop(reg->hr_task);
	hb_task = reg->hr_task;
	reg->hr_task = NULL;
	reg->hr_task = NULL;
	}
	spin_unlock(&o2hb_live_lock);

	if (hb_task)
		kthread_stop(hb_task);


	config_item_put(item);
	config_item_put(item);
}
}
@@ -1682,7 +1702,7 @@ out:
}
}
EXPORT_SYMBOL_GPL(o2hb_register_callback);
EXPORT_SYMBOL_GPL(o2hb_register_callback);


int o2hb_unregister_callback(struct o2hb_callback_func *hc)
void o2hb_unregister_callback(struct o2hb_callback_func *hc)
{
{
	BUG_ON(hc->hc_magic != O2HB_CB_MAGIC);
	BUG_ON(hc->hc_magic != O2HB_CB_MAGIC);


@@ -1690,15 +1710,13 @@ int o2hb_unregister_callback(struct o2hb_callback_func *hc)
	     __builtin_return_address(0), hc);
	     __builtin_return_address(0), hc);


	if (list_empty(&hc->hc_item))
	if (list_empty(&hc->hc_item))
		return 0;
		return;


	down_write(&o2hb_callback_sem);
	down_write(&o2hb_callback_sem);


	list_del_init(&hc->hc_item);
	list_del_init(&hc->hc_item);


	up_write(&o2hb_callback_sem);
	up_write(&o2hb_callback_sem);

	return 0;
}
}
EXPORT_SYMBOL_GPL(o2hb_unregister_callback);
EXPORT_SYMBOL_GPL(o2hb_unregister_callback);


+1 −1
Original line number Original line Diff line number Diff line
@@ -70,7 +70,7 @@ void o2hb_setup_callback(struct o2hb_callback_func *hc,
			 void *data,
			 void *data,
			 int priority);
			 int priority);
int o2hb_register_callback(struct o2hb_callback_func *hc);
int o2hb_register_callback(struct o2hb_callback_func *hc);
int o2hb_unregister_callback(struct o2hb_callback_func *hc);
void o2hb_unregister_callback(struct o2hb_callback_func *hc);
void o2hb_fill_node_map(unsigned long *map,
void o2hb_fill_node_map(unsigned long *map,
			unsigned bytes);
			unsigned bytes);
void o2hb_init(void);
void o2hb_init(void);
+2 −11
Original line number Original line Diff line number Diff line
@@ -1638,17 +1638,8 @@ static void o2net_hb_node_up_cb(struct o2nm_node *node, int node_num,


void o2net_unregister_hb_callbacks(void)
void o2net_unregister_hb_callbacks(void)
{
{
	int ret;
	o2hb_unregister_callback(&o2net_hb_up);

	o2hb_unregister_callback(&o2net_hb_down);
	ret = o2hb_unregister_callback(&o2net_hb_up);
	if (ret < 0)
		mlog(ML_ERROR, "Status return %d unregistering heartbeat up "
		     "callback!\n", ret);

	ret = o2hb_unregister_callback(&o2net_hb_down);
	if (ret < 0)
		mlog(ML_ERROR, "Status return %d unregistering heartbeat down "
		     "callback!\n", ret);
}
}


int o2net_register_hb_callbacks(void)
int o2net_register_hb_callbacks(void)
Loading