https://github.com/torvalds/linux
Revision 361cf40519a491f68b28ad90225e4611c4bf8e12 authored by Henry C Chang on 17 December 2010, 17:55:59 UTC, committed by Sage Weil on 17 December 2010, 17:55:59 UTC
The get_user_pages() helper can return fewer than the requested pages.
Error out in that case, and clean up the partial result.

Signed-off-by: Henry C Chang <henry_c_chang@tcloudcomputing.com>
Signed-off-by: Sage Weil <sage@newdream.net>
1 parent b6aa590
Raw File
Tip revision: 361cf40519a491f68b28ad90225e4611c4bf8e12 authored by Henry C Chang on 17 December 2010, 17:55:59 UTC
ceph: handle partial result from get_user_pages
Tip revision: 361cf40
tty_mutex.c
/*
 * drivers/char/tty_lock.c
 */
#include <linux/tty.h>
#include <linux/module.h>
#include <linux/kallsyms.h>
#include <linux/semaphore.h>
#include <linux/sched.h>

/*
 * The 'big tty mutex'
 *
 * This mutex is taken and released by tty_lock() and tty_unlock(),
 * replacing the older big kernel lock.
 * It can no longer be taken recursively, and does not get
 * released implicitly while sleeping.
 *
 * Don't use in new code.
 */
static DEFINE_MUTEX(big_tty_mutex);
struct task_struct *__big_tty_mutex_owner;
EXPORT_SYMBOL_GPL(__big_tty_mutex_owner);

/*
 * Getting the big tty mutex.
 */
void __lockfunc tty_lock(void)
{
	struct task_struct *task = current;

	WARN_ON(__big_tty_mutex_owner == task);

	mutex_lock(&big_tty_mutex);
	__big_tty_mutex_owner = task;
}
EXPORT_SYMBOL(tty_lock);

void __lockfunc tty_unlock(void)
{
	struct task_struct *task = current;

	WARN_ON(__big_tty_mutex_owner != task);
	__big_tty_mutex_owner = NULL;

	mutex_unlock(&big_tty_mutex);
}
EXPORT_SYMBOL(tty_unlock);
back to top