Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 286966
b: refs/heads/master
c: dfd07ec
h: refs/heads/master
v: v3
  • Loading branch information
Linus Torvalds committed Jan 30, 2012
1 parent 64daba2 commit e6493ef
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bf9c05d5b6d19b3e4c9fe21047694e94f48db89b
refs/heads/master: dfd07ec3fa42fb14c4e333747cb73903220c6e81
2 changes: 2 additions & 0 deletions trunk/include/linux/freezer.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ extern bool __refrigerator(bool check_kthr_stop);
extern int freeze_processes(void);
extern int freeze_kernel_threads(void);
extern void thaw_processes(void);
extern void thaw_kernel_threads(void);

static inline bool try_to_freeze(void)
{
Expand Down Expand Up @@ -174,6 +175,7 @@ static inline bool __refrigerator(bool check_kthr_stop) { return false; }
static inline int freeze_processes(void) { return -ENOSYS; }
static inline int freeze_kernel_threads(void) { return -ENOSYS; }
static inline void thaw_processes(void) {}
static inline void thaw_kernel_threads(void) {}

static inline bool try_to_freeze(void) { return false; }

Expand Down
19 changes: 19 additions & 0 deletions trunk/kernel/power/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,22 @@ void thaw_processes(void)
printk("done.\n");
}

void thaw_kernel_threads(void)
{
struct task_struct *g, *p;

pm_nosig_freezing = false;
printk("Restarting kernel threads ... ");

thaw_workqueues();

read_lock(&tasklist_lock);
do_each_thread(g, p) {
if (p->flags & (PF_KTHREAD | PF_WQ_WORKER))
__thaw_task(p);
} while_each_thread(g, p);
read_unlock(&tasklist_lock);

schedule();
printk("done.\n");
}
9 changes: 9 additions & 0 deletions trunk/kernel/power/user.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,15 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd,
swsusp_free();
memset(&data->handle, 0, sizeof(struct snapshot_handle));
data->ready = 0;
/*
* It is necessary to thaw kernel threads here, because
* SNAPSHOT_CREATE_IMAGE may be invoked directly after
* SNAPSHOT_FREE. In that case, if kernel threads were not
* thawed, the preallocation of memory carried out by
* hibernation_snapshot() might run into problems (i.e. it
* might fail or even deadlock).
*/
thaw_kernel_threads();
break;

case SNAPSHOT_PREF_IMAGE_SIZE:
Expand Down
17 changes: 16 additions & 1 deletion trunk/net/sunrpc/auth_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ generic_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
if (gcred->acred.group_info != NULL)
get_group_info(gcred->acred.group_info);
gcred->acred.machine_cred = acred->machine_cred;
gcred->acred.principal = acred->principal;

dprintk("RPC: allocated %s cred %p for uid %d gid %d\n",
gcred->acred.machine_cred ? "machine" : "generic",
Expand Down Expand Up @@ -123,6 +124,17 @@ generic_destroy_cred(struct rpc_cred *cred)
call_rcu(&cred->cr_rcu, generic_free_cred_callback);
}

static int
machine_cred_match(struct auth_cred *acred, struct generic_cred *gcred, int flags)
{
if (!gcred->acred.machine_cred ||
gcred->acred.principal != acred->principal ||
gcred->acred.uid != acred->uid ||
gcred->acred.gid != acred->gid)
return 0;
return 1;
}

/*
* Match credentials against current process creds.
*/
Expand All @@ -132,9 +144,12 @@ generic_match(struct auth_cred *acred, struct rpc_cred *cred, int flags)
struct generic_cred *gcred = container_of(cred, struct generic_cred, gc_base);
int i;

if (acred->machine_cred)
return machine_cred_match(acred, gcred, flags);

if (gcred->acred.uid != acred->uid ||
gcred->acred.gid != acred->gid ||
gcred->acred.machine_cred != acred->machine_cred)
gcred->acred.machine_cred != 0)
goto out_nomatch;

/* Optimisation in the case where pointers are identical... */
Expand Down

0 comments on commit e6493ef

Please sign in to comment.